I'm making a kind of infinite runner style engine. It generates the terrain in chunks each time a milestone is reached, and stores each chunk as a custom class in a list.

To minimize overhead, it only instantiates required chunks as game objects, but keeps the data to re-instantiate one.

Obviously the list will keep getting larger the longer the player is able to survive. However I want the ability to go backwards, so I don't want to destroy the chunks, but I also don't want keep potentially hundreds of them in ram.

I could regenerate them when going backwards but that will involve rejigging the whole seed system.

Is there a succinct way to serialize unused elements in the list to disk when no longer needed?

  • \$\begingroup\$ Can the player change the generated content(such as terrain,tree or something)? \$\endgroup\$
    – Mangata
    Jun 17 at 16:29
  • \$\begingroup\$ No, it's static once generated \$\endgroup\$ Jun 17 at 16:50
  • \$\begingroup\$ Not enough to store just the seed value for the chunks for future backwards going? \$\endgroup\$
    – Zibelas
    Jun 17 at 16:53
  • \$\begingroup\$ Actually the more I think about it that is totally doable. Over thinking as usual. \$\endgroup\$ Jun 17 at 17:14


You must log in to answer this question.

Browse other questions tagged .