4ds files hacked

This is for general discussion about Hidden & Dangerous 2, talk about what you liked or what you didn't like about the sequel. Talk about multiplayer games, setup matches etc.
hdmaster
Sergeant
Posts: 84
Joined: Thu Jan 27, 2011 9:31 pm
Location: Germany

4ds files hacked

Unread post by hdmaster » Thu Jan 27, 2011 10:32 pm

Hey guys,

I know this should be posted in the HD2 modding section but i want everyone to read this and it looks like nearly nobody looks into the modding section. So pls don?t move it ;)

As i already posted this month on the GS forum I wrote a MAXScript that?s able to import a bunch of 4ds files into 3ds Max. Textures are not supported yet.
There?s also a problem with sectors cause sub objects are not positioned correctly by the script yet. Also, it supports currently only standart 4ds and not the scene.4ds files but i?ve also included a few functions trying to import the maps (usually you would edit the scene.4ds files in a level editor an not 3ds max).

DOWNLOAD LINK AT THE BOTTOM - I?ve also commented the script and an (outdated) data tree is included

What are 4ds files?
They are the 3d model files of H&D2. Every map and every object, weapon, verhicle etc you see in H&D2 is based on these files

What can I do with these files?
You can only import them for now. But I hope we?re moving further so we can write a fully working exporter.

So can we create complete new maps soon?
Making a completed new map from scratch may be possible. But we would have to develop a level editor cause i think it?s not possible to export a whole map from 3ds max.
Fortunatly i have some programming experience and I?ve also started developing a (very simple) level editor but:
  • It?s my first 3d programming project (I?m using Python 2.6 and OpenGL atm)
  • I don?t have much time, so developing this as a one-man-project would take too long
How do I import the files?
You need the program 3ds Max (don?t know by which versions the script is supported).
To run the script:
  • open 3ds Max
  • click "MAXScript" in the menu bar
  • click "Run Script" and select the the script file
  • a file dialog appears, now select the .4ds file you want to import
Maye i?ll write a short tutorial about the 4ds files so you guys know how to deal with them and can reverse engineer on your own ;)


Here a few renderings from imported files:
Image
Image
Image
Image

And finally here?s the script:

http://rapidshare.com/files/444895563/4ds_script.zip

User avatar
Capt. Stirling
Lieutenant
Posts: 108
Joined: Tue Sep 26, 2006 5:56 pm

Re: 4ds files hacked

Unread post by Capt. Stirling » Thu Jan 27, 2011 11:46 pm

This is extraordinary news. Looks like we'll soon have a crack at better weapon models  grin01
Like sorting out the Thompson's proportions and getting the bazooka back to looking like an M1 version.

Thank you hdmaster for your effort and time on this. Looks excellent and hope to see more developments. I'll have to important them to my Cinema 4D program.
They Dared and Won..... And They Were Hidden and Dangerous.
1941-1945

User avatar
Jason
Administrator
Posts: 1895
Joined: Thu Sep 02, 2004 7:26 pm
Location: Perth, Australia
Contact:

Re: 4ds files hacked

Unread post by Jason » Fri Jan 28, 2011 4:55 am

This is amazing :mrgreen: I'll have to test with my old copy of 3ds Max (R3). Thank you very much hdmaster for you work. I've been wanting to expand my noob python skills, so I'm happy to help out (although I've been learning python 3).
A new day, a new beginning

Fixing H&D2 Multiplayer tutorial

Jim Webb
Private
Posts: 7
Joined: Wed Jan 05, 2011 9:49 pm

Re: 4ds files hacked

Unread post by Jim Webb » Sat Jan 29, 2011 9:10 pm

All Modders of Hidden and Dangerous 2 are held in high esteem as they keep the game alive and breathing.Keep it up! smile01

Lars
Commando
Posts: 876
Joined: Wed Sep 08, 2004 9:37 pm

Re: 4ds files hacked

Unread post by Lars » Sat Jan 29, 2011 10:40 pm

Nice work  thup01
Is it possible to load the complete maps? What about the uvw maps/textures. Are they imported, too? .. guess i have to install max again and than edit some maps for hdd  lol

