Saving/Loading, Performance Optimizations and Difficulty Settings


Hello all!

The past couple of weeks of work on Forager have fortunately been insanely productive!

Besides some additional secret content, and the usual bugfixing, the following big features have been added to the game and are now fully functional:

  • Saving and loading games
  • Major performance optimizations
  • Difficulty settings


SAVING AND LOADING GAMES

When designing the save/load states of the game, the following considerations were taken into account:

  1. Input from the player shouldn't be required. Players shouldn't go into menus and click a bunch of options to save their game. The game should auto-save itself in a smart way.
  2. Savefiles should be encrypted to avoid exploits. This is a fully singleplayer experience, but since it's riddled with secrets (and possibly achievements in the future), savefiles should have at least SOME form of encryption, and of course, become corrupted if data is modified by the user.
  3. Saving shouldn't pause, freeze, or stop the game in any way. It should be instant and quick.

I tried several systems to get this one to work. I tried several encryption methods too. Ultimately, there was a direct correlation in encryption and processing times when saving. A stronger encryption meant a slower saving time.

This has a few issues, but the most important to notice is that after the player has been playing for an hour or more (and the map is filled with structures, terrain, particles, objects, and entities), saving would freeze the game for up to 3 seconds. Which of course, was unacceptable and pretty bad UX design.

I ended up having to make a choice between strong encryption and slow save/load times, or mild/moderate encryption and instant save/load times. I chose the latter.

The final version of the saving/loading system automatically saves the game every 5 seconds. And it's quick and seamless! But it also takes into consideration a few other things (is the player about to die in 5-10 seconds from hunger? Then don't save, it's frustrating to load a game and instantly die). Players can drop out of and into games really quickly and seamlessly



PERFORMANCE OPTIMIZATIONS

The whole game is now being compiled with YYC (YoYo Compiler). The way this compiler works is best explained by reddit user danredux in the /r/Gamemaker subreddit:

"The standard compiler converts code like "NAME='HELLO'" to machine-code, which is basically a list of instructions like "SET VAR NAME TO 'HELLO'". When you play the game, it starts up a program called a "runner", that loads in the list of instructions and starts executing them. That is to say, it would see "SET VAR NAME TO 'HELLO'", and it would find the NAME variable in memory, check that it exists, possibly convert it to a string type, then set it to 'HELLO'.

The YoYoCompiler takes it one step further. It compiles those instructions into machine instructions, which do not need to be read by a program, but are instead read directly by the computer chip. So, "health=10" would be convert to the bytecode "SET VAR health TO 10", which would then be converted to the simple machine code "MOV 0x1000, 10". The computer can understand this directly."


Essentially, compiling in this new way greatly improved performance on Forager. I have of course noticed many of you having FPS drop issues after playing for a couple of hours, and I am glad to let you know this is now solved!




DIFFICULTY SETTINGS

Inspired by games such as No Man's Sky, Forager will now feature 3 distinct difficulty options (or game modes) to choose from at the start of each game.

I will get to tell you more about the modes next month, but for now, here is the gist of it:

  • PEACEFUL: A relaxing experience. Geared towards chilling and building a big base while not being bothered by enemies. Some enemies and dungeons WILL spawn, but the player will ALWAYS have the choice to engage in combat first. This means enemies can't raid you or attack you unprovoked in this game mode.
  • SURVIVAL: This will be the "normal" game mode. Very similar to Peaceful mode, except enemies will occasionally spawn and raid your base. Also, the terrain generator can choose more "aggressive" lands to spawn (such as lands containing mini-bosses and combat oriented challenges).
  • HARDCORE: A real challenge! Enemies will raid you on a set timer, resource generation may slow down (not sure about this aspect yet). And dying means it's game over for good! That's it, permadeath in the very sense of the word. Upon dying, the savefile will be deleted for good. This game mode is geared towards experienced players seeking for a challenge in their replayability.


That's all for now! I suspect this build will be available to test at the end of August.

IF YOU WANNA TEST THIS BUILD OUT, YOU HAVE TO BE SUBSCRIBED TO OUR MAILING LIST!

Get Forager (Demo)

Download NowName your own price

Comments

Log in with itch.io to leave a comment.

Love this! Looking forward to the full game