Quantcast

Jump to content

» «
Photo

GTA:VCS/LCS Modding.

457 replies to this topic
AK-73
  • AK-73

    Hustler

  • Members
  • Joined: 31 Oct 2005

#301

Posted 16 January 2008 - 06:09 PM

QUOTE (aru @ Jan 16 2008, 17:57)

The table you speak of is the same as in the tex files...
It's a relocation table and points to all the offsets in the mdl file, which may not necessarily be every object.


The important one for models is the offset of the clump/atomic segment. In PS2 this is at +0x20 into the file with most .mdls and +0x24 with actor .mdls. On PS2 you recognize atomics because they mostly look like this 01 00 05 01 (sometimes 01 00 00 01), whereas clumps start with 02 00 00 00.

Alex

creative madman
  • creative madman

    Street Cat

  • Members
  • Joined: 29 Oct 2005

#302

Posted 16 January 2008 - 06:13 PM

are the PS2/PSP model formats not identical?

or have i, a false misconception?

J-Fox
  • J-Fox

    . . .

  • Members
  • Joined: 04 Aug 2007

#303

Posted 16 January 2008 - 06:33 PM Edited by J-Fox, 16 January 2008 - 06:36 PM.

They seem to be different, the data inside seems to be stored the same way (Same datatypes), but its sorted different in both versions.
I m trying to crack the PSP formats (1 model rendering so far - wooo,texture loader from my old project, haven't looked at col yet - but I will do soon) and AK-73 is working on PS2 models right now.

//Edit: aru: I did not believe that each points to an object anyway - I only noticed, that some blocks have Vertex data, others point to the texture table etc. and they look similar in each model, makes me wonder how the game knows what section/structure it is looking at..

creative madman
  • creative madman

    Street Cat

  • Members
  • Joined: 29 Oct 2005

#304

Posted 16 January 2008 - 06:35 PM

sometimes, i think yous kids are too smart for your own good

what the f*ck is a datatype?

haha, how bout i just stop asking dumb questions, and wait till you genius' have made me a nice fancy importer/exporter that i can use to rape and pillage

i love you guys and your work...

top fellas, top fellas

AK-73
  • AK-73

    Hustler

  • Members
  • Joined: 31 Oct 2005

#305

Posted 16 January 2008 - 06:51 PM

QUOTE (J-Fox @ Jan 16 2008, 18:33)
They seem to be different, the data inside seems to be stored the same way (Same datatypes), but its sorted different in both versions.
I m trying to crack the PSP formats (1 model rendering so far - wooo,texture loader from my old project, haven't looked at col yet - but I will do soon) and AK-73 is working on PS2 models right now.

//Edit: aru: I did not believe that each points to an object anyway - I only noticed, that some blocks have Vertex data, others point to the texture table etc. and they look similar in each model, makes me wonder how the game knows what section/structure it is looking at..


I can tell you how my importer proceeds:

I locate the clump and/or first atomic. This holds the offset to the frame data, as well as the associated geometry.

Then I jump into the geometry section. I read out the materials, the scaling info, the vertex data, vertex colors, normals, all kinds of things. Then I start constructing objects, then I proceed to cleaning up the mesh (see pm) and attach sub-objects to each other. Afterwards I read out associated frame data and set the objects transform accordingly. Then it's on to the next atomic, if any.

Initially my importer went sequentially through the file. I did re-code that though as I started to understand the structure of the file better.

@cm: numbers can stored in different formats. If you got numbers like 1, -4, 19, they get stored in some *integer* format. Numbers with fractions like 2.5, pi, or -86.19812 get stored completely differently internally, namely as *floats*. Thus they have to be treated differently. This gets further complicated because there are commonly 3 different integer formats (with different sizes) and these can be either signed or unsigned formats also. So, to make it short: it takes some amount of figuring out what the internal numbers you are looking at are *supposed to mean* to the game engine.

Alex

The Hero
  • The Hero

    Into TheGame!!!

  • Feroci
  • Joined: 25 Jan 2005
  • Germany
  • Most Helpful Modding 2016 [Honorable mention]
    Best Script or Plugin 2016 [SkyGfx]
    Contribution Award [Mods]

#306

Posted 16 January 2008 - 09:21 PM

Uhm, I have a question:
Am I right that these files use a triangle strip mesh? Because if that's true, how can you tell where a strip ends? If you connect every 3 vertices you would end up with too many faces, wouldn't you? In San Andreas Files (PS2) there is a flag after the Vertex that indicates the end of a vertex strip. How is it done in LCS? That may help me with my Vice City dff research confused.gif

J-Fox
  • J-Fox

    . . .

  • Members
  • Joined: 04 Aug 2007

#307

Posted 16 January 2008 - 10:08 PM Edited by J-Fox, 16 January 2008 - 10:32 PM.

All GTA3 engine (I don't count LCS and VCS to that...) based games for PS2, Xbox and PC use RenderWare afaik and all file formats have been described in detail.
In LCS it looks like it moves to the next clump of vertices by just making a "line" by putting 2 of the 3 vertices for one triangle at the same position, you don't have to render those either.

KNN.
  • KNN.

    ▓▒░_watch yerself_░▒▓

  • Feroci
  • Joined: 09 Jul 2006
  • European-Union
  • Best Map 2013 "ViceCityStories PC Edition"

#308

Posted 16 January 2008 - 10:23 PM

Hello, someone made other IMG extractor few months ago, this tool can extract all IMG + LVZ files.
Extracted files are WORLD files and chk. Is possible to import this world files by your script AK-73?

The Hero
  • The Hero

    Into TheGame!!!

  • Feroci
  • Joined: 25 Jan 2005
  • Germany
  • Most Helpful Modding 2016 [Honorable mention]
    Best Script or Plugin 2016 [SkyGfx]
    Contribution Award [Mods]

#309

Posted 17 January 2008 - 07:36 AM

@J-Fox: Every file format is described in detail? Where are the descriptions of the vc and sa ps2 dff formats?
That would make my research superfluous.
I have also observed that there are "lines" in the mesh in the vc format but in briefcase.dff for example the whole mesh is messed up though you can see that it shall be a briefcase.

catzilla
  • catzilla

    Professional pilot

  • Members
  • Joined: 14 Jan 2006

#310

Posted 17 January 2008 - 07:55 PM

While people are working on .mdl format, can someone PLEASE try to crack the archived .img? The buildings and stuff like that are in those archives!

J-Fox
  • J-Fox

    . . .

  • Members
  • Joined: 04 Aug 2007

#311

Posted 17 January 2008 - 09:54 PM Edited by J-Fox, 18 January 2008 - 03:04 PM.

catzilla:

What I think (PSP version of LCS):

dtz - Core files (Used for naming the entries in all other files, a change in the img means a change in the game.dtz)
lvz* - Filetable for compressed img files
dir* - Filetable for uncompressed img files
img* - Package files
chk* - Package files
tex* - Texture archives
wrld - World files (Placement and models, some parts look similar to the mdl files)
mdl - Model files (New format, replacing dff - used for scripted and dynamic objects, vehicles and actors)
col2 - Collision files (Changed col2 format from PS2 San Andreas)

*Cracked in most parts

I could be wrong, but atleast thats what I came accross so far. I noticed that it is probably easier to documentate the col2 files for now, then go over to the wrld files, and then to the mdl files again. Once thats done I should have a closer look at the game.dtz


THE HERO:

Somehow I remember that there were some VC models for games like Re-Volt when it wasn't out for PC.
I looked for a few minutes a few hours ago, but couldn't find any good information. It might be usefull to read through the GTAModding pages and the RenderWare documentation though.


---


This is some progress on my LCS mdl loader by the way

user posted image

The box is from -143 to +143 on the x axis, and from -211 to +211 on the y axis. Its supposed to be an object which uses the texture inddoor1 so i was expecting to see a door in a MUCH smaller format. Actually every model I loaded so far turns out as a box. Some objects have multiple boxes though, I thought it would be the vertex data - but it looks like I was wrong. Makes me wonder why the UV,XYZ is correct - its a trianglestrip straight from the files (Only rescaled by doing: X /= 128 (As suggested in the renderware docs, the pspsdk and on gtamodding about col files) I still have around 100 bytes without comments and it looks like those are responsible for the real data in that model - maybe I can finish it tomorrow (I still hope I can find the correct model data inside that area).
Another problem is, that I finished documentating some sections (Each byte makes sense to me) - but I have no clue how to sort them or how to detect which section does what. Most sections start with data without any prefix or anything. The order of those sections is also different in each file - REALLY WEIRD...

//Edit: The box I found is the collision model or the clipping object! I m 99.99% sure, I just wrote some handy tool which is able to copy one file into another (replacing sections only) which also works over usb - I changed the model data over and over again and wrote it to the iso again (only takes a few seconds now): I was able to turn the door into a ramp and make it unsolid (only collision! - the model was the same as before). My second guess would be, that those triangles are used for clipping and orientating the collision, because the renderer is a bitchy about where i look now smile.gif
The model I use for testing is: ldm-282 in the gta3.img, 0x023A in the memory (for CheatDevice construction mode), a green door - only half texture visible

Daan17
  • Daan17

    84's Vice City

  • Members
  • Joined: 22 May 2005
  • None

#312

Posted 17 January 2008 - 10:37 PM

AK-73 & J-Fox: Nice progress. Keep up icon14.gif

AK-73
  • AK-73

    Hustler

  • Members
  • Joined: 31 Oct 2005

#313

Posted 18 January 2008 - 03:50 PM

QUOTE (THE HERO @ Jan 16 2008, 21:21)
Uhm, I have a question:
Am I right that these files use a triangle strip mesh? Because if that's true, how can you tell where a strip ends? If you connect every 3 vertices you would end up with too many faces, wouldn't you? In San Andreas Files (PS2) there is a flag after the Vertex that indicates the end of a vertex strip. How is it done in LCS? That may help me with my Vice City dff research confused.gif


My this thread is starting to become the German thread. wink.gif

Just read my posts in this thread: before the vertex postions, the 3rd byte in the DWORD states the number of vertices in the tri-strip. Faces are (vertex number)-2 and are generated automatically. Just erase all faces where 2 vertices have the same position (= lines) after the mesh has been completely built and textures set, etc. But remember to erase them top-down index-wise.

Btw, it's the same with vertex colors, normals, uv coordinates: first there is a dword signifying the start of a new data section, specifying what section and how many elements are to follow. Since gtagarage is not fully functional, I guess, can someone upload the beta .MDL importer somewhere for me?

Anyway the importer still has a few issues. First of all: no skinning of actor models yet (geometry can be imported), no hierarchy bulding either for that matter. Secondly, face orientation can still be an issue. It seems as if on some strips, face orientation on even faces has to be flipped. Have yet to figure out on which. Also material assignment works not like I assumed it would. I'll have to look into that also. It's still beta after all. smile.gif

As textures, my .MDL importer for gmax assumes that corresponding are in the same directory as the .mdl file and are either of .bmp or .tga format, similarly to Kam's scripts.

Alex


The Hero
  • The Hero

    Into TheGame!!!

  • Feroci
  • Joined: 25 Jan 2005
  • Germany
  • Most Helpful Modding 2016 [Honorable mention]
    Best Script or Plugin 2016 [SkyGfx]
    Contribution Award [Mods]

#314

Posted 18 January 2008 - 04:30 PM

@AK-73:
Yeah, you told me that in the other thread. I have a pretty working VC importer (actually converter) now.
But some faces are messed up though confused.gif and I think that's a Vice City only issue.

AK-73
  • AK-73

    Hustler

  • Members
  • Joined: 31 Oct 2005

#315

Posted 18 January 2008 - 05:34 PM Edited by AK-73, 18 January 2008 - 05:45 PM.

http://rapidshare.de...mporter.ms.html

Alex

PS Btw, J-Fox... how are you going to deal with such things as actors in mdl having multiple textures whereas in dff an actor has only one material/texture? That will require editing by hand, no?

J-Fox
  • J-Fox

    . . .

  • Members
  • Joined: 04 Aug 2007

#316

Posted 18 January 2008 - 08:20 PM Edited by J-Fox, 18 January 2008 - 10:01 PM.

Tada! My findings were correct allready - I just didn't notice that there are 2 Scale factors: One for each atomic, one for each frame. The texture is also scaled.
I did find this by hex-editing the files and putting it ingame. I got some cool results smile.gif
I will try to crack the rest now and I have to find some way to detect each section type (I parsed the following by hand)

Modded model ingame:

user posted image


Model loading fine inlove.gif :

user posted image

//Edit1: Just found the 0x01050001 section in a PSP file, its 0x01000501 in the PSP version (Read bytes backwards)
//Edit2: Ok enough work done for today smile.gif I'll create some small LCS / VCS SCM compiler tomorrow so I can use a stripped script. Watching the intro everytime drives me insane smile.gif

gamerzworld
  • gamerzworld

    Why did I move here? I guess it was to sell Shark Cards.

  • Members
  • Joined: 29 Nov 2005
  • United-States

#317

Posted 18 January 2008 - 09:24 PM Edited by gamerzworld, 19 January 2008 - 08:30 PM.

QUOTE (AK-73 @ Jan 18 2008, 12:34)
http://rapidshare.de...mporter.ms.html

Alex

PS Btw, J-Fox... how are you going to deal with such things as actors in mdl having multiple textures whereas in dff an actor has only one material/texture? That will require editing by hand, no?

You are a legend. Awesome work!

KNN.
  • KNN.

    ▓▒░_watch yerself_░▒▓

  • Feroci
  • Joined: 09 Jul 2006
  • European-Union
  • Best Map 2013 "ViceCityStories PC Edition"

#318

Posted 18 January 2008 - 10:22 PM

Emm, i had all, what is need to open mdl file, but which mdl files working for your scripts AK - 73?

catzilla
  • catzilla

    Professional pilot

  • Members
  • Joined: 14 Jan 2006

#319

Posted 19 January 2008 - 01:41 AM Edited by catzilla, 19 January 2008 - 01:51 AM.

nvmm plz erase

TripleAs
  • TripleAs

    Mack Pimp

  • Members
  • Joined: 31 Dec 2003

#320

Posted 19 January 2008 - 06:05 AM

Alex, would you marry me? inlove.gif

IT f*ckING WORKS!!!!!!!

yay!... after some... tedious normal sorting/backflipping, I've got this lovely pimp model ingame:

user posted image

FINALLY, Catzilla, I want you on msn tomorrow, we've gotta discuss about the finishing of the LCS mod ... project. yeah, i know i'm talking nosense... it's 4 am, and it was a pain in the rear fixing the normals, but i don't mind becaUSE i'm HAPPY REALLY f*ckING HAPPY (like smileys)

now, seriously, we're going to finish that mod... asdiwtrnjqirfeakfnjksdnvcjnx v THANK YOU ALEX blush.gif

catzilla
  • catzilla

    Professional pilot

  • Members
  • Joined: 14 Jan 2006

#321

Posted 19 January 2008 - 09:13 AM

The only thing we need now is to extract the models/textures from compressed IMGs.

simkas
  • simkas

    That guy

  • Members
  • Joined: 13 Dec 2006

#322

Posted 19 January 2008 - 06:57 PM

Holy f*ck, this is awesome.
You f*cking win, Alex.
Now if only it wouldn't import the models with half faces flipped.

GTAdedan
  • GTAdedan

    Gangsta

  • Members
  • Joined: 09 Oct 2006

#323

Posted 20 January 2008 - 11:07 AM

can someone pm me the LCS files, please? I really want to check this out, grat work Alex! you are a legend

creative madman
  • creative madman

    Street Cat

  • Members
  • Joined: 29 Oct 2005

#324

Posted 20 January 2008 - 02:28 PM

pretty sure thats warez, and not allowed here

AK-73
  • AK-73

    Hustler

  • Members
  • Joined: 31 Oct 2005

#325

Posted 21 January 2008 - 05:36 PM Edited by AK-73, 21 January 2008 - 06:06 PM.

Okay, first things first: there's a new version of the importer out (v0.1.1) that now assigns material IDs properly. Triple-As should be updating the download sometime soon with it. I've also included a readme. please read the notes in it.

As for the face orientation issue: I have no idea at this point how to fix it. Cars seem to be importing fairly fine when checking the flip even faces checkbox. However this causes *parts* of mdl 321 (streetlamp) to have the wrong orientation in their *entirety*. In theory, the attached tri-strips should be sub-objects of the final object, no? The best idea I have is to be able to select the falsely oriented tri-strips and flip them as sub-objects.

I wish Kam was here, he probably could help.

The scripts presently work on the following: PS2 LCS world geometry, objects (weapons, money, briefcase), vehicle geometry, actor geometry. That is, it imports only the geometry. PS2 VCS is currently not supported but from what I gather it is not too different from LCS. PSP is not supported by my script and will not be. I don't own a PSP and I likely never will. That said, the importer is open source and if somebody wants to extend its functionality by PSP import, they're welcome. However, in that case, I would strongly recommed *coordinating efforts*.

As for LCS files, yes, I think it would not be a good idea to put those files up. Just buy LCS PS2 and extract the files on your PC. That way both you and Rockstar will be happy. wink.gif

Alex

EDIT: BTW, next up is full support of actors, that is importing bones properly and handling vertex weights, etc.

GTAdedan
  • GTAdedan

    Gangsta

  • Members
  • Joined: 09 Oct 2006

#326

Posted 21 January 2008 - 06:12 PM

QUOTE (AK-73 @ Jan 21 2008, 18:36)
As for LCS files, yes, I think it would not be a good idea to put those files up. Just buy LCS PS2 and extract the files on your PC. That way both you and Rockstar will be happy. wink.gif

Alex


Yeah, sorry for asking, I've already seen some models and I noticed that they are very similar to VC's models. Again, great job Alex

J-Fox
  • J-Fox

    . . .

  • Members
  • Joined: 04 Aug 2007

#327

Posted 21 January 2008 - 08:10 PM

Damnit. Stupid stormy weather in germany right now, the power went down for only half a second or something and my HDD crashed. I was able to recover around 75% now, most missing files are either those used by steam or those which were in use by my compiler. That included a 1mb sourcecode for opening / parsing all LCS filetypes I looked at so far (mdl, wlrd, scm, dat, lvz, dtz, img, dir, gxt, ...) - well looks like I gotta use my old VB6 code (Last updated 3 days ago) to recreate all this sh*t cryani.gif

[CTD]LaBan
  • [CTD]LaBan

    Homie

  • Members
  • Joined: 11 May 2006

#328

Posted 21 January 2008 - 08:14 PM

QUOTE (J-Fox @ Jan 21 2008, 22:10)
Damnit. Stupid stormy weather in germany right now, the power went down for only half a second or something and my HDD crashed. I was able to recover around 75% now, most missing files are either those used by steam or those which were in use by my compiler. That included a 1mb sourcecode for opening / parsing all LCS filetypes I looked at so far (mdl, wlrd, scm, dat, lvz, dtz, img, dir, gxt, ...) - well looks like I gotta use my old VB6 code (Last updated 3 days ago) to recreate all this sh*t  cryani.gif

no! it can't be... sorry to hear that. dontgetit.gif

good luck with it anyways.

AK-73
  • AK-73

    Hustler

  • Members
  • Joined: 31 Oct 2005

#329

Posted 23 January 2008 - 05:14 PM

I've got yet another update. (I'll start a thread in the Tools Forum sometime soon).

Features of v0.2:
  • Support for non-cutscene actor models
  • Some support for dummys/hierarchy
  • Rescaling to proper size
  • Support for Kam's IFP scripts
Yes, this means that you can import non-cs actors fully skinned. Works like a charm.

Please note the rescaling feature also. Prior to this version, models didn't have the *exactly* proper scale.
Any model created prior to v02 is going to be a bit too small. So you'll either have to start all over again or
rescale by hand, reset xform and collapse. (Don't complain - you knew it was beta... and still is).

What is the difference in size? v0.2+ models are at 101 . 72734378213830268624789172734% (lol) size of pre-v0.2
models. Thus they are slightly bigger. But using this new scale gives me an *exact* match with comparable Vice City models.
Just compare briefcases or money models.

Support for KAM's IFP script means that with this version you can also apply VC (SA probabyl too) animations to imported models.

Also, with vehicles, dummys are correctly imported and put into hierarchy. You'll just have to enter the geometry nodes into the hierarchy though - they don't get assigned parents automatically yet.

TripleAs will upload it sometime soon, I'm sure.

Alex

PS Somebody said recently that the new format isn't renderware format. This is technically not quite correct (just on a by-note). The new .mdl format simply reflects more the internal in-game storage of date than the old .dff. Thus it is probably faster to load/use. For example the 0x01050001 at the start of atomics is something that I knew from VC because that's the first in-memory dword of about any atomic there too.

creative madman
  • creative madman

    Street Cat

  • Members
  • Joined: 29 Oct 2005

#330

Posted 24 January 2008 - 03:15 AM

QUOTE (AK-73 @ Jan 24 2008, 03:14)
I've got yet another update. (I'll start a thread in the Tools Forum sometime soon).

Features of v0.2:
  • Support for non-cutscene actor models
  • Some support for dummys/hierarchy
  • Rescaling to proper size
  • Support for Kam's IFP scripts
Yes, this means that you can import non-cs actors fully skinned. Works like a charm.

Please note the rescaling feature also. Prior to this version, models didn't have the *exactly* proper scale.
Any model created prior to v02 is going to be a bit too small. So you'll either have to start all over again or
rescale by hand, reset xform and collapse. (Don't complain - you knew it was beta... and still is).

What is the difference in size? v0.2+ models are at 101 . 72734378213830268624789172734% (lol) size of pre-v0.2
models. Thus they are slightly bigger. But using this new scale gives me an *exact* match with comparable Vice City models.
Just compare briefcases or money models.

Support for KAM's IFP script means that with this version you can also apply VC (SA probabyl too) animations to imported models.

Also, with vehicles, dummys are correctly imported and put into hierarchy. You'll just have to enter the geometry nodes into the hierarchy though - they don't get assigned parents automatically yet.

TripleAs will upload it sometime soon, I'm sure.

Alex

PS Somebody said recently that the new format isn't renderware format. This is technically not quite correct (just on a by-note). The new .mdl format simply reflects more the internal in-game storage of date than the old .dff. Thus it is probably faster to load/use. For example the 0x01050001 at the start of atomics is something that I knew from VC because that's the first in-memory dword of about any atomic there too.

do you want to be any more of a genius?

or are you content with how freakin' awesome you are right now?




2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users