hdmaster
Sergeant
Posts: 84
Joined: Thu Jan 27, 2011 9:31 pm
Location: Germany

Re: 4ds files hacked

Unread post by hdmaster » Sun Jan 30, 2011 8:12 pm

Thanks for your compliments :)

@Jason: I've also started with python 3 but moved back to 2.6 because the support of 3rd party tools like OpenGL etc. is rare for v3. But there are not that many differences between the versions.

@Lars: Textures are not supported yet. I know how the data of the textures is stored but i don't know what these float values are exactly for (there are 4 x 3 floats + 2 floats for every texture). I've updated the script so you can import a few maps: Ardennes1, Arctic4, Africa2, Africa6 are imported without errors,  Arctic 1 too, but the positioning of some objects is messed up a bit. Here's the new script: http://rapidshare.com/files/445352444/4ds_0.01b.zip
Last edited by hdmaster on Sun Jan 30, 2011 8:14 pm, edited 1 time in total.

User avatar
Jason
Administrator
Posts: 1895
Joined: Thu Sep 02, 2004 7:26 pm
Location: Perth, Australia
Contact:

Re: 4ds files hacked

Unread post by Jason » Sun Feb 06, 2011 6:30 pm

I haven't been able to get the script to work with my copy of 3D MAX R3 (Lars, you?) but it does work with GMAX, the freeware version of 3D MAX - so everyone can use it thup01 I've uploaded a copy of GMAX so everyone can use it - see below.

@hdmaster you can now attach files to posts, so feel free to "host" the script on the post. How's the project going and how have you been for time? Please share all the knowledge you can. I think our priority as a community has always been a H&D2 editor :mrgreen: How long do you think a script to export scenes that can be used in H&D2 could take?

The GMAX software application: gmax12.exe
GMAX help files: gmax12_help.exe
GMAX tutorials: gmax12_tutorials.exe
GMAX Textures: library.exe
A new day, a new beginning

Fixing H&D2 Multiplayer tutorial

hdmaster
Sergeant
Posts: 84
Joined: Thu Jan 27, 2011 9:31 pm
Location: Germany

Re: 4ds files hacked

Unread post by hdmaster » Mon Feb 07, 2011 7:25 pm

The project's going really well at the moment  ;). I?ve made a few changes to the script, here the most important ones:
  • import for all maps except Africa1 into 3ds max (gmax should be fine too)
  • texture support (no tiling, UV offset etc yet --> textures are not always placed correctly)
DL: http://rapidshare.com/files/446723909/4ds_1.0.zip

Unfortunately there are still some problems with the positioning of some objects.

Before you run the script you have to edit line 7 inside the script and change the path to your unpacked HD2 Maps folder. Make sure that SET_WIREFRAME (switches the scene automatically in wireframe mode) is set to True when you?re going to import a map cause some maps require ~1 GB extra RAM (depends on the number of textures).
Import may take a while. Be aware that your 3ds max could be extremly slowed down after import (high vertices count + a lot of textures)!

Image

@Jason: I don't know. There are only a few things to do. The next thing (and most important) on my to-do list are the additional values for textures and materials like UV offset, tiling and so on ( at least i think so). There are 14 of em and I have no clue what values that are . You can see them in the MAXScript listener window when you set SET_TEXTURE_PRINT  to true. So maybe you want to play around with the values and the mats in the material editor to get the right results.
How do i attach files to a post ? :grin: Don't see any button etc here .

Bighouse
Sergeant
Posts: 81
Joined: Mon Sep 20, 2004 10:28 am

Re: 4ds files hacked

Unread post by Bighouse » Wed Feb 16, 2011 8:35 pm

So has anyone tried/succeeded importing a map from H&D2 and then exported it as scene.i3d for Deluxe? I think some maps might run into the same "too much stuff" problem I ran in to when I did my own addon, mission 2.

User avatar
2k
Sergeant
Posts: 57
Joined: Wed Jul 04, 2007 6:32 pm

Re: 4ds files hacked

Unread post by 2k » Thu Feb 17, 2011 2:35 pm

