Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Evolution Simulator Beta V1.0

Author
Message
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 24th Oct 2017 07:27 Edited at: 2nd Nov 2017 03:14
Hi everyone I would like you to check out the project I have been working on for a few weeks now. I set out in an attempt to make an evolution simulator so that I could model roughly the way nature perfects the feeding mating mechanisms of creatures. I attempted to make use of an Artificial Neural Network which I have sort of done by engineering one of my own design. I had issues totally understanding NN at the time I started working on this so I set up my own form of a network in order to control these little creatures.

There are 4 inputs currently that the creature can receive through its vision which I made by placing a triangle in front of the creature and using that as its line of sight, Whatever is in view of the creature determines how it will react. Its four inputs are Food, which are the Cones setup representing plants that the creature eats, Mate which are creatures of the opposite sex, Males being the larger and females being smaller creature. It can also be an enemy which is a creature of the same sex that competes for food and mating resources.

The rules are pretty simple and basic, If they run into food and eat it they get increased energy, if they mate they produce offspring whose Weights for their Network are averaged with both parents M/F. The color is the color of the creature that initiated the mating process with the possible mutation here or there. The color slowly may change as well as the weights due to a slow change through mutations. As they Age or if they Fight by encountering an enemy they lose energy and when that energy = 0 they die.

When a creature is born it takes its parents Weights(thought pattern), color, Field of view, Distance of sight, Turning speed, etc... The creature TYPE is structured as such,

type creature
sex as integer
position as vector
X,Y,Z
kingdom as integer <-- soon to be gone unless I find another use for it.
Neuron as input_type <--- Will go deeper into detail in a moment
speed as integer
age as integer
fitness as integer <--- For future implementation
distance_moved as integer <
COLOR as integer
health as integer
fov as integer
sight_dist as integer
turn_speed as integer
endtype

type input_type
val1 as brain // food
val2 as brain // Mate
val3 as brain // ENEMY
val4 as brain // Wall <- Not yet added completely
endtype

type brain
value as float
w1 as float // Up
w2 as float // down
w3 as float // left
w4 as float // right
w5 as float // nothing
endtype


The Neural network takes the input from what the creature sees and breaks it down into currently 5 different reactions the creature can perform. They can go forward towards the object it sees, back away from it, turn left, turn right, or do absolutely nothing.

There is also the default, IE: what the creature does if it does not see anything at all. All these values are integers between 1 and 10000. Originally it was between 1 and 100 but I raised it for precision reasons. If I am to redo the code I would make all these float values between 1 and 0 and multiply it by the results that I want but this code was literally thrown together, changed and rechanged as I experimented with it resulting in the code I have today. It started out as something totally different and just an offshoot of the project I was working on but quickly just became the main code I worked on so I pooled the other project in with this one instead leading to more then a few headaches and relatively bloated code but I have managed to bring the code base down to a reasonable level so its all good at the moment.

I am honestly quite happy with how it is coming together, If I average all the weights out to 20% chance of any action taking place over a few generations only the strong survive. The ones who weights shift towards backing away or turning away from enemies to avoid losing energy and living longer quickly take over. Those that live longer have a greater likely hood of reproducing so those which turn towards mates are the most common survivors.
The difference between when it starts and after they have been learning for a few hours is astonishing. I generally leave this running over night and love waking up to find out that they have formed clusters of different species with different survival skills and behavior. They almost always go towards food and mates and away from enemies since what we are really doing is essentially creating a very complex mathematical functions to find the lowest gradient in a complex multidimensional formula and each species is a small valley in that graph. They tend to pair bond which I find interesting. Over night I wake up to find couples running around together, sometimes threesomes and five some as well. If by chance their speed falls into the negative numbers the weights for going towards and away evolve to reverse their patterns to ensure they still move towards mates and away from enemy.


I am currently working on another Neural network program which is more standard and soon I want to add that to this program so that my creatures can learn as they live instead of learning being a species only deal. I want to form a neural network in which my other project, NORMAN, which I included its source code here

NORMAN

as a means of adjusting the weights of the creature as it lives. This will increase learning exponentially. The results are going to be amazing when this happens because it will be like HTM Model Neuron and ANN made a baby and produced my creatures. Mine act similar to the HTM Model with every creature being a single Neuron with their ability to survive classifying and giving feedback to the network as a whole. They provide the feedback and context to alter the weights on the next neuron or in this case generation. The ability of my program will be great if I can manage to produce what I wish to in this limited environment I have to work with, this isn't the fasted programming lang in the world but its honestly impressing me a lot more then I expected.



I Hope you enjoy it, This is the start of something much larger that I am working on this being meerly the engine behind it. I hope to soon have two main developments in the future, one being simple Physics so that these creatures will have to traverse various terrains allowing me to add different features such as strength, stamina.

