Unga Munga, survival of the smartest

As I am asking for a lot of help here lately, I thought it would be nice to share some stuff I have been working on. This is Unga Munga, survival of the smartest

It is an experiment with neural networks build into a game. The player can train his tribe of little prehistoric people to survive their encounters with other tribes.

I started coding in Javascript and ThreeJS, but I decided I want to make this available as a mobile app, so I switched to Java. I selected JME because of the IDE and engine in one - I am more a creative than a technician and don’ t want to be bothered with compiling and installing a string of dependencies.

Though some stuff is a lot harder in JME than it was in Javascript, I hope the video shows I am mainly having a lot of fun with this engine.

17 Likes

Very nice. Is there also a training UI?

Also, how did you generate that terrain?

There will be an interface that will let you set the selection criteria for the next genegation. There will also be a graph to show a real time brain. Maybe I will let the player mess with it directly.

The terrain is just a hand painted heightmap with a modified terrain shader that does the texture blending based on the slopes and height.

1 Like

I now have created a planet for the little guys to live on. It is a polysphere that consists of evenly distributed points on a sphere. Every point is connected to 6 surrounding points. The terrain generator makes use of this geometry.



I am currently working to perfect the terrain and water shader I wrote.

The shaders will need to support raising and dropping sea levels and temperature variation. They are a bit more tricky because they need to take into account that they are for spherical objects instead of planes.

16 Likes

This looks really cool, by the way. Somehow very distinctive.

2 Likes

The shaders of the little planet are steadily nearing what I had in mind:

The terrain shader take some parameters that can be used to mimic the climate: it can be hot, dry and freezing. The water shader now has foam at the shores.



Something I learned making the terrain textures: let the normal map do light and dark, use the color map for colors only.

8 Likes

Might want to share how you implemented the foam at the shores?

Sure, the biggest challenge came from the world being a globe instead of a plane. That made it impossible to use the existing water shaders.

Foam turns up where the water hits something sticking out of it - like land. The foam I have implemented at this point, is at the shores. The shader needs to know the depth of the terrain to decide where the shore is. To tell the water shader about the terrain, I added an extra vertexbuffer holding the hight of the terrain at the corresponding position.

the vertex shader takes this height, calculates the depth by subtracting it from the water level. In the fragment shader everything below a certain treshhold - 0.1 in my case - gets white added.

6 Likes

cool solution

Here you can see climate and sealevel animated… and the little guys are back…

Btw: not sure why the video has a stutter, on screen everything is smooth and super fast. At one point I even had 1000 guys with huge brains running around.

8 Likes

nicely done. Last error i understand is because you incorrectly close app.

i see some shadows issue on your video. It might be worth you use proper shadow renderer(there were 2 ways as i remember) or just manipulate its parameters.

Also some trees have like missing faces, but maybe its intented.

About micro-freeze it might be because of Record App. Try OBS maybe.

There is a lot of fine tuning still to do. I use a very small shadow map, that does not help.

The trees have a texture with varying alpha and a displacementmap. The latter seems not to be doing much so I need to look into that. Later on I will write a special shader for the trees to get a wind effect. Together with the alpha and the displacementmap that will give the impession of seperate leafs.

3 Likes

A new video of Unga Munga. This one shows evolution over several generations and demonstrates the rotating cube interface:

How the game works:
At the beginning of each round, a new generation is born. After a number of seconds set by the player the round finishes and survivors are selected based on criteria set by the player. The criteria have two components: there is a knock out criterium that all survivors have to meet. And there is a fitness score by which the survivors are ranked to determine who gets to reproduce.

In this video guys who are not in the water survive, and are ranked by the elevation they have climbed to.

The past few days I have been experimenting with different brain architectures. I now have one that stays healthy and seems to learn though it does take time. It consists of three fixed layers and every neuron has a fixed number of connections to the next layer.

Currently the brain processing does not take up a lot of time. The graphics and 3D operations cost most of the time. Because I want to speed up the evolution process I am now considering using threads to do the thinking independently from the graphics. However, that might ruin the game-experience.

Another way to go is to find a way to get evolution to need a lesser number of generations to achieve goals.

Anyway, this will not be an action game. It is for the patient player. Most fun I am having is when I return from a coffee break and see how my little guys have picked up new habits.

8 Likes

Last week I did a lot of experimenting with grass. I wanted the grass to be high, so the guys can hide in it. And I wanted it to respond when someone is walking around in it.

I now have grass I am pretty happy with:

4 Likes

Oh wow, that looks awesome.
I am also working on grass for my editor.
If I may ask, which grass shader did you use? I am in need of one.

I wrote my own, since I use a globe world, I need shaders to take that into account.

1 Like

Here we are again with a new video. This time I wanted to show of my waving grass and trees and the new terrain shader.

In this video I also demonstrate a basic training session. In the training sessions every generation lives for a given time. At the end of each generation, the survivors are ranked by their fitness and the fittest (top 50 in this case) will get to reproduce.

I set the fitness criterium to Attack and within a few generations we witness increasingly more aggressive behavior.

6 Likes