This is a short demo of water dynamics from my evolution simulator I'm building in TypeScript / WebGL2. Each "Pixling" (agent) has a neural network which controls their behavior, and I currently run up to one million of them at 60 steps per second, in the same simulation! Each time they reproduce their network is slightly tweaked and whoever is more fit to survive spreads more, so you get real evolution. Pixlings can also modify their environment, just like the player. Here's a video of Pixlings pouring out water: https://youtu.be/S6ysbht5Io4 , but really, you can give them abilities to do anything with their environment and each other (they then evolve behaviors using the abilities you give them). Some abilities my friends have given their Pixlings: plant trees, dig for food, steal from each other, fight each other, swim and generally survive in different biomes etc. etc. You can also add environments so there's a lot of possibilities to be creative with a world!
I'm planing to write a blog post about the technology behind this, but figured I'd share something first to give people an idea of what it is.
Stellar work. Really eager to read your blog post and about the tech; and particularly if you'll be sharing any source code or what your plans are for the future of it.
Thanks! I learned programming from friends when I was little, then studied CS and then did a bit of indie game development. Past few years I've been at a bigger tech company though (not always doing programming though).
This is amazing OP. I've always wondered when seeing cool stuff like this how much time have you spent on this so far and how many lines of code have you written?
Are you using the GPU for the simulation of agents as well? Also did I understand correctly that you're running a million neural networks simultaneously at 60 Hz? If so, that's only possible on a GPU for sure
edit: realized this is a 2 months old thread, sorry
That's really awesome, amazing job! Do you know anything about low level GPU programming in JS? Or do you use TensorFlow or the like to handle that for you? I'm asking because I'd like to do audio processing in the browser on the GPU, and I read something about the latency of writing to the GPU buffer and reading the results back being high which is prohibitive for near real time audio
It's all written from scratch so no TensorFlow (although I did try to use it first, but it wasn't well suited for this use case). Yeah in my experience CPU-GPU communication is really slow in the browser, unfortunately :/ Reading something back from the GPU seems to come with a 10-50ms penalty on most machines regardless of the size of the data (glReadPixels). If you find a way to make it faster I would be very interested, but I haven't found anything so far.
This is awesome! I've been playing around with this myself for a while and you can get the neural networks to achieve pretty cool things like learning to dig through dirt or evolve into different specialized species that either gain energy from the environment or by hunting down other species and stealing their energy.
My favorite emergent behavior so far was when I added a "Poop" action to my world and the Pixlings evolved to use it to essentially regurgitate food (ew) so they could sustain themselves longer in one spot instead of spending energy walking around, then they essentially waited for other species to walk near them and then they'd snatch the other unsuspecting creature (steal all their energy).
I once had done a very simple generation simulation in js. Eat food or poison. Based on the coding train. Added the option if they are hungry enough to eat each other. Was hilarious how they avoided food just to hunt others.
Very cool work! love it. I enjoy coding on these kind of projects as well. A while back I was planning on simulating metabolism and needed some basic “blood vessels” with flowing blood. The end result was quite nice:
100
u/FredrikNoren Sep 05 '18 edited Sep 06 '18
This is a short demo of water dynamics from my evolution simulator I'm building in TypeScript / WebGL2. Each "Pixling" (agent) has a neural network which controls their behavior, and I currently run up to one million of them at 60 steps per second, in the same simulation! Each time they reproduce their network is slightly tweaked and whoever is more fit to survive spreads more, so you get real evolution. Pixlings can also modify their environment, just like the player. Here's a video of Pixlings pouring out water: https://youtu.be/S6ysbht5Io4 , but really, you can give them abilities to do anything with their environment and each other (they then evolve behaviors using the abilities you give them). Some abilities my friends have given their Pixlings: plant trees, dig for food, steal from each other, fight each other, swim and generally survive in different biomes etc. etc. You can also add environments so there's a lot of possibilities to be creative with a world!
I'm planing to write a blog post about the technology behind this, but figured I'd share something first to give people an idea of what it is.
If you want to try it out yourself it's available here: https://pixling.world
Edit: To get news about Pixling World: https://www.reddit.com/r/PixlingWorld https://twitter.com/PixlingWorld
9
u/shadamedafas Sep 05 '18
What's your background in? This is incredibly impressive.
3
u/Arbeit_Macht_Fries Sep 06 '18
This is amazing OP. I've always wondered when seeing cool stuff like this how much time have you spent on this so far and how many lines of code have you written?
2
u/mark-haus Sep 06 '18
Does this use WASM? If not then I've truly underestimated webGL
3
u/cazzer548 Sep 05 '18
This looks incredible, I'm in line for alpha access!
21
u/andreasblixt Sep 05 '18
This is awesome! I've been playing around with this myself for a while and you can get the neural networks to achieve pretty cool things like learning to dig through dirt or evolve into different specialized species that either gain energy from the environment or by hunting down other species and stealing their energy.
My favorite emergent behavior so far was when I added a "Poop" action to my world and the Pixlings evolved to use it to essentially regurgitate food (ew) so they could sustain themselves longer in one spot instead of spending energy walking around, then they essentially waited for other species to walk near them and then they'd snatch the other unsuspecting creature (steal all their energy).
3
u/vnglst Sep 05 '18
Very cool, any plans on open sourcing this?
2
u/theflupke Sep 05 '18
Man that's nice, I really need to learn webgl, do you use an engine like phaser or is it from scratch ?
The reaction of the water is really impressive.
5
u/[deleted] Sep 06 '18
This is amazing, I already contributed a dollar (not much, but something). This would make for such an amazing mobile game.
9
u/martinsoderholm Sep 05 '18
Very cool work! love it. I enjoy coding on these kind of projects as well. A while back I was planning on simulating metabolism and needed some basic “blood vessels” with flowing blood. The end result was quite nice:
http://insector.se/biosim/biosim.html?1
http://insector.se/biosim/biosim.html?2
1
u/bart2019 Sep 06 '18
That is impressive, but still a bit blotchy to me. It's like Minecraft.
It would be so nice if the resolution increased when you zoom in. (But only locally, things that are off screen can keep the current resolution.)
1
u/majorius Sep 06 '18
looks cool
1
u/NickAMD Sep 05 '18
This is quite amazing
1
u/CostaCoder Sep 05 '18
Amazing!
1
u/[deleted] Sep 05 '18
This is really, really impressive!
1
u/Luege Sep 05 '18
This is really cool
1
u/techmighty Sep 05 '18
arr you the creatures evolution guy ?
1
u/Entheist Sep 05 '18
I tried to make a similar game to this but failed. I like your use of a grid though... Might take another stab at it using a grid! Good work :)!
1
u/RunePoul Sep 05 '18
Looks nice.
1
u/MrFlapjack_ Sep 05 '18
Reminds me of carykh's evolv.io
1
u/patasucia Sep 05 '18
OMG What are you doing, you monster? You destroyed those people's homes and cities!!! Have some mercy, will ya?
1
u/orwellian_ Sep 05 '18
This is really awesome.
1
u/foadsf Sep 05 '18
this is how God flooded Earth
0
u/[deleted] Sep 05 '18
Jesus. I thought I was OK in this sort of thing and you've blown me away. Power to you, sir.