Page 1 of 1

Max Payne .ldb Level Models

Posted: Mon Sep 13, 2021 3:30 am
by screenracer
Hey all, been trying to rip levels from the original Max Payne. The atmosphere of this game is something special, and I thought it would be really cool to port some of these maps to other games or do renders of them in modern graphics engines. Unfortunately, the .ldb format is I think the only thing that hasn't been cracked from the original Max Payne, and I couldn't find much of anything about the format online. These files contain pretty much all the level data from what I can tell, including the meshes and textures.

The textures can be ripped using this program https://www.moddb.com/games/max-payne/downloads/ldbrip
However, there is currently no way to rip the actual level mesh from these files. I'm pretty certain they're split up into several submeshes, so far I haven't had much luck. Only able to get some point clouds (probably with junk data)

Car verts from Tutorial.ldb
Image

Verts from end_combat.ldb
Image
Could be wrong, but it kinda resembles this part of the map. If you look on the right side of the above image, that block of verts kinda resembles the desks where the computers are set on.
Image

Any point clouds i'm able to grab are always near the top of the file, but if you look at the bottom of the file, you can see various strings, probably related to the levels scripting but some of these I think are mesh/texture names.
Image

I've also tried the game's modding SDK, which does include a level editor. However, it doesn't include anything for these .ldb files. Ninja ripper also didn't take kindly to this game.

Here's some sample files if you'd like to take a look.
https://mega.nz/file/Y74QSDjL#YT_Zy8eto ... aVmATG9WCo

Hope someone with more experience than me can shed some light on this, any help would be appreciated.

Re: Max Payne .ldb Level Models

Posted: Mon Sep 13, 2021 12:22 pm
by shakotay2
Funny format, some small point clouds, yeah. In Tutorial.ldb 30..80 vertices per submesh, but FVFsize is varying from 35 to 36, then 37 bytes. Crazy.
I assume this is worthless as long you don't know where or how to get the face indices.
Maybe a "point cloud skinner" is an option?
.
MP_Tutorial-ldb.png

Re: Max Payne .ldb Level Models

Posted: Mon Sep 13, 2021 2:10 pm
by shakotay2
funny_tut.png
edit: meanwhile I checked some of the face indices "candidates" - always gives me a mess. There must be some trick...

Re: Max Payne .ldb Level Models

Posted: Sun Oct 31, 2021 8:44 pm
by Nostritius
I have researched the ldb format and can share what I found out. The thing is, that they use a weird serialization format which compresses numbers into up to 3 bytes. Every element is prefixed with a byte determining its type. From what I have read, you probably already know 0x16 for a 3d float vector. I have appended a python script which unpacks the ldb files geometry as obj files. There are still plenty of things to do, for example, the level is build up from multiple sub meshes. While I found an id to separate them they all lay on each other, so they need a kind of offset. Furthermore the extracted stuff is currently only bare geometry, while textures can be extracted I am missing some information where they get attached.

Re: Max Payne .ldb Level Models

Posted: Sun Oct 31, 2021 8:45 pm
by Nostritius
Just a small example of the end combat room as geometry. That thing hanging in the middle is one of those mentioned submeshes

Re: Max Payne .ldb Level Models

Posted: Tue May 03, 2022 12:54 am
by Reddance
how's this comin along? looks like you're makin good progress mango jango! :D

Re: Max Payne .ldb Level Models

Posted: Tue May 03, 2022 11:14 am
by Nostritius
Reddance wrote: Tue May 03, 2022 12:54 am how's this comin along? looks like you're makin good progress mango jango! :D
I made some progress and found a table, describing the material properties. Still, I cannot assign them to a particular face. I should mention that this has a lower priority for me, since I am more interested in the Remedy Games starting from Alan Wake which have a different Engine. I wanted to know, how much these games have in common with the Max Payne Games, that is the reason, why I started reversing them.

Re: Max Payne .ldb Level Models

Posted: Sun Jun 12, 2022 2:01 pm
by m0nstr0
I want to port Max Payne to UE5. So I've spent like a week trying to decompile this file format. I've even used IDA to disassemble all the DLLs and the EXE files to figure out how it is processed by the game. I've parsed like 80 percent of file format. The file format is a totally weird. It is the kind of memory dump. The level geometry is duplicated lots of times. I think, it's possible to write Decompiler from LDB to MaxED's LVL format, because LDB contains almost all information that LVL file contains. They use polygons to render geometry not triangles. I'm currently writing Maya script to visualize all of this mess from the LDB.

Re: Max Payne .ldb Level Models

Posted: Wed Jun 15, 2022 2:31 am
by m0nstr0
I wrote the script for Maya. It allows import Max Payne's levels.
Screenshot_3.jpg

Re: Max Payne .ldb Level Models

Posted: Thu Jun 16, 2022 8:55 am
by Nostritius
m0nstr0 wrote: Wed Jun 15, 2022 2:31 am I wrote the script for Maya. It allows import Max Payne's levels.
Screenshot_3.jpg
Nice work, would you be willing to share the code? I would be interested what I missed.

Re: Max Payne .ldb Level Models

Posted: Fri Jun 24, 2022 4:20 pm
by m0nstr0
Nostritius wrote: Thu Jun 16, 2022 8:55 am
m0nstr0 wrote: Wed Jun 15, 2022 2:31 am I wrote the script for Maya. It allows import Max Payne's levels.
Screenshot_3.jpg
Nice work, would you be willing to share the code? I would be interested what I missed.
Sure, https://github.com/m0nstr0/max_payne_ldb_importer

But I'm still working on it. There are some issues with the dynamic mesh transformations in the scene