Modding discussion for Driver 2: The Wheelman is Back.
By Krishty
#55125
I've caught a pretty bad cold, so please have patience with Driver 1 data.

Great find, SOAP! I already had that structure in my code but I must have forgotten completely about it. Going to implement it like that; thx!
User avatar
By Clutch
#55127
You know, guys... a lot of buildings look like copied from GTA2... Cubish w/ 45 degree roofs...
Maybe your research would be the start of great future, where we could convert some maps from GTA to Driver 1/2 :) I think it could be kinda fun.
Just imagine these great drifts and chases...

http://img288.imageshack.us/img288/7786/gtac2jf6.jpg
http://gtamp.com/forum/download/file.ph ... &mode=view
http://gtamp.com/forum/download/file.php?id=1007&t=1


I'm really sorry for putting this trash in the topic, I can't prevent myself, because you freakin' awaken my deepest dreams of Driver mapping. :)
By Krishty
#55156
Parse LUMP_MAP with this structure
(I found it here, http://drivermadness.net/forum/viewtopi ... 905#p51905, function PSX_World::load)
Code: Select allstruct mapinfo_t // undone { int width; int height; int tileSize; int numSectors; int visTableWidth; // value is mostly 32 // 2 ints unknown // 4 byte ambient light (Driver1) // 4 ints sun direction/angle }; ...
unknown[0] is the total number of instances in the LEV, instances of this lump and all tiles summed together.

What format are the instances in the LUMP_MAP in?
User avatar
By SOAP
#55162
unknown[0] is the total number of instances in the LEV, instances of this lump and all tiles summed together.

What format are the instances in the LUMP_MAP in?
this instances in LUMP_MAP called "bridged objects"

They are typical packed cell objects ( or modeldefs, x y z [rotation model] ), same as at offsets like 2048 * (sector.offs + sector.tableOfs + sector.nodesOfs)

Also: Any thoughts about modelDefsSize in Sector Data Info? (by spec)
Object count is valid only on havana, there somewhere could be object count.
I think it may point at cell pointers or something, and add "magic" 1024 offset to model index... because I have tried most possible computations and got nothing good :(

In general it's necessary to disassemble these sectors thoroughly.
User avatar
By SOAP
#55168
But the coordinates can't be right: global coordinates are 4–8 bits more than sector-local coordinates, aren't they?

Here's the new viewer for Driver 1 & 2: http://dropmefiles.com/jTRFn
this objects used by sectors, for the time i didn't realize how or where at now

Also recognized for each sector:
visibility data at spooldata + 2048 * sector->offset
heightfield data at spooldata + 2048 * (sector->offset + sector->contentsNodesSize + sector->contentsTableSize + sector->modelsSize)

Visibility data begins with int32 - byte count, next comes bytes.
heightfield data also begins with int32, but size is unknown (may be structures used?)

EDIT: I HAVE FINALLY FOUND THE +1024 index bit, it's packed in Y component of OBJECT! I've checked it by the game! It's bit 1
Image

in blender
Image

Now, I should go sleep :)
User avatar
By Skylabh
#55170
Excellent work! This just keeps getting better and better!
Yep. It should be interesting to get the cities in the obj format. (Y)
By Krishty
#55172
EDIT: I HAVE FINALLY FOUND THE +1024 index bit, it's packed in Y component of OBJECT! I've checked it by the game! It's bit 1

Now, I should go sleep :)
AWESOME! I should have had this idea, too: I noticed all trees in Chicago have their Y coordinate multipied by 2. That should have made me think about why …
Image
It's simple and beautiful. Thanks again!
Excellent work! This just keeps getting better and better!
Yep. It should be interesting to get the cities in the obj format. (Y)
You can convert the data from my viewer yourself:
  • textures.r8g8b8c8: an array of 256×256 32-bit RGBA atlases
  • triangles.solid & triangles.alphatested:
    Code: Select allstruct { float x, y, z; uint8_t r, g, b; uint8_t atlas; // index into "textures.r8g8b8c8" uint8_t u, v; uint16_t padding; };
    Three consecutive vertices make a triangle.
  • triangles.gouraud (for Driver 1):
    Code: Select allstruct { float x, y, z; uint8_t r, g, b; uint8_t padding; };
    Again, three consecutive vertices make a triangle.
  • triangles.shadows (for Driver 1):
    Code: Select allstruct { float x, y, z; // shadows are always black; they get their shape by texture uint8_t atlas; // index into "textures.r8g8b8c8" uint8_t u, v; uint8_t padding; };
  • triangles.sprites: These are a little more complicated (for GPU rotation) …
    Code: Select allstruct { float x, y; // offset relative to sprite's center float centerX, centerY, centerZ; // rotates about this point uint8_t atlas; // index into "textures.r8g8b8c8" uint8_t padding; uint8_t u, v; };
By Krishty
#55177
It's pseudocode and should be self-explaining for any programming language ;)

uint8_t is an 8-bit unsigned integer and float is an IEEE754 single-precision floating point number.
User avatar
By Fireboyd78
#55183
Holy crap! Great work guys!

SOAP, your .obj files aren't exported properly. The 'o' prefix is not used to identify objects, but rather 'g'. Unfortunately this causes problems for importing in 3ds Max.
User avatar
By SOAP
#55185
Holy crap! Great work guys!

SOAP, your .obj files aren't exported properly. The 'o' prefix is not used to identify objects, but rather 'g'. Unfortunately this causes problems for importing in 3ds Max.
Sorry, I didn't use 3ds Max or Maya. I did made it quickly to load in Blender. But you can hex edit executable, search for string "o lev_model_%d" (found at offset 128424), and replace with g
I'll fix it later
Also all similar models may be grouped into one because many names are identical
User avatar
By SOAP
#55187
This is awesome! But the model files aren't generating. What am I supposed to do with the .bat file?
Extract driver_level_tool into directory (ex: D:\driver_level_tool)
copy .LEV files to D:\driver_level_tool\levels

run bat file

if you want to extract all cities (use separate bat files due to LEVELMODEL.obj overwrites)
driver_level +format 2 +textures 1 +world 1 +models 1 +carmodels 0 +lev levels/chicago.lev
driver_level +format 2 +textures 1 +world 1 +models 1 +carmodels 0 +lev levels/havana.lev
driver_level +format 2 +textures 1 +world 1 +models 1 +carmodels 0 +lev levels/vegas.lev
driver_level +format 2 +textures 1 +world 1 +models 1 +carmodels 0 +lev levels/rio.lev

+world [1/0] - turn on/off world extraction
+models [1/0] - turn on/off model extraction (only extracts global non-swap models)
+carmodels [0/1] - turn on/off vehicle model extraction (extracts clean and lod models)
+format [1/2] - LEV file format, set to 1 to extract Driver 1 levels (textures are UNTESTED, world doesn't export model correct)

for ex:
driver_level +format 1 +textures 1 +models 1 +carmodels 0 +lev levels/miami.lev
will extract models from Miami

EDIT:
WARNING: due to bug use value 0 to export cars, +carmodels 0
Last edited by SOAP on Wed Jul 23, 2014 2:58 pm, edited 7 times in total.
User avatar
By Fireboyd78
#55188
Are 'carmodels' Driver 1 only? I'm not getting anything from Driver 2.

EDIT: By the way, whenever you get around to fixing the obj exporter, please add this to the top of the files:

"mtllib <name of mtl file>"

ex. "mtllib MODEL.mtl"
User avatar
By VAIMAHDO
#55189
Thanks SOAP. The instructions were very clear. I can't believe an entire city is just 10.4MB! I mean dam, the city in GTA 4 is about 9GB with textures.
User avatar
By Fireboyd78
#55190
Thanks SOAP. The instructions were very clear. I can't believe an entire city is just 10.4MB! I mean dam, the city in GTA 4 is about 9GB with textures.
It's because they use a tile system for placing the roads and stuff. If you were to compile the city into one object, it would be way more than that. Hence the 90 - 120MB file size for the .obj file of exported cities :P
User avatar
By VAIMAHDO
#55191
Thanks SOAP. The instructions were very clear. I can't believe an entire city is just 10.4MB! I mean dam, the city in GTA 4 is about 9GB with textures.
It's because they use a tile system for placing the roads and stuff. If you were to compile the city into one object, it would be way more than that. Hence the 90 - 120MB file size for the .obj file of exported cities :P
Ohhh. And where are you getting the full cities put together with textures? I'm only finding parts to build a city.
User avatar
By Skylabh
#55192
Are 'carmodels' Driver 1 only? I'm not getting anything from Driver 2.

EDIT: By the way, whenever you get around to fixing the obj exporter, please add this to the top of the files:

"mtllib <name of mtl file>"

ex. "mtllib MODEL.mtl"
Thanks for the tip.
By Krishty
#55195
Just saw your new source code, SOAP, and wanted to give a quick update on model flags:
'ModelFlags1::tree' is actually 'sprite' (true for trees but also for all other sprites like parking meters and such); 'ModelFlags2::greenTree' is actually 'tree' (true only for trees).
User avatar
By SOAP
#55196
Just saw your new source code, SOAP, and wanted to give a quick update on model flags:
'ModelFlags1::tree' is actually 'sprite' (true for trees but also for all other sprites like parking meters and such); 'ModelFlags2::greenTree' is actually 'tree' (true only for trees).
Cool! I think these flags groups divided on EffectFlags and collision flags
Need to try searching through the game itself through overwriting files, and determine their usage

And soon I want to write a level viewer, that loads LEV files natively
User avatar
By Skylabh
#55200
Are 'carmodels' Driver 1 only? I'm not getting anything from Driver 2.
In the bat file, put +carmodels to 1.
Like this :
driver_level +format 2 +textures 1 +world 0 +models 0 +carmodels 1 +lev levels/chicago.lev
Last edited by Skylabh on Mon Apr 06, 2015 11:28 am, edited 1 time in total.
  • 1
  • 6
  • 7
  • 8
  • 9
  • 10
  • 14

Glad to hear that you're still interested in my wo[…]

https://www.youtube.com/watch?v=RTnbM8_7FjE Pa[…]

you're welcome, my congratulations on the mod is a[…]

Yeah I mean, it could go into any direction. Refl[…]