Back to home

Digital Safari - Ideation

A server hosted, hyperdetailed eco-sim.


DISCLAIMER: This is a massive text dump, because I have nothing visual to show for this project yet. It's more for my own documentation process but you can read my ramblings to your hearts content.

I've had an ongoing project for a while called Khora, which started out as a way to experiment with game dev systems and stretch my programming muscles. It quickly turned into a full fledged project and ultimately a dream game, so I shelved it to work on other projects and develop my skills, I also wanted to a build a custom game engine for it but that's still a ways down the road.

In that idea, I wanted to have a vibrant world that felt alive, with complex animal behaviours and environmental adaptation. Wolves hunt, trees grow, flowers die, tides shift and meadows flood. It's ambitious, but as a project that you can just build on, it's never left my brain. Now I've got an idea to combine a few different ideas and utilise this gradual codebase growth attitude.

The Idea

Imagine a digital environment, maybe only 32x32 tiles, in which a family of digital cows live. They graze, they breed, they sleep, they drink, they sit in shade on sunny days and the young drink their milk. Pretty detailed, not an easy thing to pull off, even just from an animation perspective. Then say the trees around it grow, the grass depletes as they eat it, and regrows with time, ponds fill when it rains and drain when drunk from. Again, pretty ambitious. Okay now imagine that but 1:1 with Earth and happening concurrently with every animal you can think of. Okay now we're dreaming. But maybe that's a good thing?

I've already said this would be a project that would grow with time, but even just getting it to a point to launch an alpha release would be a monumental task, and yet it's one I plan to tackle. I'm gonna go over some of the systems I've got knocking around in my head.

The World

This is kind of a make or break for the soul of the game (if you can even call it that). I want it to be 1:1 with Earth (where 1 tile is 1 metre, similar to Minecraft) but one untouched by humanity, where ecosystems have been allowed to thrive and expand to their natural limit. The first issue with this is that land on Earth consists of nearly 150 trillion square metres, which is more tiles than I'd like to render or handmake. So some world generation has to be involved, but using typical procedural generation wouldn't align with Earth georgraphy.

So games like Minecraft use procedural generation, meaning there is a consistent mathematic equation creating the world, which also means it can be destoroyed and regenerated in exactly the same way. The limit of this is crazy, which is how Minecraft achieves worlds many times the scale of Earth. My issue is that the world is static. It can't be procedural (without relentless programmatical tinkering) so I need to use another method. I'm yet to test it, but using a cascading level of detail (LOD) system may be suitable. I would hand draw the temperature, precipitation, and humidity maps as well as the actual terrain map, all at a lower resolution, and essentially dive into each layer of each pixel and run a perlin function informed by its neighbouring values, to create a variable and detailed terrain. This means that the rendered section of the world can be generated on the fly with nothing stored beyond the seed and the drawn maps, amounting to mere kilobytes. My only concern is speed, but we'll cross that bridge when we get to it.

The catch with this is that, while the base world gen requires very little data, any changes made to the world certainly will. Even just one tile change per 32x32 chunk would amount to over 4.5 billion tiles. The scale of the Earth is insane. And honestly I'm not sure there's an elegant solution to this problem beyond just tanking the storage it would take to run this. Going back to Minecraft, many older and thoroughly explored worlds can end up taking up terabytes of storage. It speaks to the distance we are from the imagined 'atomic engine' for game design. It's something I need to ponder and see if I can come up with a workable solution.

Weather is something I want to manage with a decent amount of realism. I'm even considering using an open weather API to have in-game weather reflect the weather in reality for the respective locations, though I suspect this would be a lot trickier to adapt for purpose than I'm hoping. The LOD system would come into play here, rendering from the server dependent on the users view, but these calls would have to be done on a regular cycle so the weather is ready to display without the user having to wait for an API call to make its full journey. With a realistic weather system, and semi-realistic terrain response to weather, we should end up with a fairly accurate ecological reflection of Earth. I'll have to fudge some of the numbers because of climate change, but that comes in with the research phase of the project.

The Animals

I've been working out the best way to make a demo of this project, and which animal I should start with. It's tough because a vibrant ecosystem is comprised of so many factors, many of which are animals themselves. For example, with the level of detail I'm striving for, it would be impossible to start with wolves because they would have nothing to hunt. So I need a herbivore, but to allow for grass to grow, I need a weather system (unless I fudge it for the time being) and ideally pollinators like bees or butterflies. Regardless, as with the example I started with, I'll start with a cow. A nice friendly animal that you can find all over the world in various shapes and sizes. They may seem like simple creatures, but crafting an animals brain from scratch is yet another massive undertaking.

My idea for the brain in this project is essentially a glorified state-machine. Using different behaviour states, I can get what appears to be natural behaviours from an entity, but this isn't good enough for me. I want to simulate the function of different areas of the brain, starting with memory and instinct. I want the animals to have configurable brains to determine things like aggression, memory capacity, flock behaviour etc. But memory is at the top of my list for sure. If a cow finds a consistent source of water, it should know to revisit that area, it should remember which calf is theirs, which mate is theirs, where the best grass grows, where to find shelter in a storm etc. These little touches come together to make a complex entity with its own character and set behaviours. But again, we have a scaling problem. Although the number is skewed due to demand for beef, there are currently approximately 1.5 billion cows in the world. That's too many complex entities to simulate. Of course these would be culled down, if not in population then in what is actively being simulated, but then we have another issue. How do we simulate the unsimulated?

The vast majority of the animals won't be rendered at any one time, and there is no sense in wasting computational power to simulating the unobserved, but I want it to feel as though they have been ticking away even when they're not being watched. But where do we draw the line? We can fake positions but in the hours, maybe days, since they were last seen, they may have given birth or died, eaten loads or wandered off, any number of things, and they should be free to do just that. So we could do a sort of sped up simulation of events based on existing behaviours to sort of catch up on what might've happened, but that would not only be very computationally intensive, but buggy. If you observe a spot, then the cows in question, and the sped up simulation ends up placing that cow in the spot you just were, it would be as though they appeared out of nowhere, and that's a bug I've caught without even making the damn system. It's too problematic and I don't trust it. So a delayed tick? A simulation queue? How does all of this fare in tandem with user observation? This is an incredibly difficult balance to strike and one that requires careful planning and consideration.

Other Systems

On top of the obligatory systems holding up the backend, from tickets to sprite managers, I have some other ideas for user interaction that would be interesting additions.

Tagging

Say you like the look of one particular animal and you want to keep an eye on it, keep up to date on it and be able to navigate directly to it when you open the game, you could tag it with a tag item which would apply a sort of bookmark to the top of the screen. By default, you would get 3(?) of these with the option to purchase more (a large portion of the money from this project would go to wildlife charities). This allows you to stay invested in this particular world and the lives of these animals as time goes by and they live their life.

Naming

Similarly, you could donate a set amount of money to name an animal in the world. I considered even a bidding system to allow people to outbid and donate more and more money to charity in order to name these animals. This one requires more thought but the idea of naming the animals does appeal to me.

Trip Lines

Since this is a 1:1 replica of Earth (without humanity), you could theoretically navigate to your exact position at any moment. You could then add a 'trip line' to a particular area, be it a single tile or a larger area (I'd put a limit on it). This trip line would then notify you when an animal crosses it (you could filter it to certain animals), and maybe use an in-game recording function to give you a rendering of the event.

Information Display

Because this is ultimately a charitable and education venture, I want to add information about each animal that educates and informs about the reality of our world. If a particular species is endangered, I want that as a label. Maybe listing how many are left. Otherwise I could add in fun facts and other information about the added animals in the form of a widget/card that pops up when you interact with the animal.



There's a lot to consider, and this idea is growing in my head daily. The tech stack is unconfirmed because I need to test the limits of some of it, but it would be a massive personal and technical achievement to pull off. We'll have to see as time goes though I suppose. I'll keep making devlogs about it as I go but in the meantime I'll be working on a proof of concept demo.