Interrupt / systemshock

Shockolate - A minimalist and cross platform System Shock source port.
GNU General Public License v3.0
801 stars 62 forks source link

Take initial game state from archive.dat #379

Open dertseha opened 3 years ago

dertseha commented 3 years ago

Hello there!

When a new game is started, the inital state of the game and hacker is hardcoded. Most notably, various game variables, as well as the initial email, are set. See player.c, init_player() for details. This also limits where and how fan-missions can start, as even the starting location is hardcoded.

With this this feature request I'd like to bring this port here to feature parity with the source port, which has extra behaviour. tl;dr below.

Background: When Nightdive was working on the source port, I got in a chat with Axemeleon about the initial game state. I convinced them to implement a way that the engine would consider what is stored in archive.dat for the Player struct: The behaviour that is in objsim.c, obj_create_player() was (probably) expanded to init_player(): When the first member of Player.edms_state is not zero, then (most) values from archive.dat are taken over. (I guess this needed also some resurrection from commented code in gamewrap.c, create_initial_game_func(). During all of this, Axemeleon sent me an overview of what they implemented. As this was during the storm of "we're releasing soon, still working on details, ..." I wasn't sure whether this was implemented and implemented to spec.

Long story short, I finally (many moons past) came round to verify and publicly document it, and now I am in the process of implementing this in HackEd.

tl;dr The details which fields and variables are set to which value by the source port is now documented in ss-specs.

If you need test archives, it'll take a little longer, as HackEd is not yet ready for this.

dertseha commented 3 years ago

Update: HackEd v1.5.0 has been released. This allows to create an archive with modified state. I also created a sample mission for "New Game Plus" games, with some initial inventory here. This can be used as an example to work with.