0
\$\begingroup\$

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?

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

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.