The second and most exciting to me that I am currently working on is fractal based creature development. This will allow me to add a form of DNA from simple basic numbers that will control limbs and movement. This combined with the physics and the Neural Network NORMAN that I will soon be attaching to the weights on this Neural network will allow my creatures to start off with random limbs and random movement and through genetic algorithms develop their own forms of Locomotion.




Some other interesting Evolution simulators. This being my favorite so far
Plant Evolution Simulator
At the end he shows that the trees have begun to develop the spiral pattern that we see in nature as It appears that it must be the most energy efficient means of gathering the most light in the smallest of areas.

This shows what can happen when a Neural Network is placed on a creature with Nodes and Physics, I eventially want to make my creatures do the same
I love how these learn their own locomotion

CaryKH produced a few nice Demos a few years back
CaryKH Creature Evolution

Some more on the more developed end of the spectrum
Bipedal Locomotion AI

Last but not least The all mighty AI Google Deepmind
Deep MIND learning Parkor



INSTRUCTIONS:
Start off and Enter the amount of creatures you wish to run when prompted. I generally only have around 100 for 25 FPS but my computer is terrible and I was running around 600 or more on my old computer until it crashed. This is just a system with only like 2gb of RAM which I pulled out of storage in an attempt to fix my laptop. I would love to hear how many FPS everyone can get on their system and what the upper limits are on a semi decent computer.

Next you will get some basic instructions at which point you can enter R for randomized creatures(My favorite), E for all the weights being set to 20% meaning they have a totally even chance of acting any specific way at any given time.

If you press T you will enter the Creature Trainer which is really all this was suppose to be LOL. There are 4 items with you controlling the center sphere with your arrow keys. The line of Sight will tell you what creature you are looking at and your actions will determine how the creature reacts. If you go towards food and mates... The two bottom items and away from the Top two when they are in your view that is the best case senerio. If you attempt to teach him to go away from food, woman and towards fights their is good odds your civilization will soon collapse. After you got it how you like it press enter and start the show.

You can use Arrow keys to move and mouse to pitch the camera. P pauses it and gives you the average stats at that time. If you use the mouse and click on a creature it will give the stats for that creature as well as allow you to see its line of sight. They produce some odd lines of sight at times. Some long some short, some fat etc... you will see.

That's about it. I should have Vbeta2.0 done in a couple weeks so stay tuned I will upload them here to this thread as I make and significant improvements.


[EDIT 10/28/17]

Updated-
-Fixed bug that was making them blind so now they behave correctly,
-Changed the Weights display to show an over all Average of all the creatures,
-Made the display of stats such as sight distance, avg health and average age ,FOV ,speed ect to be displayed at the bottom graphically
-Made a graphic at the top right showing the dominate creature by color.
Currently disabled food but will be back shortly.
-Added Blocks to act as a maze for them to traverse.
-Added New maturity control in which a creature can not harm nor breed until it reaches maturity allowing clusters of species to form. Generally 2 or 3 species will form until one dominates the others.
-Added- There is typically a small mutation rate that slowly morphs the creatures into a better form but currently is set up that 1 out of ever 1000 will be a true mutant and have totally different DNA then its parents in order to add variation to the mix and push evolution forward. If the mutant is better then they will take over but as with nature as well more then likely the mutation will not be helpful and they will die off rather quickly.

[UPDATE 11-1-17]
-Added more to the graph in the top right so you can watch the progression of species
-Added a Mutate feature, by pressing M you can randomly change the weight values of selected creature.
-Cause the Walls and the Food to randomly spawn around the creatures at updated intervals in order to ensure creature learn how to handle them and not just chose to avoid them altogether
-Added Collision weights to alter the way the creatures react when coming in contact with various objects.
-Fixed Camera controls slightly with further improvements coming in the near future
-Added a finder which hovers in front of the camera and points towards the creatures if they wander off which tends to happen from time to time.
-Added Speed Control, The FSP can be speedup or slowed down using the + and - Keys
[EDIT]
Some people may need to also download Visual C run time libraries for this program to work.... Hoping to find a way to fix this in the future so only the EXE is required.
Added MSVCR71.dll
Added MSVCP71.dll

Attachments

Login to view attachments
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 24th Oct 2017 07:37


Currently pretty long, 1000 lines or so but could be cleaned up a bit. I just been wanting to release this soon as possible because I have been saying a couple days for a few weeks since I started working on it lol. Enjoy and please please give some feed back, I am extremely new to Darkbasic and don't know half what I need to with this lang. Hell This is missing the all important Save creature feature that I want because I started to work on it today and realized and don't know squat about File IO in DBPro so any help in optimization mainly would be greatly appreciated
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 24th Oct 2017 16:42
I noticed a bug in the most recent version, the one I just released, in that they gather so much health from the food that after a couple hours they essentially become immortal and seriously slow down the rate of evolution so I think today I am going to go into the code and make their Health a function of their age. As they get older I am going to set it up to make them lose health faster that way as they start to learn how to behave the difficulty increases and puts more evolutionary pressure on them because as it stands on this version they start to stagnate after a while since new creatures can not be born if the old do not die.
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 25th Oct 2017 06:56 Edited at: 25th Oct 2017 06:59
Made a few fixes and improvements on the original version will upload the updated version soon as possible. Made graphs showing average creature stats such as turn speed, speed, sight distance as well as made it hard for them to stay alive in old age yet you can clearly watch the average age and average health slowly rise even though they lose health at a rate of Dec Health, Age / max_age... so as soon as they reach the max age they start to exponentially lose health faster and faster and yet over time the average age still climbs showing the learning process.

Also in the top right corner you can see a graph showing all the creature colors and watch as they slowly take over as they learn. The bottom two are average health and average age on far bottom. The green bar is the highest ever and the red is the average.



Attachments

Login to view attachments
Kevin Cross
Valued Member
14
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 25th Oct 2017 12:44
I started reading your post yesterday at work and before I knew it I'd spent about an hour watching YouTube videos related to evolution simulations and whatnots. Was totally confused by it all but intrigued too. It all looks fascinating and interesting. Your project does too, even if I don't understand it >.<

Would love to see videos of your project in action if you produce any.

Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 25th Oct 2017 18:07 Edited at: 25th Oct 2017 18:31
I plan on making a video of it soon as possible. I'm currently trying to work out any bugs that I might find in the system. Its like I remember one of the people doing a lecture on AI saying in that the hardest part is you have to think of all the ways that your AI will attempt to cheat. Mine currently, since I changed the system and the food vanishes when they touch it, have all resorted to spinning in clockwise or counter clockwise circles as fast as they possibly can go. They max out their sight distance on every occasion and kick their speed up to something unreasonable. I want them to still seek food and mates and not run around as fast as possible like a chicken with its head cut off. This happens after I leave it running all night but I do give them credit, you can see on the bottom graph the average max lifespan has risen dramatically even though it should be exceptionally hard for them to keep up life at that age.

I set it up to reload all the creatures if they all die off and found that when all the weights are set to 20% they die rather fast since everything they are doing is essentially totally random but after about half an hour of trial and error they figure it out.


The hardest part I am finding in designing this is that Darkbasic does not allow you to open a second window which I wanted to use to place the stats, that is really really bugging me. They are in the way and i don't like it.

Attachments

Login to view attachments
Ortu
DBPro Master
10
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 25th Oct 2017 18:18
I'd like to see more speed control. It's running at nearly 2000fps and half the creatures die before I hit pause to examine anything and you can't really follow what they are doing in real time.

I don't want to just cap the rate, it is nice to flash forward at times, but id like a dynamic control during runtime
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 25th Oct 2017 18:32 Edited at: 25th Oct 2017 18:37
Holy S***... I knew my computer was terrible but 2000 FPS, How many creatures are you spawning in? I set it up in the start to adjust the amount of creatures that could spawn because I anticipated other people systems being able to handle alot more then this computer from 2002 can handle but I would have never guessed 2k FPS. Hell even when they all die mine only hits around 175. I will see what I can do to limit the frame rate a little. Until then you could always push the limits and spawn 1000 or more creatures and see what your system can handle before it gets to a reasonable 25 FPS. Im curious what a good system can do.... God I miss my computer
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 25th Oct 2017 18:53
Here you go Ortu, I set the sync rate to 30 which may still be a little fast but the creatures also respawn if they all die as well. If it still is a problem I will make their max life longer or make an input for the max life. I am interested in extending the maximum life anyway since it should give those who are better even more of a chance but I also worry it will make the worse ones breed more as well.

Either way let me know how this works. 25FPS seems smooth to me so perhaps that would be the way to go but I capped it at 30 for the moment.

Attachments

Login to view attachments
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 25th Oct 2017 23:02 Edited at: 26th Oct 2017 00:03
So many frustrations when working with this thing. Its like trying to teach a toddler not to touch a hot stove. My original version always leaned towards going towards mates and food and away from things that hurt like enemies. I made some minor altercations right before I posted it here and now it seems like they go the opposite way and its not making sense to me why they are learning to behave the way they are.

Hardest part of all is that I have to run it for so long to see how well they are learning meaning I wait for hours sometimes to see how various changes worked.
Mage
11
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 26th Oct 2017 00:53
It's always interesting programming AI. I remember when I first programmed AI it was a character that was supposed to turn to and follow the player. I coded it all in one sitting without testing it. When I launched the game and tested it, the character turned around and started following me. It was a very surreal experience. It was like I just breathed a bit of life into this thing and now its looking back at me. This was made more intense since I only tested it after it was completely coded and working so no intermediary steps.
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 26th Oct 2017 07:54
I know exactly what you mean mage, Im sitting here trying to figure out why the creatures suddenly started self destructive behavior after I changed on little thing and altered the way they feed and lost energy and I am starting to think they may be doing it because the others of their kind can breed easier when their is open slots so if they kill themselves as well as the other enemy it allows 2 open spots for more creatures to breed..... I am not 100% sure yet what the hell is going on, I though forcing death would lead to furthering the survival aspect but its seeming like it may be leading to Altruism which is more of an achievement then an error.

My code is starting to get so convoluted I am seconds away from scraping it all and starting over attaching the weights directly in the array of the creatures as well as some other improvements that are just becoming to hard to do as I attempt to further this code. I added weights to trigger actions when the creature collides with something earlier and it was a nightmare to say the least.

I just really really need help with back propagation so I can make these things really intelligent instead of just having action based weight system that is generation based. I have spent all of two weeks not trying to understand backpropagation and my brain is just in a fog. Its nothing like when I was programming when I was a young kid and the solutions threw themselves at me in the masses. As I am getting older its feeling like my brain is in a fog and learning new things just does not come as easy as it once had. I feel like I may have it understood but I need to directly speak to someone about backpropagation to work out a couple misunderstandings I have in my head about it and get NORMAN working correctly.
Ortu
DBPro Master
10
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 26th Oct 2017 14:01
A couple of thoughts:

Death doesn't just affect the individual, it had an impact on those around them. What effect would scoring a penalty on nearby friendly units when a unit dies have on the altruistic martyrdom?

Units gather food individually, they have little need to rely on others long term, what effect would shared gathering towards a community stockpile have? Thus further, when older/more experienced units are more efficient at gathering, simply replacing them with a new born will have a negative impact on the communities capabilities.
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 26th Oct 2017 19:29
The creatures tend to breed in blooms only really limited by the free slots open for creatures to spawn. If given free reign they quickly spiral out of control despite my best efforts.


I think issue that I am having is converting over to cones instead of spheres to be honest. The collision detection does not seem to be working on a few levels. I don't think they are correctly seeing mates or food or enemies for that matter. It explains why everything went to shit right when I posted this because that's when I changed it.

Still obvious by the average age going up despite increasing difficulty is a sign that what ever they are doing is working and they are learning well, I just don't understand what is going on anymore.
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 27th Oct 2017 05:01
I believe I got it worked out but like I said progress is slow when it takes me over night to run as many generations as you guys could in a couple minutes. It seems one of the issues was making the creatures share DNA equally. I guess its not good to have smart people breed with stupid people especially when they share exactly 50/50 of the result why that would repeatedly lead to self destructive behavior and also why that would still allow the average age to progressively rise is beyond me but either way I stripped it down to bare bones to eliminate variables and am slowly in the process of putting it back together in a proper way.

Sometime next week I think I will post an enhanced and updated version. To make things even better its been a good day because over looking my neural network program NORMAN I found my problem. Its not the back propagation that was totally the issue, I accidentally placed + signs when I should have placed * and that had totally unpredictable results to say the least.

One week tops I will have a new better version.

Does anyone know of maybe a DLL or something I can download so that I can run multiple windows in Darkbasic? I really really need to get these stats to another window, It would also be great if I could Multithread things because I can run multiples of my program at a time with no hit to my frame rate.
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 28th Oct 2017 19:43 Edited at: 29th Oct 2017 22:00
Problem solved... I moved the sight handling algorithms to their own function but made a mistake in passing the variable showing what the object sees which means they are not seeing anything and it explains why they all spun in circles after a while because that was the safest path to breeding.

Crazy that stupid things like that can totally mess up a program and be over looked so well. Just a matter of Var1 = Var2 that I missed on accident go figure.


Updated the Creature.exe in the first post with the corrected sight function as well as some other implementations.
Soon will upload a version in which they also have weighted connections that define how they react once they indeed come in contact with various objects. Highly suggest anyone interested to download the new version since the original had a bug in it. They no longer run around aimlessly and their learning abilities are quickly realized now in a few generations.

[EDIT]
OMG I am so happy with the way they are acting now that I have the sight fixed. They are forming more complex behaviors. I have seen flocking creatures, loners, pair bonders etc... Its great. All because of the massive amounts of changes I made that a child can inherit in the process but never got to test until the sight got fixed. I love how its working now except for the part where once again they tend to wander off and after a few hours I have to go hunt them. I must change my camera controls. Currently Im just using CONTROL CAMERA USING ARROW KEYS command but that totally causes you to lose control of the camera so what I now need to do is make the camera controls something that I control which will allow me to find them once they go their own way.

ON TO PHASE TWO!!!!!!

