• SleeplessCityLights
    link
    fedilink
    arrow-up
    1
    ·
    1 day ago

    That is super cool that you got auto-save and auto-load to work with pure functions. It is technically an IO operation but with data structures and enums you can guarantee the same functionality as something stored in the heap.

    • soulsource@discuss.tchncs.de
      link
      fedilink
      arrow-up
      2
      ·
      1 day ago

      The actual writing of course isn’t pure. Loading isn’t either, but we only support loading on level transition, so we can supply the data already when constructing the game state. Saving is done by gathering all the data that should be saved in a struct, what is pure and happens at a well defined point in the frame, where the game state is known to be consistent (-> I think it’s after all systems have been updated), and then this struct is written out to a file.