Mechanics of the World, Pt. 1


Since many years, I've always wanted a sort of successor to SimEarth. Even if the game was made before I was even born, I always have found interesting and weirdly captivating the way that a lots of simple systems interact, to make in the end a planet like the Earth. It also really help gauge how many thing we need for life to exist (see the Fine-tuned universe theory to see how it applies to the whole universe). And I want to perpetuate this feeling in Stella Dei.

And there was Light

If the Earth was flat, it would have helped me as it would have made all algorithms much simpler to make and faster. But no, sadly the Earth and all planets are spheres-ish (slightly flatenned on the poles) and I need to account for that. First thing to know is that when I'll do temperature and water simulation, etc. I'll do it point per point. So I needed to distribute points evenly on a sphere.
Fortunately, in computer graphics there's a very simple way to generate a sphere with points, called an UV sphere. Hooray! Except.

The poles have WAY too many points (see how the lines all cross towards the poles). So I searched more and found out that having points perfectly evenly spaced on a sphere is impossible. I then found about Fibonacci lattice which gives a bunch of unconnected points which is inconvenient because computers make 3d graphics using triangles, not single points. All of that until QuantumDeveloper just suggested I use an ico-sphere.

An icosphere is based on an icosahedron that you subdivide into more triangles at each step.


So after wasting time efficiently doing research on Fibonacci lattices for days, After I found out about them, I just implemented ico-spheres in less than an hour. And by adding Perlin noise, in less than a day, I already had a green sphere floating in an empty space full of emptiness.


And there were Sun burns...
I started with a simple temperature diffusion system that wasn't even remotely based on any real world physics.
First I created a simple shader to see hot points in red and cold points in blue. And then all I needed was that each point spread heat to its neighbouring points. But the question was who are a point's neighbours? On this point I was saved by the ico-sphere, as (almost) each point is in an hexagon formation, meaning it has 6 neighbours that are easy to compute. Hexagons truly are the best-agons.
With that done, let's say I still had to deal with a few bugs related to point simulation..

But in the end, diffusion and other phenomenaes are easy, even more so when it's not based on physics (do you already see future me's pain incoming?)

It's smooth isn't it? And thus, only 3 days after I started actually working on the game, I already had a simulation with poles!

Technical debt is knocking hard at my door but I'm just ignoring it. It'll be fine. Making a game is easy. Physics is easy. All features will be implemented in a few days. Right? Right?!

... and water and stuff
First, the water you saw in the above picture is fake. Yea really. I just used a dumb shader that sets color to blue when altitude is under sea level. But what we want for our planet is real water, so let's get real.
The way it works is simple, each point literally calls a function called 'sendWater' for each of its 6 hexagon neighbours. And if the point has more water than its neighbour, it sends some water to it. And that's it really. Navier-Stokes? Who cares right? that's for future me...
Anyways, in the end, water simulation looked like that



And then I just changed the visuals a bit because while faded water looks great at a distance, when zooming in, it looks like I removed my glasses, it's just blurry all over.

So, everything's great right? I now have a simulation that works uh. Elevation is measured relative to the planet's size (aka, it's arbitrary). Water is measured in elevation (???) and the sun power is in purely arbitrary unit with no meaning (don't mind the (W), it's me planning to use Watt).
Next step was obviously.. how to use real physics units because, while I certainly don't plan 100% accuracy (which would basically be me making The Matrix real) I still want a bit of realism which wouldn't hurt.
After this recap of the first month of development, you can read more in the next part.

You can play the game now, it's free



NEXT PART

Files

Stella Dei 0.1.0.zip 27 MB
Jun 11, 2022

Get Stella Dei

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.