Commit b94b6517

Adds a proof-of-concept implementation of the scenario system

Relates to #83, #84
Resolves #85

Hello! This commit is providing the basics for the new scenario system. One of the reasons (or rather the reason) that makes me excited is that after years of development it is finally possible to configure the size of the world in OLives, which up until two days ago was hardcoded. 🙂

The –scenario parameter is now actually used for its intended purpose, specifying which scenario file to load, not just simply whether or not to jump right into the game or stay in the menu. The game will now happily crash if a bad (non-existent) scenario is being passed, of which right now exists exactly one, aptly called default.

The format of the scenario files looks something like this right now:

The format is definitely not complete yet, and only the funds and world_dimension are currently honoured. As is suggested by the existence of is_save, this format (or a very similar one) will be used for save games, when the time finally comes to actually implement saving the current state.

To summarise the current state of things, here is what already works:

  • Loading and very basic parsing of the JSON scenario files
  • Specify which scenario works from the CLI
  • Initialising some game state properties based on it
  • Loading the scenario (“default”) from the menu

What does not work yet however is:

  • Honouring the other existing (world) properties
  • Adding and honouring other important settings (objects/wall state/tile state)
  • Listing existing scenarios and letting the user select one

It is important to underline how much work is still to be done to finish the feature in its entirety. However, much of the work is in all likelihood pretty straight-forward and there will be gradual, but very tangible progress along the way, to which I’m really looking forward to.
There has been a piece of code which has been moved around to (including the comment at the top) for about two years now, it looks like this:

I’m very excited that the prospect of getting rid of it for good has changed from “sometime in the future” to “sometime in the next few weeks”. Byeee. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *