Help finding & editing map collision data

6 years 6 months ago #1 by OriginalDan
Help finding & editing map collision data was created by OriginalDan
Back for round 2 at attempting modding, so I'm testing on the "Co_Libye2" map opening scene.4ds gets the whole maps mesh data but what I'm trying to find is where the collision data for the terrain is, i know it's meant to be in the tree.KLZ file though once imported they're just black boxes listed as "bounding boxes" in the Schematic View.
I attempted copy pasting those cubes and resizing to see if i can make my own collisions but it simply crashes on map load ingame.
tried without scaling just a simple copy still crashed.
So close in my quest for new custom maps.

if we're able to find the collision data for map meshs and successfully import, edit and reexport that is the key to completely Brand new custom maps for HD2

Please Log in or Create an account to join the conversation.

6 years 6 months ago #2 by betteryouthanme
Replied by betteryouthanme on topic Help finding & editing map collision data
Well i tried to remove the collision of a stop sign (also a bounding box) in the Tutorial mission. Wrote about it here .

So there's more to edit then just the position values.. So i gave up.

The tree.klz was investigated already, at least some parts, and posted into the hidden-and-dangerous.net forums.

Then, there is an array of INT, which is long 4 bytes * number of objects linked.
Every INT is an address, which points to a byte of the file itself.
It's almost an array of char*, for those who know c++


So if you want to add a new mesh object in the tree.klz (of course it must be present in scene.4ds),
you have to address it (+1 32-bit INT value into that array) and add the name of the new object at the end of the list (in the example on hd.net: @byte 18528)
Problem now is, if you add an adress, all following addresses are not linking to their correct positions anymore. So you have to change every single position by adding 4 (as the one address you newly added is 4 bytes long)
Doing that manually is impossible.
Maybe someone can write a program for at least that part of the tree file and leave the remaining code untouched..

But theoretically that should work.


Two things fill the mind with ever new and increasing wonder and awe - the starry heavens above me and the moral law within me. Immanuel Kant

Please Log in or Create an account to join the conversation.

6 years 6 months ago - 6 years 6 months ago #3 by Stern
Replied by Stern on topic Help finding & editing map collision data
Ikaros did a good job, finding patterns from this impossible mess of data.
.

OriginalDan wrote: So close in my quest for new custom maps.
if we're able to find the collision data for map meshs and successfully import, edit and reexport that is the key to completely Brand new custom maps for HD2


This has been like a stone in the shoe for many modders :whip:

betteryouthanme wrote: Problem now is, if you add an adress, all following addresses are not linking to their correct positions anymore. So you have to change every single position by adding 4 (as the one address you newly added is 4 bytes long)
Doing that manually is impossible.
Maybe someone can write a program for at least that part of the tree file and leave the remaining code untouched..

But theoretically that should work.


But can you do it manually ? to make example...
I mean, if someone is going to make a program to do that, he must have good knowledge of the structure of the parts to be modified, anything else is just mathematics and text editing...or if you understand any script language(other than HD2 script), (maybe the one that runs this webpage ?), then make it run by browser.

The one who hesitates is lost !

Please Log in or Create an account to join the conversation.

6 years 6 months ago - 6 years 6 months ago #4 by OriginalDan
Replied by OriginalDan on topic Help finding & editing map collision data

betteryouthanme wrote: The tree.klz was investigated already, at least some parts,

Oh dayum hexediting and c++ two things i know nothing about xD a friend of mine has had better luck editing things through hex where i can get nowhere in it lol and has done some c# stuff

He's been trying to duplicate a gun and add it as a new item in hd2 that way we can add as many custom weapons as we'd like but that's proving difficult, currently he's messing with animations
Any chance anyone knows about adding totally new inventory items? he got a new item with a new icon but the icon is white and doesn't spawn the new weapon. edit: alright i mean he's replaced the tokarev icon and mesh with a c96 model but stuck on how to add it as a new item because items.sav has a definition for it. Other threads didn't give much info due to it easily being used for cheating though can just PM me or something
we're just trying to get whole new items in too.
He said even if ya link it to a different model its name is bigger than 9 chars it breaks stuff or crashes the game and that he's not too good with hex editing gotta be real careful what ya edit how change it to much or pad it out with nulls or something.

Lots of old threads about this link to sites that are dead :/
might need to hunt down hdmaster again though it doesn't look like he's posted anything since 2013

betteryouthanme wrote: Doing that manually is impossible.
Maybe someone can write a program for at least that part of the tree file and leave the remaining code untouched..

Damn sounds like we need the guy from djbozkosz.wz.cz to continue his tool from 2014 to get working for hd2
If we can contact him maybe offer cash to continue the tool or something?

Currently not home for the weekend but when I'm back ill be trying to experiment with using what other collisions we have available attempting to get them in map.

Was thinking for a dodgy but potential workaround essentially taking a vehicle stripping it down to it's collisions, edit them to match your new mesh in game
then edit said mission to spawn this 'vehicle' where your new mesh is and in theory you have working new collisions.
Essentially doing what i tried before with reusing the bounding boxes.
If that did work itad mean for a new map you'd need to have a metric crapload of boxes to make up the collisions for the entire map which may destroy performance or just crash the engine, ill look into this when I'm back.

Please Log in or Create an account to join the conversation.

6 years 6 months ago #5 by Gopniks”R”Us
Replied by Gopniks”R”Us on topic Help finding & editing map collision data
Howdy, i'm the friend that Dan mentioned , i figured i might pop on the forums as well since I was pretty well stumped.
After messing about with the Items.sav file, aside from overwriting existing items i haven't found a non invasive method that wont crash the game or ignore my new entries for items. Does anyone have any experience when it comes to adding new entries to the game or is it impossible?

Also whats the deal with Hdmasters 4ds tools? the 5ds exporter breaks the animations on export, i'm guessing he didn't get around to finishing it?

We'd appreciate any help or insight you guys could offer us for our 'little' struggle over here. :)
Cheers in advance :yipi:

Please Log in or Create an account to join the conversation.

6 years 6 months ago - 6 years 6 months ago #6 by Stern
Replied by Stern on topic Help finding & editing map collision data
Good to see that people still working on this game :gj:

Ted Striker has worked on models, maybe knows something helpful...:undecided:

About that 4ds export, i guess the answer is in this export script (4ds_export.ms) or even in inport script, the way the model is imported is also important for exporting.
Its C++, so you are quite close with C#.

OriginalDan wrote: Damn sounds like we need the guy from djbozkosz.wz.cz to continue his tool from 2014 to get working for hd2


What kind of tool was it ?

The one who hesitates is lost !

Please Log in or Create an account to join the conversation.

  • Lukasz birthday is in 4 days (41)
Powered by Kunena Forum