Thoughts on ontogenetic creation pt1.

I initially wanted this to be a post about some ideas that I had had for how one might go about creating the placement of settlements, particularly around a larger city ontogenetically. Unfortunately, it got a bit too long and I ran out of time. This is, therefore, the first installment in what will be a series of posts on ontogenetic creation.


r/dwarffortress - Dwarf Fortress text mode in a fullscreen terminal 👌
Screenshot from Dwarf Fortress while it generates the world.
First, let me explain the word ontogenetic from the title. Ontogenic algorithms are those which allow a result of a process to be jumped to, without having to calculate the intermediate steps. A great example of this is the world generation that is used in games such as Minecraft.
The computer can generate the world around a player wherever the player is, without having to generate all of the world in between. In Minecraft, you can jump to any point before the farlands and the computer will be able to generate that world as quickly as it could a place much closer to the origin.

There is a slight difference here between procedural generation and ontogenetic generation. The terrain generation in Minecraft is both procedural and ontogenetic, that is to say, that the world can be generated at any point without having to know the intermediate points and that the world is produced algorithmically and not engineered by a design team.
 An example of procedural generation that is not ontogenetic (Therefor teleologically generated) could be taken from the game Minecraft was inspired by; Dwarf Fortress. In Dwarf Fortress the world is simulated for a time before the player starts to interact with it. The difference here is in that simulation.

In the simulation, the events that take place next, are calculated based on what has just happened. This is done in a way that can't be quickly predicted. You can’t jump straight to a particular time. The further in time you want to see, the longer you have to run the simulation.
 You might be wondering given the nature of simulation through time how you could have an algorithm that skips this simulation. A way of going to any point in the future, in the same way, you can go to any point in the Minecraft map, with a constant amount of computation. A technique where going 1 second into the future is just as hard as going a million years into the future.
 Well, such algorithms do exist and a great example is in the game Kerbal Space program. If you haven't heard of Kerbal space program I implore you to go check it out, and Scott Manly's youtube series interstellar quest will help whet your appetite for the game. In Kerbal Space Program you are running your own space program where you launch satellites (and other missions) into space.
The point in KSP where a craft goes from the orbit of the planet Kerbin to Mun.
While you are controlling the spacecraft the physics is calculated using Newtonian mechanics step by step. These step by step calculations clearly can't be skipped, running the simulation twice as far into the future takes twice the computation.
The clever thing here is that once the craft is in orbit the physics simulation changes. Instead of a Newtonian step by step model, Kepler's model is used. 
You lose something when using Kepler's model, if you didn't you wouldn't have a need for Newton's. The first thing you lose is the ability for the craft to be under propulsion. The craft is assumed to have no other forces acting on it other than the gravity of the body it is in orbit of. That has its limitations, and Kerbal Space Program gets around these by using spheres of influence, whereby an object is assumed to be in the orbit of a body when it is within a certain distance of that body.
 What this gives us though is a method for calculating the position of a spacecraft in orbit around a body indefinitely into the future.
The formula takes in time and outputs position.
There is no iteration required.

 I find this idea incredibly powerful and I have been thinking about whether it could be used to allow a procedurally generated landscape to have ontogenetically generated civilizations. In the same way that the use of Kepler's laws are a simplification that allows us to transcend into the freedom of ontogenetically calculated positions, I wonder if abstractions of other processes could be ontogenetically produced. This would allow for a Dwarf Fortress style game to jump to any point in time from the beginning without requiring a longer simulation period.


You could fit any size city in a Minecraft game.
Simulating only part of a city is hard given how interconnected they are.
Picture: Megacity1 from Dredd 2012
One potential problem with this is that it would create a world where (assuming like in KSP observation causes the transition from ontogenetic and teleological) the civilizations and other processes would be affected differently depending on if they were being observed or not. Isn't this the case in real life though, in a sense the observer problem in quantum mechanics could be seen as a switch from one model of the world to another.

 In starting to explore the ideas for ontogenetic creation I looked at what other processes outside of gravity could be produced. There are a lot of processes in physics where a process is simulated at a much higher level when the lower level detail is not required or not possible. This is the case in fluid dynamics where in pipes the pressure and velocity calculations can be done far more efficiently than doing the fluid simulation.

The idea that I wanted to explore for cites was inspired by a video on a suggested new direction for the Minecraft sandbox. The author of the video thought that adding functionality whereby you could become mayor of a village, or in other ways persuade the NPCs to carry out work for you would extend gameplay in a compelling way. 
I was inspired by this idea that you could extend the world's most popular sandbox to include relational dynamics. I think that more than adding the robots computercraft sought to, adding the ability to manage NPCs to carry out work, that could collectively benefit a whole and expand the settlement. I love the idea that rather than just raiders, villages raided each other and grew over time.
I have always thought that a city biome, where NPCs worked, with huge farmland around supporting it, would be an interesting direction but then I am a fan of city-building games.

In the video the author talks about the settlements, as they grow larger, engaging in wars. I find all these ideas an exciting direction that the world most ever sold game to go in. I also think that implementing this with the same procedural freedom as the landscapes would be more in the spirit of the game than adding more handcrafted elements.
What I feel the author fails to express an appreciation for is, among other things, the computational requirements of dynamism.
I think the problem starts with a simple example of how poorly Minecraft manages unloaded time. The fact is that it doesn’t. In Minecraft, you can breed livestock and plant various crops. Both of these take time to mature, however, they only do so when loaded in the map the player is present in. If you go exploring away from your farm nothing changes, nothing grows. The modeling of the maturity of livestock and crops can be very easy to do ontogenetically assuming a universal clock. By attaching a conception time to the object in question and knowing how long it should take to mature when the object is reloaded, the engine simply needs to check: Is the current time minus the conception time larger than the maturity time? This requires no more computation if the items in question are left for a minute or a million years. What is harder is if there are steps in between. For example, if the livestock was modeled in more detail, and each animal wasn’t homogenous, then our ontogenetic model fails. For example, if the amount of meat on the cattle was a function of how many jumps and steps it took as a child, and this was determined by how it moved dynamically in the environment, then that environment would have to be simulated. That would mean, at least until maturity of the animal, simulating in real-time, unable to skip any step in between.

In the next post on ontogenetic creation, I hope to explore some ideas I have for how cities could overcome the problems of being so interconnected yet only having to load a small section of them at any one time. My ideas for this are partially inspired by this video on why cities are where they are.

Comments

Popular posts from this blog

THREE.js: minecraft in a weekend

Picking apart Perlin noise from first Principles

The invincible 20 year olds