Skip to content

Instantly share code, notes, and snippets.

@fuxingloh
Last active February 2, 2020 10:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fuxingloh/abd96d676ac180483dd18409df42c1af to your computer and use it in GitHub Desktop.
Save fuxingloh/abd96d676ac180483dd18409df42c1af to your computer and use it in GitHub Desktop.
An idea on procedural content generation for games with alteration/grieving/modification.

History

Basically the game No Man's Sky UPS was a world with infinite possibility. I was very excited about the release of such a game because it created new possibility in games and might even inspire some one to do it better. The game flopped on release but the concept was unique, I was excited of what's to come. Fast forward 3 years later, still very little innovation in such genre.

Two incident caught my attention recently, Minecraft 2b2t and Sky Citizen.

Minecraft 2b2t server is a good example of maintaining a world with infinite possibility. 4000 GB of data, and <100 players can be on it at a time. Huge noticeable lag as the server is struggling to maintain and stream world info the user.

Sky Citizen is another game designed with a world that you can take a lifetime to visit.

Literature Review

I did some research (1 hour) on procedural content generation in games on published paper. Asked one friend that studied game design from my army days. Countless night thinking about it and doing some light Googling. There were quite a few mention about procedural content generation but none talking about how to make such system scale.

Idea: Procedural Content Generation

How to store a limitless world that can be modified?

Procedural Generation

Generate the world procedurally with a integer like seed. I am not going to dive into this, there are enough article about this.

Parent Seed Node

For example, the infinite world is make up of a 64 bit integer seed. At the beginning, the launch date; that's the only piece of data you store for the game. All player will experience the world with infinite possibility with just that 64 bit seed. That 64 bit seed will be the parent node to the world.

Leaf Node

As user start to explore region and started making changes to the world. You spawn the child node that cascade, as they get closer to the ground. The child node must also be seeded procedurally from the parent node. By doing so you keep player in sync as all user see the same thing. The server don't have to stream additional leaf node info if the world is left untouched. Changes are made to the leaf node and every changes they make will be saved with a level granularity. User that are out of render distance don't need to see the change as they are looking at their own node.

As user start to build mega structure, you need to save the effect they make into the parent node. Similar to how satellite can see man made structure. What you can do is use the same procedural generation technique and use a brute force seed generation technique to find the closest match and save it. Brute force compute a seed until you can find a seed with the highest % match to all the child node. Higher the % matched means lesser data need to be saved as you don't need to stream the changes users have made as it can be calculated from the parent node seed.

You can queue this and run it in in the background as they are not necessary useful if the world is heavily populated as changes are made too quickly to generate a matching seed.

Scaling by Decaying Node

Overtime as the user leave the planet system, let the node decay. By allowing the node to decay, you can play with granularity of what user see. You can also decay the node to match your procedural generation technique, meaning doing it to increase the % match. (Read above)

Decay the node upwards overtime. Once all leaf node is decayed, start decaying the parent. Just like our world!

Grieving

The best way to protect against grieving is to balance creation and destruction. Make destruction of property harder than simply creating. Create a legal system like ours. Create an industry in game around protecting property.

Thoughts on Versioning

However you need a procedural generation technique with versioning support. When you create a new item and object into the game, you want user to be able to create them into the world. Allow the seed data to have version info so that user can run different procedural technique locally when they visited a existing or new world.

With versioning you can also optimize the technique I mentioned above. Additionally, region that are left untouched, you can invent new content by replace that node with a new version and seed and therefore new content! New structure, new clouds & new alien!

Finally

I wrote this just to get it off my mind, I am not a Game Engineer, I just like games like you. If you think I am pulling this out of my ass, please entertain me and comment why it won't work. I would love to understand more about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment