The last 9 years

EvoLife

Create and evolve your own digital lifeforms! Watch or interact as your creations adapt and thrive in a world governed by the laws of physics. Download now and start your own evolutionary journey!

[h1]Vision[/h1] Nine years ago I was (and I am still) into David Attenborough. I was watching "First Life", a beautiful movie I recommend to everyone and begin to fall asleep. I had a very vivid dream. I saw digital energy balls moving along a synthwave like blueish purpleish grid. I realized in my dream that they are ancient digital lifeforms waiting to be implemented. When I woke up I begun my journey to bring my vision to life in my spare time. [h1]2013[/h1] I quickly threw together a proof of concept code to see if it is any fun to look at. The cells do only one thing: divide. With each division they randomly mutate their size and color a little bit. [previewyoutube=_3WPcVd5ruM;full][/previewyoutube] (For some reason the date shows up as 2015.07.27. on the video page but the YT Studio shows me the correct upload date: 2013.09.01.) I was satisfied and dissatisfied at the same time. The cells looked cool, but you can notice that at 0:20 at the video the fps begins to drop. I rolled my own very primitive physics engine and the performance was lacking. [h1]2015[/h1] First I tried out the Chipmunk physics engine but somehow I ended up using Box2D. [previewyoutube=gH4bw-xrD1o;full][/previewyoutube] As you can see at the end of the video performance was still bad if you added too much stuff, but I was using an industry standard physics engine and that was good enough for me as a then novice programmer. [previewyoutube=oP7TWcveEY8;full][/previewyoutube] By November the first cell appeared. Light green is an alive cell, dark green is a dead one. It divided, and the old cell pushed the new one upwards then the old cell died. The new cell repeated this process leaving a trail of dead cells behind. The DNA of the cell was hard coded but it worked and looked cool. [h1]2016[/h1] [previewyoutube=xDEOLXaLEMc;full][/previewyoutube] I implemented rotation and going forwards, still hard coding the DNA of each species. But there are different species with different behavior and I added a circular border to the world. I released my game the first time (link in description of the YouTube video). [previewyoutube=ZiK9536UlYw;full][/previewyoutube] I coded my menu system, adding the first clickable GUI to the game. I added connections between cells, resulting in algae like strings of cells. [h1]2017[/h1] You can see in the previous video that the performance was really bad if you added too much stuff. I realized I have to bite the bullet and write a physics engine that suits my needs. [previewyoutube=lYMaN-VkA_A;full][/previewyoutube] As you can see the engine is not as stable as Box2D was, it has unstable stacking and tunneling problems, only supports circles without rotation, but it was a lot faster and this is all that mattered to me. [previewyoutube=jLVLDLMvClY;full][/previewyoutube] With the new physics engine I added cell features again. Different colors, gas from deep sea vents, eating gas and dead cells. I implemented a simple interpreter so you could write and modify DNA code without modifying the game executable itself. It used simple text files to store the DNA data. Each cell had two staemachines, one for DNA execution and one for behavioral code. [previewyoutube=7tdKj3784Lo;full][/previewyoutube] I added more species, with more colors, the first world editor tools were added here. I built myself a Zen garden and enjoyed it's slow beauty. [h1]2018[/h1] I knew the code had a lot of problems. The performance was slow, the GUI was ugly. All the videos were recorded and were sped up 20 times so it would be more interesting to look at. I spent a lot of time making videos, this motivated me. I knew the changes I needed to make were internal, would speed up the code a thousand times, but the changes needed were difficult to display in YouTube video format. So I turned away from the public and focused on the code, it's performance and it's usability. First I ditched the old GUI for a very lightweight and easy to use library called Dear ImGui. It is supposed to be a developer tool/debug GUI library but I simply fell in love with it. Second I implemented a fluid simulator. Spores can be so simple because the environment is complex and takes care of transporting them. [h1]2019[/h1] I tried to make the code even more faster. Previously all physics simulation used fixed point integers to be deterministic, I ditched that for floating point numbers. The Steam hardware survey showed that SSE3 adoption has hit 100%, so I targeted that. It did sped up the code but not nearly enough. I started to implement a GPU version, written in OpenCL. It did provide some promising results but the OpenGL interoperability was clunky and the user needed to install and configure an additional runtime as it is not included in most commercial drivers. [h1]2020[/h1] I started working on the current GPU implementation, OpenGL 4.3 with compute kernels. I had to learn modern OpenGL, mainly focusing on compute and geometry kernels. First I ported the circle physics (collision detection and resolution) then the fluid simulation. The performance was insane and I immediately realized this is the direction I needed to go. I realized I need to redesign the whole DNA code structure to be able to run on the GPU. I went trough five design iterations before I arrived to the solution used today. I did not give up and powered trough. [h1]2021[/h1] I added badly needed quality of life features. The ability to save and load game state. Compilation on Windows since I developed on Ubuntu the whole time. Optimized everything, developed better world editing and diagnostics tools. Fixed a tons of bugs. I felt amazing, the simulation finally felt like a game. [h1]2022[/h1] Development speed increased a lot since I felt I struck gold. Added even more features. Compressing the saved games to consume only 40 MB instead of 600 MB per save. Cell organelle visualizations. Added world generation, random DNA evolution with better species management. Added even more world editing tools and a tons of visualizations and markers. [h1]Future[/h1] This is where I am standing now. Cells are evolving to be connected even though they can not share energy. Development of features supporting multicellular life is my top priority right now. See you soon!