Max Payne :: Zen Of FilestructureFile: /articles/filestructure.phpUpdated: 20.08.2001 - 17:24 - @683 click here for a printable version Version: 0.93 Content: Foreword This article/tutorial goes through the basics of mpm filestructure and how you should work with it. We'll do a basic mpm where we add a level and use it in the game itself. So let's start, shall we. TheoryAlright, Max Payne uses a simple datastructure which is divided into directories. If you understand how PAK in quake works MPM is almost the same.The directories goes like this:
There are two ways to make Max Payne load your own files. Here's a bit from the documentation of Max-Fx: Max Payne loads data files based on this priority list:
Lets imagine that I have the game installed in So, if we make a folder called
The idea is quite simple. You'll understand it better when we'll actually do something. Don't worry if you don't understand this all yet. It will all be more clear at the end of this article. But first we need to make RASMaker work like we want it to work. Using and configuring rasmakerI think we should now do something practical, so let's extract those RAS-files, which holds Max Payne's -gamedata. I suppose you've installed all max-fx tools, so look up the rasmaker directory. If you are advanced in dos etc, you can skip the next few chapters where i just explain how one should use rasmaker in cmdline prompt.When you've found rasmaker (probably something like Copy the rasmaker-files to a directory which has a path. Now
this is a bit tricky: type just path in your prompt and see what it
outputs. You might see a lot of text, the idea is, that all those
directories which are separated with a ; has a path. You need to copy your
file in one of those paths, for instance The other way is:
That's it, now you have rasmaker in your path, and you can command it
from any folder. Try it out by cd:ing to the root for instance and typing
"rasmaker". If it still doesn't work, you can try to put the
rasmaker-files in folder
Extracting Max Payne Data-filesSo you have now rasmaker set up and all.CD to c:\maxpayne
(or whatever your MP-folder is called, i'll just refer to c:\maxpayne) and
type rasmaker -x x_data.ras . That extracts the file
x_data.ras to current folder. Don't worry, it'll just put the data\
-subdir under your maxpayne-root, like c:\maxpayne\data . We
need to extract all other ras-files too. So make a dir *.ras
to see what other ras-files there are, and do the same operation to them.
Now when you have extracted all data which is in those RAS-files, you
don't need the RAS-files anymore, but don't delete them! Rather make a dir
under maxpayne called After you have uncompressed the game data files, you should move all the .ras files away from the game root. Otherwise you will get a "duplicate entry" type error when loading the game. This is due to the way the game loads for example all *.txt files from the weapons folder. If you don't move the .ras packages away, the game will find for example two weapons called "beretta".
MOD MakingConfiguring Levels.txtYou need to make an entry of your level in the levels.txt. The innards of levels.txt has simple blocks of information, each block represents one map. The syntax looks like this:
The easiest way is to copy an existing mapblock. So we need the
original levels.txt. Go to folder
Here's an example, how a mapblock in levels.txt should look like (if used above definitions):
The most relevant parts are:
Change the map name in the brackets (where reads 'mylevel') to your preference, don't use spaces. Remember this, because when you load this map in the console, you need to use that name you put between the brackets. The directory-part tells the dir-name to look under the levels\. In this case, it's mylevels\. So the path in the dir should be c:\mymod\data\database\levels\mylevels\. You should also change this dirname to your preference. LevelName -variable just defines the "long" name to your level. PlayerStartingPlace defines the jumppoint where the game starts. The syntax goes like "::roomname::jumppointname". If you get messages of invalid starting places or something similar, you most probably have this line wrong in the levels.txt. Or then there's something wrong with the map.
Making the MPMRemember the earlier part where i citated Max-Fx documentation? It went like this:Max Payne loads data files based on this priority list:
So there you have it. However, the doc doesn't explain the fact, that
you should really just have a file-structure similar to the one which we
uncompressed under First you need to make the empty filestructure like in
mylevels
and it's the last dir in the filestructure i showed. Now copy your .dlb
file in that mylevels-folder. You need to also have levels.txt in folder
c:\mymod\data\database\levels\ . When you are done with your
editing, we're ready to compile our map. Start the dos prompt and go to
c:\mymod\ directory and command
Now rasmaker will compile a mod called mymod.mpm and it has your map,
and the edited levels.txt. Now, in case you haven't already, you need to
rename that data -folder in Now when you've done this, move your .mpm to When you have chosen the mod from the upcoming dialog (it's there, at the bottom), start the game. And bring up the console (use F12) and type:
That initializes your map, next you have to switch to the game-mode:
And that should finally load the level. The parameter in gm_init (which is in this example "mylevel") is now the one you put into those brackets in levels.txt. Using data-dir as a developerIf you are developing a MOD/level, I suggest you don't compile it every time as a MPM, rather skip the process and copy the ldb with the appropriate levels.txt straight under the data\ -dir under maxpayne-root.Of course you need to create it first, either by yourself or by just extracting all RAS-files. Remember to remove the RAS-files so you don't get multiple occasions of data-entities. This is the method I prefer. Reasons are:
Closing WordsNow you've learned the way how MPM's and the rest filestructure works. If you didn't, read this text again. It's basically fairly simple, when you get it. There are still some issues in the use of MPM-files, and i'm working on them. I'll update this article/tutorial when i get more information.--Mikael Kasurinen aka mixuk note: if you want to comment this article, you can mail me. |