Write a readme

This commit is contained in:
Ryan Dwyer 2022-11-10 19:39:00 +10:00
parent 2ef6549c9d
commit e73d0b9eae
2 changed files with 29 additions and 47 deletions

View File

@ -1,62 +1,44 @@
# Perfect Dark Decompilation
# Perfect Dark - Max Bots
This repository contains a complete decompilation of Perfect Dark for the Nintendo 64.
A mod that lets you play with over 400 bots in multiplayer.
The project aims to be a matching decompilation. When a matching decompilation is compiled with the same compiler that the original developers used, the output will be exactly the same as the retail game, byte for byte.
![400 bots in Skedar](maxbots.png)
To build the project, you must already have a Perfect Dark ROM. The project can build the exact same ROM from decomp's source code combined with assets that it extracts from your base ROM.
(Don't be fooled by that frame rate graph. 30 FPS is from the setup menu, and those are all 0 FPS frames while the match was playing.)
## Status
The mod changes the following from the stock game:
See the [Perfect Dark Decompilation Status Page](https://ryandwyer.gitlab.io/pdstatus/).
User-facing/obvious changes:
The ntsc-1.0 and ntsc-final versions are fully decompiled, but a small handful of functions are not yet byte-matching even though they are functionally the same. The status page doesn't show these as 100% because it counts matching functions only.
* The expansion pak is required.
* The "Small But Perfect Menu" is used, as the mod only allows Combat Simulator. However the full 8MB Advanced Setup menu is available.
* All unlockable features are unlocked by default.
* The Advanced Setup > Simulants dialog allows you to assign a quantity to each slot.
* During the initial spawn, any pad in the stage (not just spawn points) will be used to spawn bots.
* The options dialog has an option to hide bots on the radar.
## Installation Requirements
Less obvious, or behind the scenes changes:
For Arch Linux:
* Press L to toggle the frame rate graph.
* With the frame rate graph shown, press up on the D pad to toggle the page between the graph and some memory figures.
* All rooms and available weapons are preloaded.
* Much of the code and data relating to the single player game has been removed, to allow more memory for bots.
* When characters are shot, the vertex colouring on their body no longer occurs.
* The data structures representing MP characters have been completely restructured. The game previously had a one to one mapping of a "mpchr" to a configuration slot, while now it allows multiple mpchrs to share a single configuration slot.
* The logic for prop tick scheduling has been simplified, and bots will tick less frequently when off-screen than in the original game.
* Install these packages: `binutils fakeroot gcc make python vim`
* Install from AUR: `armips`
* Install from AUR: a MIPS binutils package of your choice (eg. `mips-elf-binutils`)
* Install from AUR: a MIPS gcc package of your choice (eg. `mips-elf-gcc`)
Bugs:
For Debian and Ubuntu:
* Opening the character selection menu causes crash.
* Playing with around 425 bots causes a crash after a few seconds.
* There may be some bugs if you don't use consecutive controller numbers (eg. controller 2 only, or controllers 1 and 3).
* Install these packages: `binutils-mips-linux-gnu build-essential gcc-mips-linux-gnu libc6-dev-i386 libcapstone-dev make`
* Compile and install `armips`
## How does it work?
## ROM Versions
The 8 bot slots still exist, but now each of them can have a quantity of 1 to 100 bots. This makes for a theoretical max of 800 bots, but you'll run out of memory shortly after 400. And your frame rate will probably become a slideshow at around 150.
Perfect Dark has six known versions:
The simulant type, difficulty and team is assigned per slot. So if you wanted to have 100 MeatSims and have them split into two teams you'd have to create two slots of 50 each.
| ROM ID | Description | MD5 Checksum |
|------------|---------------------------------------------|----------------------------------|
| ntsc-beta | NTSC 6.4 beta | aa93f4df16fceada399a749f5ad2f273 |
| ntsc-1.0 | NTSC 8.7 final (the initial, buggy release) | 7f4171b0c8d17815be37913f535e4e93 |
| ntsc-final | NTSC 8.7 final | e03b088b6ac9e0080440efed07c1e40f |
| pal-beta | PAL 28.7 beta | ad2de210a3455ba5ec541f0c78d91444 |
| pal-final | PAL 8.7 final | d9b5cd305d228424891ce38e71bc9213 |
| jpn-final | JPN 8.9 final | 538d2b75945eae069b29c46193e74790 |
When starting the match, the mod tries to determine how many bots can be allocated based on the current free memory minus what it estimates is yet to be allocated. However this somewhat of a waste of effort because the bot limit is capped by your willingness to play at 0 FPS rather than capped by memory.
The project uses the `$ROMID` environment variable to know which version to work with. If not set, it defaults to `ntsc-final`. You can change it by running something like `export ROMID=ntsc-1.0`.
## Extracting the base ROM
1. Save your existing ROM file into the root of the repository with the name `pd.ntsc-final.z64`. It should not be byteswapped (the first four bytes should be `0x80371240`).
2. Run `make extract`.
This will extract assets to `src/assets`. If any asset already exists then it will not be overwritten. This means you can modify assets as desired, and your changes will not be overwritten if you run the extract command again.
The extract command will also create an `extracted/ntsc-final` directory. This directory contains some compiled code segments from the ROM and is only used for comparison purposes.
## Compiling
* Run `git submodule update --init --recursive`. You only have to do this once.
* Run `make -j` to build the ROM. The ROM will be written to `build/ntsc-final/pd.z64`.
## How do I know the built files are matching?
Run `make` followed by `make test`. If `make test` produces no output then the compiled project is matching.
You can also md5sum your base ROM with the built ROM and check they have the same hash: `md5sum pd.ntsc-final.z64 build/ntsc-final/pd.z64`.
All bots start off in the "foreground" which means they tick on every frame. They gradually move to the background as the game figures out which ones are off-screen. The background ones will tick less often. In other words, with a lot of bots your frame rate will start off extremely bad and over several seconds will improve until it's just very bad. And looking into a big room with lots of bots will cause them all to move to the foreground, which will tank the frame rate again.

BIN
maxbots.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB