Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Determine source of initial game state #11

Open
dertseha opened this issue May 14, 2015 · 5 comments
Open

Determine source of initial game state #11

dertseha opened this issue May 14, 2015 · 5 comments

Comments

@dertseha
Copy link
Member

The game state chunk 0x0FA1 in archive.dat is (almost) entirely 0x00. Try to figure out if all of the initial data for a started game is generated from the game code. It would be weird to have the initial location of the hacker be hardcoded.

Hunches that I have so far:

  • Is the remainder info after the archive name ("Starting Game") in 0x0FA0 truly just garbage? May this be the initial seed?
  • Is there perhaps a trigger (or spawn) object in the level that the engine looks for?
@dertseha
Copy link
Member Author

I had a quick look:

  • archive.dat 0x0FA0 does not have any bytes that resemble the initial tile coordinates
  • the initial tile does not contain any hidden objects

The easiest way to determine whether 0x0FA0 plays a role is to erase the extra information with 0x00.

On a side-note, comparing archive.dat and a savegame from right at the start revealed that the save game archives contain 4 more chunks that haven't been considered so far: 0x0000, 0x024E, 0x024F and 0x0F9F !

@dertseha
Copy link
Member Author

Clearing all the extra info in archive.dat 0x0FA0 did not have any (immediately visible) effect. A new game could be started and the hacker was at the usual position.

@dertseha
Copy link
Member Author

Thanks to inkyblackness/construct , at least the first level and hacker position is hardcoded. The first level is 1 and hacker is always put on tile 30:22.

Even the current health seems to be hardcoded, though, the energy level is not. The absolute minimal archive.dat required, created by inkyblackness/construct, starts a new game with full power. The regular archive.dat leaves the hacker with about a third of power.

@dertseha
Copy link
Member Author

dertseha commented Mar 7, 2016

As for the power level: This mystery is solved, there is a "level entry trigger" (object index 695, located at tile 31:23) which removes some power.

@dertseha
Copy link
Member Author

dertseha commented Aug 6, 2020

The source code proves it: gamewrap.c, create_initial_game_func() has a dedicated comment stating that there's no point in taking in the struct from archive.dat. So, the original engine ignored this resource, and everything else is hardcoded in player.c, init_player().

However, the source port was extended to allow this, and this behaviour has now been documented.

Keeping this issue open, as I haven't come round to detail the MFD fields, which are also set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant