[WIP] EcoPico V0.0.23- Prototype (DOTS) - Making Creature

Here I would like drop some light, on one of my experimental project, while playing with Unity 2020 and DOTS.

At current state there is no fun factor as of yet. Mainly working on stable mechanics. The goal is, to control evolution of life instances, by directing “genes mutations”.

[V0.0.21 (Hexsphere planet intergration)]( [WIP] EcoPico V0.0.23- Prototype (DOTS) - Making Creature page-2#post-6471983)

Link in case, video pn the forum is not accessible
https://forum.unity.com/attachments/upload_2020-10-29_22-6-23-png.726434/

Earlier V0.0.7 (Testing hex planet and lifeforms)

Earlier < V0.0.7 (Lifeforms testing)

Earlier V0.0.3

When more is to be presented, I will post an update.

The birth of this project was derived, from my main project, which I was working earlier
[WIP] Hovercrafts Sandbox Prototype
However, since Unity DOTS evolves quite rapidly and I still learn it and most optimal pattern to work with, I decided to work on something, which I can experiment. Also, developing features and utilities, which I can use later in my main project.

Even this small project, it is quite demanding, while looking for best approaches.

5 Likes

I had posted for initial feedback few weeks back.
** Feedback Friday #83 - October 11-14, 2019 **
** Feedback Friday #84 - October 18-21, 2019 **
Quite a bit has changed since then.

But this time creating this thread.

Among multiple challanges, I wanted to figure out, best approach for rendering meshes and shaders, with parameters, while using DOTS. I have had created following discussion for that purpose, which allowed me to resolve major issue.
** How to correctly set up Shader Graph for MaterialPropertyBlock? **
That not to say, rendering is done. I want to step up a bit further at some point. But I got massive improvement already.

If anyone is interested, I have also other older vids from this project
V2

V1

[/spoiler] [spoiler]

V0

[/spoiler] [spoiler]

2 Likes

Cool, I love this sort of stuff.

I’ve been contemplating some kind of eco system sim to do after my current project, been wanting to do one of these for a while now, how does the gene mutation work?, a modification to the health/speed/whatever stat each generation?

I’ve thought of a system where creatures have some kind of intellect level that they can increase by doing stuff like interacting with the environment and discovering things and the higher intellect level allows them access to more advanced actions in a GOAP type system, this also goes well with a social system where creatures can create tribes/packs and learn from each other, passing on knowledge and so on. (and you still have like a lone predator teaching the baby how to hunt thus raising him to his intellect level and let him continue accumulate)

1 Like

I was going back and forwards with eco games for years. Been building some simple simulations, with different tools over past years. But just now, with DOTS, it struck me, this may be actual something interesting and possible to build.

I have played multiple prototypes of different peoples, so I see how they approached such problems, I will be facing. None however I have seen, had placed whole thing on a sphere.

For now gene mutation is rather simplistic. I didn’t went for sexual reproduction, but rather asexual. Just like cell divide. Weather I will go for sexual reproduction, by mixing DNA, I am not sure yet. Definitely mutation would then be, within group of similar specie.

However, now mutation is done on randomization of each gene. Game can mutate each individual gene by increasing or decreasing properties. Or order to not mutate. By default direction of mutation and the factor is random within a permitted range. Each new offspring is mutating.

I want player, to be able have certain degree of control, on mutation of selected group. Then allow evolve

I was thinking recently, to add at some point brain and neural networks, for intelligent species. Then they will learn by evolving. But that may be still ahead I got algorithm for NN anyway, which I was working before and can teach at runtime by players. I don’t use Unity tool, which is python bonded. However, first, I would go with simplified mechanics, using Utility AI as per discussion in attached thread.

How I will approach this problem not sure yet. I got tons of idea, but I focus only on immediate steps, to not go astray with, too far :slight_smile:

Social behaviours would something cool. Like flocking etc. If I use boids algorithms and NN brains, I think that pretty feasible.

Another thought, but rather difficult at this moment, is to make plants being able to grow, something like trees. But I may just stay with simplification, of height. If I could come up with better DNA structure, I could mutate anything with anything.

Also, I may actually voxelise species. For example, instead base structure of creature / plant to be a mesh, to be blocks. Then I could create some interesting formations. Tree could for example loose branch, or gain a branch in next generation mutation. Animals could have more / less motor mussels, allowing movements. All in simplified form of course. Maybe I will make kind of each voxel as relevant functional cell. But again, I would need have redefine DNA concept. For now, I am not marching in this field. But is heavily in my mind.

At current, herbivores can technically be also plants and vice versa, if they got relevant genes, to generate food from the sun. Plants produce food faster, but metabolism is generally slower. That however can be enhanced by relevant mutations. In fact, sun position affects photosynthesis. In night there is none. Movement will cost energy. Is not yet implements.

Greater challenge is, how to make sure that plants / animals hybrid are not too OP :slight_smile:
I need figure out some sensible penalties system. Photosynthesis is good step toward direction.

Another though is, since I don’t consider using shadows as factor for reduced photosynthesis, how to give benefit for plants, to grow higher. I could take just higher plant, then it become more efficient. That kind of sort I got now. Then kind of grass, which is low and flat, but wide. How can it get good benefits.

These all are thoughts of course. Some may just stay as thoughts.

On side note, planets on vids are between 15 to 25 radius. I hope with DOTS, to allow make them bigger, to be able populate planets. If species can evolve bigger, then could expect have pretty big creatures / plants there.

On side note 2, by default, I am not allowing for cannibalism. :slight_smile: Saying that, if DNA difference is close enough to the threshold, then life form is treated as same species. But I plan also add this factor to DNA pool. Is just not linked yet.

Edit:
I think I have figured out, how I could make cellular/voxelized based DNA :stuck_out_tongue:
I will grab some concepts from my Hovercraft projects.

2 Likes

Nice bro, love the concept :slight_smile:

1 Like

This time little show case, of life instances, where cells now hold specific functions.
For example green are leafs, generate energy from sun, via photosynthesis; Red are herbivores, which eat plants, of other life form; and blue, none functional yet, mussle, which should permit to move.

While cells are randomly generated, structure of 12 cells is atm predefined for testing.

I will add more types of cell of course. Also, I want certain types of cells, to best function at certain location in the life form. So for example green leafs should be most optimal on top and then sides. But not inside of life form.
Movement mussle should be best near the ground (at the bottom). Sight cells similar as leafs cells. And got few more in plan :slight_smile:

I play this on small planet for now.

This wasn’t really planed to implement yet, but was drilling my mind so deeply, I decided to implement it. I had to add and test few new systems, to support such mechanics. I managed to break couple things. For example highlight, since I changed, how cells are rendered. At current each cell is rendered by same material, with shader parameter, to change color. I may add at some point texture options. But I improved by chance other stuff. In general I am happy how it work so far :slight_smile:

One thing current changes have affected, is stable evolution, so I need rebalance things, to playable state. No big deal, by every little adds up.

2 Likes

Update for version 0.0.6.

I wanted this update earlier, but I was away for few days.

Either way, much work has been done, to streamline evolution and mutation process. A bit of tinkering was involved, to find optimal solution. I refactored some of code, which allowed me to break things. But fixed now. (I think) :slight_smile:
Probably many iterations there will be ahead, but at least I am much more happy about how it is.
There are certain things, which I still want to resolve.

I this iteration, I allowed my new life forms to evolve, by generating new cells. Each cell type (color) has special abilities. Green is to convert sun energy to food. Red allow movement, which can be seen later in vid below. Purple is like stomach, which allow store more food. Etc.

As I already indicated, green plant cells, will be penalized, when light will be obstructed by other cell. Then that will allow, to mutate existing cells, to different cell. Or grow new cells around existing life form. Growing of new cells is permitted in any direction, other than below the ground. I am not considering making roots, like plants.

One of challenge with evolution and mutation, I want preserve energy conversion of the world. Meaning, I don’t want extra energy be added, or removed by accident to the world. I have described briefly in some previous post, that atmosphere affects how many plant creatures can exists. Performance can be improved with mutating photosynthesis, to allow get more of energy from atmosphere. But amount of available energy to spent is limited.

Then death of course returns energy to ecosystem. Other creatures like herbivores and in future carnivores, will act as energy conversion, by eating plants for example, and storing in themselves. Until they die of course, or getting eaten, moving energy to different form.

As I work with DOTS, I would like put as much code on burst as is feasible. Birth of new offspring requires much of optimization. Also I have some systems, which I temporary disabled burst, for testing purposes. Also, I am trying work around determinism, so using this project as testing ground.

Some shader modifications was done as well using Shader Graph, to life form status, to contain few more information. For example, how much energy is required to next growth of life form. Or how much energy is required, to allow new offspring.

With current shader, I don’t know yet, how to add shadows. They don’t work :frowning:
Is not that critical, but could be nice to have.

Obviously, shader status need be higher, as is clipped by the planet surface, which hides info. Also, first cell need be also higher, as it is too low in ground.

There are other issue along the line, which I want to resolve, but will come in time.

2 Likes

Ops, it become a bit messy :stuck_out_tongue:
Result of changing few mechanics.

In meantime, I decided to spend a bit time on bugs hunting, ensuring game is stable.
Also I changed couple things behind the scene, which appears behaves much better. At least cleaned up some code.

I have fixed highlighting systems, so that should work in some next video.

Fighting with one irritating bug.
Unable hunt down the reason, why after approx 5 min of runtime, I got one entity become position NaN. I need to catch the moment of such occurrence.
I keep searching.

1 Like

Nice work bro, you got this…:slight_smile:

1 Like

Previously had issue with AABB throwing error, due to entity position was NaN. I did couple changes, including Unity restart. Positive side is, game was left for 45 min, with no crash so far.
But I found that ECS seems does not like interaction in editor UI elements at the same time. When selecting Unity editor option at runtime, it pauses the game. And DOTS threads are still running at the same time. So I suspect that is the issue.

That push me for quicker implementation, of rendering selection options, as I couldn’t control reliably this option setting from Unity Editor. Now option allow to choose rendering meshes FactionMarker, Cells, Any, None.

Colors of faction show, how life instances invade space of each faction.
I am still thinking on best approach, to render only selective faction.

I have also slowed down movement of entities, with herbivore component. This is more alike I want, with freshly mutated movement gene. Later I will allow to move faster, if mutation will take in place accordingly.

Of course, clipping through planet is still present. Haven’t touched that problem yet.

1 Like

Clipping through the planet is a prob, but the ONLY one i see. The render only selective faction should solve a few probs.

There is few clippings through planet. Depending on location. Is because sphere is not ideal sphere, it has flat surfaces up close. I probably would need increase number of sphere polygons. Then increase altitude by a little of faction icons.

I won’t be touching for a while the overlapping of factions icons. I got some ideas, but I leave it, for better time :slight_smile:

I just look at frame rate, it should be higher. I have switched off/on somewhere, with recent changes. Also, on recent vids, I run accelerated simulation, so I can stress test and easier look for bottle necks.

1 Like

Little update more just for fun :slight_smile:

Let them be and they will take most of the planet. Effect of growing and expanding nearly 7k life forms. It looks like suburb town was resounded by large skyscrapers.

Edit:
Additionally few bugs squished in highlight system.

Well, implemented light shading.

Is not perfect, since for now planet does not block light, but generally works with sun position. However, now life forms can be easier recognized, what is where. Before meshes without light shading were kind of merging visually.

The thing is, since I use DOTS with Shader Graph, and Universal Rendering Pipeline and Unlit Master node, I had to implement own lighting effect, considering light position.

Camera at lower altitude, below atmosphere.

And when is a bit darker.

The obvious immediate issue now is, is too crowded :slight_smile:
That not planned effect. I will need tackle it.

Another issue having, is highlighting during the night. Atm. is dark / bright as other meshes.

Past time, I also reworked a bit genes, hoping to be more friendly later, to work with.

Edit:
Improved overcrowding matter.

Is not ideal and will require further work, but is much better. Recent changes reduces probability of overlapping new life forms when they are born. It still may happen, but mainly because of multi threaded jobs. If the issue become critical, I will work further on that.

1 Like

How will you deal with the “crowded effect”? Also is light a big factor?

Every new born life form, checks for available space to grow. If is occupied, meaning, if is too close to existing life form, then that offspring is discarded. To deal with existing occurrences of two offsprings in same space, I will need execute new offspring system single threaded, rather than currently multi threaded.

Currently, I could just add single line of code, to trigger it. But for now, I keep as it is, until I will make sure I am happy with performance of that particular system. So far I am :slight_smile:

There may be something I don’t know, or don’t understand with DOTS and custom rendering mechanics.
But as far I am concerned, to allow changing shader properties, like color of blocks on each life form, or energy, food etc status bar of each life form, I need use Unity Graphics API. Additionally with that, I have been advised so far, that with Sader Graph, only Unlit Master node work, not PBR Master note. That means, I need manually handle any shading effects, which normally we take for granted, when dropping light source into the scene and few cubes. All shading and shadows are taken care for us.

But shadows are least of concerns for me atm.

Growing my new hair.

  • General a bit of work, for moving life forms and some testing.
  • Movement requires now muscle cell within an organizm.
  • Few additions and fixes to UI, allowing display summary of genes.
  • But discovered another bug in meantime, should be rather quick fix.

However, past few days I was mainly focused on my older side project:
[WIP][DOTS] Octree (U2020.1a - Entities 0.2).
Which was old as 2018.3.

Now will be about time, start focusing toward fun factor.
I suspect, this may be a bit challenging, for such type of game.
Got some few thoughts about direction, and unless I wont be able to decide, I may make few options, as game modes. Or some sorts like that.
Plus eventually kind of sorting data that is displayed in UI.

I would like of course add more genes and cells in future.
But still improving current mechanics, keeping resealable balance.

Ah, and still chloroplast cells need receive their handicap. Too superior atm:)

Very interesting project, I need to start messing around with DOTS. I have always been interested in making a project like this mixed with rts elements. In any case keep up the great work, looking awesome.

1 Like

Thx for kind words.

To be honest, I don’t know what genere that project would fall in:)
I suppose it could be RTS, if I put enough strategy elements into it.

I think is really worth it in long run. It will be requiring quite a bit of time, to spend learning it. But once it is past, rest comes much easier. The only downside yet, DOTS still evolving, so is prone to changes. Maybe Visual DOTS could soon accelerate this process.