Wow, wow. Hdmaster, great work!!! I will test it soon on last version of 3ds max(2011). One quastion, could we expect something to convert edited or new meshes back to the 4ds format?

Got this error.
Image
Last edited by 2k on Thu Feb 17, 2011 3:47 pm, edited 1 time in total.

User avatar
Jason
Administrator
Posts: 1895
Joined: Thu Sep 02, 2004 7:26 pm
Location: Perth, Australia
Contact:

Re: 4ds files hacked

Unread post by Jason » Thu Feb 17, 2011 5:13 pm

GMAX works perfectly fine but 3D Max R3 doesn't :sad: I'm getting the following error:

Image
A new day, a new beginning

Fixing H&D2 Multiplayer tutorial

Bighouse
Sergeant
Posts: 81
Joined: Mon Sep 20, 2004 10:28 am

Re: 4ds files hacked

Unread post by Bighouse » Thu Feb 17, 2011 7:03 pm

Well you can basically open it with gmax, then save it as 3ds. That can be then imported in to 3d max R3 and exported in to i3d.

You'll lose then texture information on the way though, so you might need to apply the textures again in R3.

User avatar
Giskard
Private
Posts: 6
Joined: Mon Jun 07, 2010 12:28 pm
Location: Hungary

Re: 4ds files hacked

Unread post by Giskard » Sat Mar 12, 2011 7:56 pm

Hi!

First of all, you are a god to create this importer.

I successfull yimported the Ardennes map into the 3dsmax and exported it to a 3ds file. The importer knows only the 8.3 filenames, so I had to copy/rename some existing texturename and imported it to Zmodeler 1.07. It displayed with textures, but after I exported as a 4ds file, the hd2 didn't showed the surfaces after I started the map. (I dont know what is the problem - maybe the Zmodeller is not good for hd2 -, but after I deleted the scene.4ds file from the folder, the map started, but with the same result.)

I saw some new model file (in 4ds format) in some user map (new vehicles) I don't know which program was used to save them in 4ds. Do you have any idea?

I would like to help you, but I haven't any coding knowledge. But want to make new maps for HD2. This is the best tactical and ww2 game ever. I wrote a petition for the developers in last autumn, but - of course - nothing happened.


Do you work on his project yet? I didn't find new posts in the forum.

Greetings

hdmaster
Sergeant
Posts: 84
Joined: Thu Jan 27, 2011 9:31 pm
Location: Germany

Re: 4ds files hacked

Unread post by hdmaster » Fri Mar 18, 2011 7:49 pm

Hey guys,

i was very busy the last weeks so i only did a few updates on the importer and wrote a simple exporter.
Importer updates include:
  • is now a gui based plugin (not tested with gmax)
  • importer can import scene2.bin, actors.bin and sound.bin files
With the possibility to load the *.bin files it is possible to use 3ds max (and maybe gmax) as a complete HD2 Editor. The screenshot below contains the imported Czech1 OBJ map with the loaded scene2.bin and actors.bin content, that are the green dummy boxes. The boxes show the position/rotation/scaling of the lights/models/sounds etc stored in the bin files

Image

@Giskard:
The reason why it doesnt work is that the 4ds file format of Mafia (for that the ZModeler plugin was designed) is different from the one used in HD2. So the HD2 loader crashes because it trys to read an incompatible/different file format.
The person created "new" models by editing the .4ds files in hex mode. But to do that you should be familiar with hex editing and the structure of 4ds files.

@Jason:
Minimum version is 3ds max r4 because it was shipped with complete new MAXScript functions that are fortunately available in gmax, too

@2k:
I wrote a exporter plugin but its still in beta and can only export meshes. Before i continue on the exporter i want to fix all the problems of the importer

Lars
Commando
Posts: 876
Joined: Wed Sep 08, 2004 9:37 pm

Re: 4ds files hacked

Unread post by Lars » Fri Mar 18, 2011 9:38 pm

Looks very promising  thup01
In case you wanted to know .. hd2 maps where made with 3dsmax4 ... from the screenshots i saw so far.
Just one question .. the screenshot is from witch program? Its looking a bit like the old gmax?

Post Reply

Who is online

Users browsing this forum: No registered users and 27 guests