Brad Woods Digital Garden

Notes / Game dev. journal / 03 persistence

The Warhammer 40k Adeptus Mechanicus symbol

Table of contents

    DeLorean time machine

    03 - persistence

    Planted: 

    Status: seed

    Hits: 300

    Intended Audience: Creative coders, Front-end developers

    The game will involve travelling to different locations and speaking to characters at those locations gameMachine manages travelling and invokes locationMachine when a player reaches a location. locationMachine invokes a characterMachine when a player talks to a character.context

    When working on the conversation feature, testing changes becomes tedious — you have to travel to a location and click the character every time I make a code change. This is inefficient and slows down development. We need a faster way to jump directly to the conversation.problem

    Persistence — the ability to save and restore a machine's state — can help. One benefit is time-traveling, which lets us jump to different points in the game instantly. This would allow us to skip straight to the conversation, making development faster and smoother. One way we can implement persistence is by storing the events sent to gameMachine in an array when playing the game. When we reach the point we want to develop, we replay those events by iterating through the array and send them to the appropriate actors (gameMachine, locationMachine, or characterMachine). Allowing us to jump to that point in the game instantly. Note, for this to work, all data stored in a machine must be serializable (details).solution

    Store events

    Time travel

    To be continued...

    This game is under development and will continue to be documented in future notes.

    Feedback

    Have any feedback about this note or just want to comment on the state of the economy?

    Where to next?

    Game dev. journal
    Arrow pointing downYOU ARE HERE
    A Johnny Cab pilot