If you find any bugs, please let me know here on GitHub and I'll try to fix them in future updates. The more information you can give me about when exactly the bug happens, the better. Please don't use this thread for newer bugs any more.
Thanks!
If you find any bugs, please let me know here on GitHub and I'll try to fix them in future updates. The more information you can give me about when exactly the bug happens, the better. Please don't use this thread for newer bugs any more.
Thanks!
Not uh.. exactly what I meant. The game choosing falling creatures isn't a bug, more like a flaw in the evolution, which is why the creator should add "kill joints", which aren't against machine learning since all what machine learning is is to find a solution for a problem, kill joints would just further improve the efficiency of the problem solving. Anyways, what I meant by my bug report is that in the normal gen screen, you can clearly see creatures moving pretty fast in the running mode, but sometimes, the "best of gen" won't show the actual "best" creature in each gen. This is made obvious when you can see the creatures in the normal screen clearly running, yet the "best of gen" will just show a creature sitting down, without doing anything. It also isn't just bad luck, since the best of gen shows statistics for each best creature, and when it says that it's "0.7m/s" when it obviously isn't true, then that's a big problem.
I explained what the latest state of that bug is over here: https://itch.io/t/150983/somthing-seems-off-in-the-pick-best-creature-algorithm-...
Effectively, the bug isn't that the best creature isn't being selected correctly, but that the best creature sometimes decides to just not repeat what it did really well in the previous generation, even though it has the exact same brain as before. Makes the whole thing much much more complicated to try to fix.
I just installed the Linux version on Ubuntu 18.04 after mucking around with it a bit in the web version a bit. It's a fun and cool 'game'. Unfortunately I ran into a annoying bug. I try changing the brain size to '4' layers instead of 3. But anything I type gets dupplicated. So if I enter '4' it actually becomes '44' (which is way too many layers :-).
I even tried to work around it using copy-paste, first typing '4' in a text editor and copy-pasting from there. But even that ends up entering '44'.
So annoying! So I hope you'll fix it.
Cheers.
PS: I guess it's this problem: https://issuetracker.unity3d.com/issues/linux-keystrokes-recorded-twice so maybe its really not something that you can fix.
Yes, I'm aware of that. It's a Unity bug, which I also pointed out over in this thread. They say that they fixed it in the latest update but that doesn't really mean anything and I haven't had time to check yet.
Potential cause to "best of gen" problem is that You probably store reference to "best entity" (or shallow copy, instead of deep one) and then modify it by mistake. Second problem i encountered is that used evolution algorithm sometimes regresses in fitness, possibly because its "too static" (meaning there are problems with discovering other potential solutions and/or its stuck in local minima).
I only store the brain of the best creature in its chromosome representation, i.e as a string, which is an immutable object in C#, so there is no way for me to accidentally modify it without replacing the whole thing. On top of that, I have also already tested and confirmed that the creature in the "best of"-screen always has the exact same brain it had during the simulation.
In theory, the fitness should never decrease if the "keep the best creature" setting is turned on, but yes, I have also seen this happen. I currently attribute both of these problems to the fact that Unity's physics system (which the whole simulation is based on) depends quite a lot on random external variables - such as frame rate drops - and given its approximative nature isn't as deterministic as it should be.
I'm trying to optimize the performance as much as I possibly can for the next update in order to get rid of any potential performance spikes that might interfere with the physics system. I unfortunately can't change the physics system itself so there is a certain performance limit that I can possibly optimize to. If you create tons of creatures with a bunch of body parts each, the physics system is by far the main reason for the extreme lag that you will see, and there's pretty much nothing I can do about that, which sucks. I can't even hardware-accelerate it, even though the fact that none of the creatures collide with each other is a perfect basis to parallelize those physics calculations on the GPU.
I have been doing some testing with the climbing simulation. Is there a way to make it so it will try move both horizontally and vertically evenly? Seems like as it progresses it will favor extending out vertically way more than horizontal if it is capable and eventually learn to fully stretch out and topple over instead of trying to climb.
Edit to better explain:
Seems the way it works right now if it moves higher or to the right it rewards itself but it would make more sense to only reward if it moves both higher and to the right because the end goal is for it to go diagonally up the stairs.
Edit: Thank you so much for this fun simulator!
I tried to make a rolling creature made of two wheels joined together by an axle at the center; and muscles between the opposite spokes.
I think you have a raw input for rotation, since my creature wobbles back and forth: My guess is the angle jumps from 359 to 0, which is bad for my use case.
What I would love, that would allow a continuous rotation, would be to split the rotation into sin(angle) and cos(angle) as 2 inputs. This allows nearby angles to get transformed into nearby (sin,cos) points in 2d space, and would allow for continuous rolling of creatures!
I've got a bug where the application crashes as soon as my creature hits generation 301. I glanced at the crash log, and this looks a bit strange, but I have no idea what it means:
16% memory in use.
0 MB physical memory [0 MB free].
0 MB paging file [0 MB free].
0 MB user address space [3579 MB free].
Also, here's another bit that looks like it might be informative:
Evolution [version: Unity 2017.4.0f1 (b5bd171ee9ba)] UnityPlayer.dll caused a Privileged Instruction (0xc0000096)
in module UnityPlayer.dll at 0023:63e64c61
I tried updating my Unity installation as well as updating my graphics driver, but the issue seems the same now as it was before. Would you like me to send the full log anywhere?
Update: It looks like previous crashes might be a slightly different, although it still looks like a memory issue:
Evolution [version: Unity 2017.4.0f1 (b5bd171ee9ba)] UnityPlayer.dll caused an Access Violation (0xc0000005)
in module UnityPlayer.dll at 0023:5f721f4d. Error occurred at 2018-08-03_041922.
C:\Users\[installation location redacted]
37% memory in use.
0 MB physical memory [0 MB free].
0 MB paging file [0 MB free].
0 MB user address space [3136 MB free].
Read from location 0d74e0a0 caused an access violation.
In the running task, my creature sometimes gets a very high speed. I think it is related to a wrong "vertical distance from start".
I compiled the latest Optimization branch on github (64-bit, Unity version 2018.2.8f1, I had to completely delete the folder Assets\TextMesh Pro to get it to compile). The Optimization branch greatly increases the frequency of this bug. Perhaps something to do with the "transform.position" call in "CalculateBasicBrainInputs()"?
As an aside, I think the Optimization branch does fix the high memory consumption.
Another aside: I looked into compiling my own because I wanted to increase the MAX_DISTANCE from 55. I think once you get 100% fitness, at an equivalent speed of 11 m/s, evolution stops (the best creatures sort is not effective) and I wanted my creature to keep improving. I don't understand how some people got speeds much higher than 12 m/s in some gifs, unless it was a one-off or the design happened to be great to begin with. Point is that once you have a pool of 100% fitness evolution becomes random and not driven by performance?
Thanks for this great simulator!
On the picture you posted the horizontal distance also seems to be way outside of the normal range. It would be nice if you could send me the saved simulation file (stored in the Application.persistentDataPath: https://stackoverflow.com/questions/44419658/location-of-application-persistentd...) to keiwan.donyagard@gmail.com. I'll probably have time to work on this project again in roughly a month from now.
Thanks for confirming the improved memory management!
Now, while I still believe that a regular creature is highly unlikely to reach 100% fitness without any bugs helping, if you want to keep your creatures to improve beyond 100% fitness, you could also just remove the upper clamping limit of 1.0 when the fitness values are calculated inside of each Brain implementation (it should be within the respective Update call). That way you could keep the MAX_DISTANCE value at whatever it is, which would allow you to compare your creatures' performance to designs made by other people who are running an unmodified version of the simulator. As far as I can remember, fitness values above 1.0 should not cause any issue with any of the remaining code.
By the way, now that you had to remove TextMesh Pro, does the Russian and Portuguese text in the help center still show? I think I read somewhere that TextMesh Pro is now part of Unity itself but I haven't had any time to try to port this project to the 2018 version yet.
File is on the way, thanks! See also more notes below.
About the TextMesh Pro: No help text shows up in my build, not even English! It's not a matter of just deleting.
(Never used Unity, I don't know what TextMesh does. I tried deleting it because I got errors for conflicting dll's in that folder).
Restoring the MAX_DISTANCE and removing the clamp works as you suggested. Apparently you have also been spot on with the expected "physical limit". At least for my creature. It's improving only marginally to about 11.50 m/s after 1000 generations. This conclusion might be contingent on the bug though:
About the bug, I think it has to do with the call creature.gameObject.SetActive(false); in SimulateGeneration(). I think because the sort in EndSimulation() is done on the currentGeneration and not currentCreatureBatch (which apparently is used even when settings.simulateInBatches is false?), the joint.transform.position returns garbage later, when GetXPosition() is called on the best creature, because the best creature has already been set inactive and the transform.position is undefined?
If I comment out this SetActive(false) call, there is never a case of "crazy" numbers for a generation - even when compiling the Optimization branch, for which the crazy numbers would happen all the time.
Problem is, when removing this call my speeds also go much lower. From 11.50m/s to around 8.5m/s, even though on screen the creature seems to be travelling as fast. I don't understand enough about the code to figure out if the lower speeds might in fact be the correct ones. They do improve though: i.e., the same creature that did 11.5m/s and then fell to 8.5 m/s does go up to 9.3m/s in a few generations (whereas before removal of SetActive(false) , the speed would not evolve).
All this testing was done without batches activated.
Thanks again!
Thanks!
I use TextMesh Pro to be able to inline images into the help text. It seems like I have to go though a whole process to upgrade the project to make sure TextMesh Pro continues to work properly.
Internally the currentCreatureBatch array is always used to simplify the implementation. When you turn off batch-simulation, it's practically the same as if you manually set the batch size to the population count. The sorting has to be done on currentGeneration in oder for it to sort the entire population and not just the current batch before the selection step, but if you have batches turned off, both arrays contain the same creatures anyway, so it doesn't make a difference.
The SetActive(false) is definitely necessary. Removing it changes the behaviour of the creatures and therefore also any previously saved simulation. That's why you see the fitness drop from 11.5 to 8.5. Since the entire movement relies on Unity's physics system, it is incredibly easy to break accidentally (I wasted a lot of time on exactly this one SetActive(false) call when writing the optimization branch). So even if this was causing the problems you are referring to, I couldn't just remove the call but would have to work around it in another way. That being said, GameObjects in Unity don't lose their transform position values when you deactivate them, so the values should still all be valid at that point in time.
Thanks for helping me debug this by the way! I'm sorry I can't test the actual project at the moment, but I will as soon as I have time. The creature movement looks great by the way!
Hi again and thanks for explaining. I've been testing the optimization branch and I have some data points:
If I load my best save file (creature in the first video) into the optimization branch then during the first 3 generations from the save point the creature will invariably deteriorate to sub-11 speed. Then, by generation 4 from the save point, I will consistently get the "crazy" distance-from-start numbers. This will continue for each generation after that point, i.e., there won't be any "sane" gens in between (as I get with the master branch). In the video below (of the optimization branch) the loaded save file was gen 6830 created by the master branch:
So, for my creature, the optimization branch will have deteriorating behavior and "crazy numbers" as the rule (instead of the exception as is the case with the current master branch). This happens no matter what I try, in terms of colliders, isKinematic, and various other things I looked into. The only way to fix the distances is to eliminate SetActive(False). But then the physics change and there is no evolution (30% fitness after 7000 generations - I let it run over the weekend since it doesn't crash now).
But, if in evolution.cs I switch back to killgeneration() instead of resetcreatures() then I get the same behaviour as that of the released version (I later noticed that you have a related comment in the master branch). When I say the same behaviour, the "crazy numbers" also show up albeit with the same frequency as for the released version:
What I think is happening:
The SetActive(False) is necessary to keep the physics right (for some obscure reason) but, under some condition, it messes up the object's Transform(?) so that the position returned later on in best.GetStatistics() is garbage. The master branch destroys and creates new objects so a "messed up" Transform will not persist into the next generation. But the resetcreatures() of the optimization branch preserves the actual objects. Once a Transform is "ruined" it will carry over into the next generation. So the best creature in every generation after that will have the "crazy" distance-from-start numbers.
The overall deterioration of the creatures (with components all over the place for gen 6846 in the video above) suggests that the destruction and recreation that goes on in the KillGeneration() of the master branch helps to mask an inherent problem with reusing the objects after deactivation/activation?
What is needed is some way to "reset the physics" between generations but without deactivating? This may even be a Unity issue, it makes no sense that commenting out the SetActive calls in SimulateGeneration() changes the creatures so much.
I fixed the weird glitches that happened on the Optimization branch yesterday. (I also upgraded the project to Unity 2018.2 and reorganized the scripts a little bit). It's all merged into the master branch at the moment, if you're still interested. Thanks again for confirming the TextMesh instructions, they worked for me as well.
The problem was that I had forgotten to also reset the MuscleJoint rigidbodies when resetting the bones, which caused them to disconnect and glitch out.
I'm now working on the next big release with tons of new features that I'm very excited about.
Yes, I removed the evolution-core submodule and re-integrated all the scripts into the same repository. Man, was that submodule annoying to work with.
The only reason why the "evolution-core" submodule existed at all was because I played around with making a "true" 3D version of this simulator (possibly with AR integration) in a separate app and I wanted to reuse most of the existing scripts. The submodule allowed me to do just that but it was still a significant overhead. If I ever decide to make a 3D version of this, I'll just add it to the current app (it's probably not going to happen though).
About the TextMesh, I can confirm that these steps work (all help text shows up after project conversion)
Does this same creature design consistently glitch out in the current released version (other than Android)? If so, then the glitch wasn't introduced in the Optimization branch. There were definitely glitches happening before but they definitely increased drastically after my optimization attempts.
I'm in the process of adding import and export functionality to both creature designs and simulation save files. I'll let you know once that's ready so you can send me this design to test with.
Yes, it does glitch out in both 2.0.3 and 2.0.4 (Windows x64)
Thanks, I'll send you a small file of the simulation run, I believe you can get the creature from there? Two files in fact, the first is of the creature before some slight changes which made the glitches significantly worse. Maybe these changes (bone length if I recall) will give a hint.
The fitness criteria for the climbing seems to favor non-moving creatures way too much. Probably because since they're dropped onto a hill most of them will fall down, and the most "fit" creatures is those that just tense up completely and avoid falling. I once even noticed one actually started climbing up but it appeared not to be selected as the best of the generation and instead chose the one of the many who just froze completely.
Btw does it favor moving to up along the hill or simply getting higher? It appears to me it's that only maximum y height is rewarded rather than max diagonal movement; cause in one experiment it seemed the ones actually started to make progress using it's limbs to crawl were out competed by those who simply stretched up as tall as they could be straight up. So the next generations were just static creatures that balanced on their hind leg and occasionally tipping over backwards and nobdy even trying to go right. They probably moved their center of mass slightly higher but they were not really moving.
Maybe the hill is slightly too steep as well and with the non-deterministic physics any progress will be accidental and not really reproducible (especially since the most fit seems not to be the ones who actually move but those that stand still and just shake in the right direction.)
It would be nice if we could adjust the hill steepness and fitness criteria as well.
Any single wheel based creature that I've attempted to create seems to be incapable of training effectively. Looking over the inputs in the help section, I see that rotation and rotational velocity are both inputs, but that rotation is the average of all bone rotations. This creature seems like it would be very easy to train if the rotation input was present at all, so is it possible that the way rotation is averaged with a wheel is averaging out to zero all the time?
I get some off graphical glitches which I don't fully understand. Sort of a bits of creatures flying everywhere: will see joints (red dots) and bones schizophrenically whirling all over the screen. Since these pieces are detached from one another, despite all parts of the creature being connected, I assume it is a graphical glitch and not a simulation problem. Indeed, the simulation seems to carry on fairly normally as creatures will usually evolve past whatever behavior was causing the issue … with later generations behaving and displaying normally.
Here's a representative screencap:
I don't know exactly why the physics engine goes crazy sometimes, but I do know that this guy here does it on command. Just run it yourself and you'll see what I mean. It's super consistent and repeatable.
The creature's muscles expand without any upper bound, and the inner and outer squares fly off in different directions.
On the one hand it's clear that part of the problem is that the two skeletal structures are completely separate, but on the other hand it's also reasonable to expect that muscles get worse at expanding when large and worse at contracting when small; this is clearly not true. In any case, the outcome is super buggy.
http://keiwando.com/evolution/faq/glitch-fix/ has a rough explanation why I haven't "fixed" this issue, which is essentially a continuation of http://keiwando.com/evolution/faq/glitch/ (I know that you're not focused on the fact that you can reach 100% fitness with this bug, which is the main focus of the second link, but it's the same issue and a setup for the FAQ of the first link)
I just uploaded a new Windows version, which should hopefully fix the issue. Can you please follow these steps and the let me know if it worked or not:
(You might not need to do all three of these steps - do them one at a time, try again and stop as soon as the editor works again.)
1. Go to C:\User\YourUser\AppData\LocalLow\Keiwan Donyagard\Evolution and delete the CreatureSaves folder.
2. Open regedit and go to HKEY_CURRENT_USER\Software\Keiwan Donyagard\Evolution and delete the entries that begin with "LAST_CREATURE_DESIGN_KEY" and "DID_MIGRATE_CREATURE_SAVES_KEY".
3. If both steps above didn't fix the issue yet, delete the whole Evolution folder in your registry using regedit.
Thanks! It looks like something has crashed in the background. Can you maybe send me the Unity log file? You can find it here:
C:\Users\<your_username>\AppData\LocalLow\Keiwan Donyagard\Evolution\Player.log
If you like you can also just try to delete the Evolution settings data from the Windows registry:
HKCU\Software\Keiwan Donyagard\Evolution
This will also delete all of your previously saved creature designs (saved before the last update), so maybe create a backup if you care about those.
It looks like the registry solution I described above should work and fix this issue (with the downside that you would lose old creature designs). You can try to first remove only the entry with the key that begins with "_CreatureNames" from the registry. That should probably be enough. If not, then remove the entire Evolution folder from your registry. That will be act like a fresh install.
I just uploaded a new Windows version, which should hopefully fix the issue. Can you please follow these steps and the let me know if it worked or not:
(You might not need to do all three of these steps - do them one at a time, try again and stop as soon as the editor works again.)
1. Go to C:\User\YourUser\AppData\LocalLow\Keiwan Donyagard\Evolution and delete the CreatureSaves folder.
2. Open regedit and go to HKEY_CURRENT_USER\Software\Keiwan Donyagard\Evolution and delete the entries that begin with "LAST_CREATURE_DESIGN_KEY" and "DID_MIGRATE_CREATURE_SAVES_KEY".
3. If both steps above didn't fix the issue yet, delete the whole Evolution folder in your registry using regedit.
I just uploaded a new Windows version, which should hopefully fix the issue. Can you please follow these steps and the let me know if it worked or not:
(You might not need to do all three of these steps - do them one at a time, try again and stop as soon as the editor works again.)
1. Go to C:\User\YourUser\AppData\LocalLow\Keiwan Donyagard\Evolution and delete the CreatureSaves folder.
2. Open regedit and go to HKEY_CURRENT_USER\Software\Keiwan Donyagard\Evolution and delete the entries that begin with "LAST_CREATURE_DESIGN_KEY" and "DID_MIGRATE_CREATURE_SAVES_KEY".
3. If both steps above didn't fix the issue yet, delete the whole Evolution folder in your registry using regedit.
For some reason I wan't able to place down any joints. I tried to load in Hailer, but it only loaded up 2 muscles and nothing else. Not joints, no bones, nothing. I tried to star the simulation and the "Hailer" dropped to the ground and never moved. No matter how long I waited, it never progressed to the 2nd generation. I have no idea what caused this but I believe it's a fairly rare occurrence...
Which operating system? Windows? Is it something like this: https://itch.io/post/981372
It's not exactly what you linked, and yeah, it was a Windows-based pc. I was playing the browser version and everything seemed to work perfectly fine other than the Joints and Bones of the creature. Buttons functioned, everything had visuals, it all worked perfectly. The only weird thing was that the Joints and Bones were completely invisible. However, the muscles were perfectly fine.
That's what I get for trying to use a crappy school computer to play cool stuff, I guess. It may just be a problem with the hardware, as every other computer I've used with it works perfectly.
The number of creatures is not decreasing, but they are slowly converging towards the exact same behaviour, so it looks like there are fewer individuals (since they are perfectly overlapping each other). I have seen this happen with certain simulation settings, so try changing the mutation rate, mutation algorithm and recombination algorithm. Are you using "Chunk" as the mutation algorithm by any chance?
The easy-to-download binary is now priced to support the developer. The source code is still available in the GitHub repository linked on the page and you can build the game for free from source, requiring a Unity build and some dependencies to do so, although I do agree that making the executable paid is a bit bothersome for most of the users. Keiwan explained this change in the game’s latest changelog