Procedural generate creatures with Proceduraly generated limbs that include physics and friction. The locomotion of the creatures will be determined by their ability to learn to use their limbs which is going to add a whole new layer to the game. Imagine fractal based creatures that form 4 to 8 limbs of different frictions and it flails the limbs to produce movement. The ones that learn to move the best survive. This is where the game takes a hard right turn for the best and evolution will be something that the creatures produce depending on the environment I create for them. Its just sad that I highly doubt the system I am running on is going to be able to run what I am about to create properly but you guys should have no problem. We lost power last night and my date set itself back to the install date of 2005 to give you an idea of what I am working with. Wish me luck everyone and any help would be greatly appreciated. Now the fun part begins.
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 29th Oct 2017 03:05 Edited at: 29th Oct 2017 03:06
Here is a screen shot showing a few examples of what I am talking about, on the left side I circled the clusters of 3 two of one sex one of the other which is typical in many species. This is one of a huge amount of configurations that forms after a couple hours of letting them evolve. The right side is a totally different species. They were started at the same time yet took two different evolutionary paths as to what is the best way to survive. I circled the mutations in this picture. It is clear the mutants do not act as their relatives because they tend to wander off. The rest of them evolved to form a flocking behavior yet the mutations do not have this and instead are designed to perhaps act more like the first picture but since everyone else in their species is different they wander off eventually dying and not contributing to the gene pool much if at all.

Attachments

Login to view attachments
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 30th Oct 2017 03:57 Edited at: 31st Oct 2017 21:04
[video=mp4]I apologize for the quality in advance but I wanted to make sure everyone could at least get the gist of it without downloading.

I made a crappy video, I don't have a good recorder so I just downloaded a free one online real quick.

I included this video because it shows something really important about how my code works.

You can clearly see they are a flocking species, this goes on for the first couple minutes, around the 2:40 mark or so a Mutant shows up. For once the Mutant is beneficial. His behavior being so much different then the flocking species causes him to stand on the outside of the flock until he decides to dive in, around the 3:30 mark or so this new species takes over and the flock falls apart and their behavior is totally changed clear as day. This is relatively soon as well. They have not been training but only a few minutes at this point that the video takes place. Over time their behavior takes all sorts of different forms. I have some videos of the snakes forming which I find cool, if someone wishes to see it just leave a comment here and I will upload it. They form a pattern of Male/Female/male/female/male etc etc....and form a long chain. This chain breaks when a child is born and smaller chains form and start to grow. Its kind of cool to watch when you have a decent frame rate.

I am about to upload a version in which the + and - keys can be used as frame rate limiters to speed and slow down the program so that everyone can set it to their computer speed and what not.

[edit] File is taking a while to attach, will link it soon as its available.




IDK I may have to upload something to YOUTUBE but I would rather wait till I can get a mic for that and make at least a semi decent video :/
One of the videos in which you can see circles and chains forming uploaded Im having issues with the main one that this post is talking about at the moment

Attachments

Login to view attachments
Kevin Cross
Valued Member
14
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 31st Oct 2017 10:03
I don't think your video is embedding correctly in to your post because you've got a line break after the URL. It might also be because you've got an open video tag at the beginning of the post and no close tag for it.

I think it should just be like this:





I'm at work so couldn't hear if you were talking in it to explain what was happening but it looks totally confusing and fascinating so will try and watch it later.
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 31st Oct 2017 21:05
Yup, that worked, Thanks Kevin, This is not one of my favorite videos,

No talking yet, I still have to find my microphone for my computer before I can. It would be so much better then watching a bunch of cones run around like chickens with their heads cut off and no real idea what any of the numbers mean or whatever.

I have one that I actually really do like, It shows a rapid moving flock and around the 3:30 mark a mutant forms which starts to over take the flock, After a minute or so it has completely took over and totally changed the structure from a flock to more spread out groups. It sucks but for some reason that and only that video will not upload, it just keeps saying no file chosen after a couple minutes of waiting. Ill see what I can do. It sucks, I had one to show evolution, I made it like a time laps taking 2 second of footage every 10 minutes or so or whenever a mutant showed up in case it took over but after letting it run all damn night before I could save the video the power went out and I lost it . Sorry this crappy video is all I have so far but I will try to get a better one soon as possible.
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 31st Oct 2017 22:30 Edited at: 31st Oct 2017 23:56
Another video, sorry for the quality again, I will see if I can get a good recorder and editor later tonight. I did this video because Im trying to show how some species love to flock while others enjoy a more open experience, These start off flocking but instead of staying that way slowly mutate into a more open species. Its a relatively short video, 2:30 seconds, I tried to skip around turning it on when mutants showed up hoping to capture an instant change but none of them took hold instead a gradual change took place and they became one of the most open groups I ever seen forcing me to zoom out pretty much as far as possible to fit most of them on the screen.

Anyway just wanted everyone to see how their "thinking" controls the behavior of the pack. That's why when mutants show up a lot of times they get kicked out of the group and stay on the out skirts because they just don't fit in with the status quo.


Like I said, I am just trying to produce a few videos right now before I totally overhaul the system because I am currently starting to add physics and jumping to the system. The creatures may just get their vectors altered in various ways so that the distinction between species is obvious by more then just the color. I am not very experienced with dark basic yet and I really wish I could get good graphics with this engine because I know DBPro can do decent looking graphics if I knew all the commands needed.

Attachments

Login to view attachments
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 1st Nov 2017 00:11 Edited at: 1st Nov 2017 00:13
Just showing off a couple features I just added, I will upload it to the opening post as soon as I am sure there is no bugs in it.

First is the graph in the top right corner allowing you to see the species currently and past so you can watch as any specific one takes over or it all changes. An addition I happen to like quite a bit honestly. I think its cool to be able to see who has the most etc.

Also, I got really tired of them Quickly learning to just avoid the area with walls all together and hide on the edge of the arena so I changed the design of the system causing food and walls to constantly change positions randomly around the creatures. This not only forces them to learn to avoid walls and hopefully look for food but stops them from running far away as possible and getting lost. Hell I even made another addition to the program which is a cone that floats in front of the camera to point in the direction of the creatures because I would let them run over night and wake up to find them no where in sight.


LMAO, My Son said I am cruel and its sad because they are sometimes just minding their own business and he said I just drop bricks on them killing a bunch of their friends

Soon as I am sure its all bug free I will post it in the first post.

Attachments

Login to view attachments
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 1st Nov 2017 00:36 Edited at: 1st Nov 2017 00:39
All in all after giving it thought, My system for running AI is more then efficient to move the enemies in a game. Giving them the ability of sight and reacting to their environment . They are rather adaptive as well, I am about to add a back propagation system to my creatures, They are going to store their memories of actions until they get Punished or rewarded, If they get rewarded I am going to go back over their actions and strengthen all their weights, if it they got punished I am going to weaken all their weights making them capable of literally learning the longer they are alive.

I love this idea and it could be ported to something like an FPS rather easy. Imagine if you managed to shoot you enemy and he learned to not do that anymore or if he hit you he learned how to ensure to hit you the most. On an FPS the weights could be shared between all the enemies so the better you get the better they get when at the end of the day thats the goal of AI in the first place. To ensure good game play.

I see so much talk on pathfinder algorithms when its built into this system by default.
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 2nd Nov 2017 03:05 Edited at: 2nd Nov 2017 03:15
Updated original Program in the first post with some new features added.
It makes me happy to see the weights change so that whenever the objects run into a wall they go forward, It would see odd if not for the fact that when they see a wall they go backwards so the only way to hit a wall accidentally backing up into it meaning they are learning much better then I can do, I mean hell I try to use the Trainer feature and it takes generations before they are good enough to sustain a community year starting 50 random ones almost always is self sustaining.

I cant remember if I mentioned it yet but I have it so the + and - can now control the FPS in case it moves to fast on your computer.

I feel its time to add Predators since isn't that what evolution is really about, A cat and mouse game between predator and pray?

Feel free to give any suggestions on what you would like to see done here and I will try my best to implement it into the program.
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 21st Nov 2017 00:51
I haven't forgot about this project, I have decided to take it to the next level.... ERrrrrr Down a level, to 2 dimensions lol.

My creatures have always ignored the Y plan anyway so 3D has always been just a benefit of the program but was more in the way then anything when it came to what the Core of the engine was designed for. My initial 2D rewrite so far has been able to get over 10,000 creatures at around 30-40 FPS. Removing the limitations on how many creatures can spawn will highly alter the dynamics of the program without a doubt since I am not forcing the creature to breed only when an available Creature ID is open. I also gave it some thought and just because its 2D does not mean that I don't have to miss out on the cool 3D view of my little guys running around. I can certainly envision setting it up so I can zoom in on a select area of the pixel grid and see maybe 20-50 creatures at a time doing their thing since it would just be a matter of taking the grid data and translating it over to 3D. Since I already have the 3D engine setup that sort of thing would more then likely be trivial.

I started to convert it over to Sparky collision DLL expecting a boost in performance but so far I am sad to say I am not impressed

Despite all the talk of Sparky DLL being so much better and faster then the internal Collision commands EVERY test I have put it through so far has placed Sparky DLL at sub par to the internal collision commands. This contradicts everything I have heard so far about it so I will keep experimenting in an attempt to figure out what I am doing wrong (if I am doing anything wrong which I am starting to doubt)

Also I may just stick with the internal Collision detection and alter the means by which an open Creature ID is detected. Currently I quickly cycle though the Creature ID looking for an open Object spot an when one is found I use that for the new creature being born like this...

count = 1
while OBJECT EXIST(count)
inc count
endwhile


As soon as it finds an object number which does not exist it uses that for the new Creature ID and places the data there. As you could expect I am sure this has to have a significant impact on the performance when every cycle I more then likely have 2 or 3 at the very least Creatures Dying and being Born. It also has to slow down other important processes later down the line when I cycle through the creatures I have to.....

for LOOP_COUNT = 0 to MAX_CREATURES......
If OBJECT EXIST(count) ....
Do everything I need to do with the creature such as sight collision detection and thinking.....


These are all checks and rechecks I feel are slowing down the program so I have come to the conclusion that using the ARRAY INSERT commands I may very well be able to Boost performance by setting my creatures up in a stack and calling from that an exact amount every loop or adding to the stack with a predetermined known number. It should help eliminate what I feel is Lag code at two or three Critical areas of my program which should without a doubt boost performance.



Still Nothing I do to the 3D version will be able to get it to where I want it and 2D is the way to go. Its not as flashy but like I said I could always translate the data to 3D for a peak at what is going on in the world. 3D can not come even close to running 1000 creatures at 30 FPS let alone the 10,000 I am currently seeing. I have so many projects going on at once its not even funny but I have always programmed like this and when they all come together its an amazing day. I got my little game Battle ballz that I made to get my Kids into Coding and they have done well to help me with that....

I am currently working on a WINGUI type program that makes windows and Buttons etc Similar to Mages Widget maker. That is coming out great and looks so cool to gui_MAKE_WINDOW()... and be able to make a window with buttons text and soon scroll bars etc... which I am going to use as a module for prob almost every program I ever make in darkbasic since buttons and Menus are a must. I have always been good at various arts(Im a sculptor and painter on the side BTW with stuff in art galleries ) and am building the windows through tiny sprite fragments that come together to make the GUI for whatever program I am working on. The hardest part is making it Flexible so it can add to any program I wish.



LOL But enough of that, This is the AI Creatures Thread. I will post an update prob within the week with my new improved AI creatures. With the added boost in speed I will be able to add multiple Hidden layers to their brains as well as making Much more complex Inputs and Outputs so wish me luck.


I would like some feed back on this program as well. I want to know what you guys think I should do with this simulator. Anything I can add or do to it would be nice to hear. I know the forums are kind of dead these days but feedback on my various projects is highly welcome.
Ortu
DBPro Master
10
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 21st Nov 2017 17:56
Interesting behaviors shaping up, keep going!
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 21st Nov 2017 18:21 Edited at: 22nd Nov 2017 07:04
I'm still at it, It is such a diverse Field and Im a scientist by nature that I don't know if I will ever stop working on this project,

Like I said before once I get the 2D version up and running then I believe we will see interesting results, I feel that when two communities are separated by such a distance that they are unable to interact with each other is when the real magic will show up to be honest.

Then and only then will we get to see the results of true bottle necks and evolution at work as various communities evolve to their area and split up/combine etc. Currently I see the results of a single community since the limited numbers forces the best one to over take in VERY short amount of time. I want to see two at least develop with a distance so large that they can not survive the distance between . My 2D version is having issues and I am only rarely getting a stable population and that last very short before a total collapse so Its going to take some time and tweaking before I can stabilize this new environment



Any suggestions on the best way to do a 1000x1000 grid and collision detection etc. I have a rough idea and a working game plan at the moment but any suggestions are welcome. I currently just test the position I am attempting to move to and if it is not NULL then I breed or fight etc with the creature there. I believe that everything I could do in 3D I can do in 2D ALOT faster. Zooming into small areas to look at a couple creatures here and there in 3D should be possible as well.


Can anyone think of a means to do Collision test that works like a Blit? So I can just compare the old 1000x1000 memory block with the updated positions all in one shot? That would make the amount of creatures I am able to run HUGE and essentially unlimited.

I was thinking if I AND (XOR maybe???) two memory blocks wont I be able to instantly tell if two are colliding? if its

AND

0,0 = 0
0,1 = 0
1,0 = 0
but....
1,1 = 1
So if I took the New positions and compared the memory block to the new positions only the Collisions would show up and everything else would be 0 making collision test extremely fast in Theory if I could figure a means to implement it.
Sphere sphere = new Sphere(0.5f);
InsanelyRedundantJava insanelyredundantjava = new InsanelyRedundantJava(Redundancy1, Redundancy2);
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 27th Nov 2017 08:56 Edited at: 27th Nov 2017 08:57
I know it ain't much to look at right now but everything seems to be going well with this, The collision detection looks right, The line of sight from the ray casting seems to be on point. Ill post another video tomorrow in which I have the collision detection and the Line of sight turned on so you can see their FOV and the collision box.

But its looking good and acting as planned. Tomorrow I believe I will work more on the AI of the brain to include walls and food which would be great because with walls I can force evolutionary bottlenecks as well asl making mazes for them so only the smartest are able to transverse the world and breed.

My next goal is to make creatures of variable size and speed but as its setup right now if I attempt to move them to fast they go out of bounds and cause and error... Easy fix just a matter of wrapping the values at a different place but I had bigger problems needing fixing that just now got done. By the end of tomorow I believe I will essentially have a 2D version of my original program just Bigger, Faster, more able to be expanded on and Much much smaller then the original, About 1/10 the size because not only did I know what I was doing I was able to manage my data much better in this version since I had planned this one better. Last one started as something else altogether and grew to what it became. This I planned on it and was able to implement what I learned from the last one to make cleaner much more efficient code.
Sphere sphere = new Sphere(0.5f);
InsanelyRedundantJava insanelyredundantjava = new InsanelyRedundantJava(Redundancy1, Redundancy2);

Attachments

Login to view attachments
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 16th Feb 2018 20:01 Edited at: 2nd May 2018 00:55
I am still working on this project, I have a system setup now which will be a bunch of small neural networks all connecting to each other in a Spring Mass system. Each cells input will be its neighbors output as well as additional environmental sensors. This should develop into an extremely powerful Neural Network which is going to be trained on a genetic Algorithm.

Past similar experiments have shown creatures of this kind to produce their own body structures that mirror nature such as limbs, legs and fins depending on the environment. To my knowledge however no one has attempted the level of recursion that I am about to undergo. This may lead to increased training time but should allow for much more complex outputs.

Cant seem to get this Youtube Link to work but there is a Video at that Address right there.





I have a couple sample Gifs of the creatures in action(Currently only one as I test the physics of it all) and a small Ball with all nodes linked to one enough making a springy little mass that has cost me so much time playing with instead of actually working on the code like I should . The Algorithm is great and everyone should make a spring mass system to play with. Its rather easy.
Sphere sphere = new Sphere(0.5f);
InsanelyRedundantJava insanelyredundantjava = new InsanelyRedundantJava(Redundancy1, Redundancy2);

Attachments

Login to view attachments
Ortu
DBPro Master
10
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 16th Feb 2018 22:03


[@Youtube]w_cuCWsDKHs[/youtube]

Remove the @
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 17th Feb 2018 16:47
Ty Ortu, I tried writing it with the = sign and like you have it above but it didn't work.
Sphere sphere = new Sphere(0.5f);
InsanelyRedundantJava insanelyredundantjava = new InsanelyRedundantJava(Redundancy1, Redundancy2);
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 2nd May 2018 00:37 Edited at: 2nd May 2018 00:38
Like I said before, I know its no longer DarkBasic and I am sorry for that but I just had to switch due to the Computational intensity of the project but I have now decided to once again bring the project back into the world of 3D


This is my GameEngine I am writing, I have advanced since the time I created this video and I now have Dynamic Collision response based off of Hookes Law and they act like springs. This equation is Cheep... and rather effective. I also have Terrain rendering with Normal collision response so the balls roll down hill. Its a total hack but it works for now. I should be making an engine just like the 2D one very soon in which the Creature will be a Cluster of spheres, each with their own Neural network. I will like to fix all the physics and stuff but thats all future stuff, I have what I need for now and I am happy about it. I should be able to watch them walk and crawl and evolve just fine. Soon I will also make another fork on Github of the project in which every vertex is surrounded by a collision sphere so that the creatures themselves will just Morph in front of our very eyes.

Anyway. Just wanted to keep people updated incase they are interested in the project even though its no longer written in DarkBasic. I still do testing of various new algorithms in Darkbasic due to its ease and simplicity when it comes to prototyping so there is still some connection here.
Sphere sphere = new Sphere(0.5f);
InsanelyRedundantJava insanelyredundantjava = new InsanelyRedundantJava(Redundancy1, Redundancy2);
Sedit
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 2nd May 2018 00:39 Edited at: 2nd May 2018 00:48
There we go.... It only took me like 5 Edits to get the Video thing right Ortu


Let me see if this allows me to add the animated Gifs of the project which are how I have most of my project so people can see the creatures evolving


Awesome it works! That is my Test of the Terrain collision and response.

This is a Gif of after training my creatures to move. At first, they just sat there and has a seizure attempting to move totally random with all the cells trying to go different directions



This is kind of how they look at the start... No forward progress gets made at all....



Here is the Discord Server I use to discuss the project, IDK if I have given it yet but I doubt it. We are trying to get people together to have a friendly online game jam competition

https://discord.gg/qHtkH3g
Sphere sphere = new Sphere(0.5f);
InsanelyRedundantJava insanelyredundantjava = new InsanelyRedundantJava(Redundancy1, Redundancy2);

Login to post a reply

Server time is: 2018-05-23 06:02:00
Your offset time is: 2018-05-23 06:02:00