Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfixes, more sensors and neurons, graphical improvements, scripts for compilation and running with docker #59

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

cavac
Copy link

@cavac cavac commented Jan 30, 2022

I have been playing around with biosim4 over the weekend. I've implemented a lot of bugfixes and improvements. Sorry that they are all sort of mashed together, i wasn't initially planning on doing more than fool around with the simulator.

Here is a (probably incomplete) list of changes:

  • Fix the Makefile. The build process didn't rebuild objects when header files (structs and such) changed. This can (and has) lead to unexplainable crashes. Now, changing header files rebuilds the whole project
  • Added scripts to easier run the docker container. It's now also easy to automatically run everything in "screen"
  • Added pheromone visualization
  • Added "recent death" pheromone (level 1) that is generated when a creature dies or is killed.
  • Added sensor neurons for the "recent death" pheromone
  • Show target area for some of the challenge modes (incomplete)
  • Show radiation on the map
  • Added the flag "killingIsRisky" which gives a 25% chance that the attacker dies instead of the intended target
  • Added experimental memoryNeurons that delay their output by one cycle (it's a one stage shift register, basically)
  • Added the ability to save the genomes of all creatures in text files (option genomeSaveStride)
  • Added the ability to load a saved genome file at the start of the simulation (option genomeLoadFrom)
  • Added two more complex barrier types
  • Fixed a number of bugs when world is non-square but optimized for a computer monitor (e.g. 16:9 or similar)
  • Changed pheromones to a more gradient-by-distance thing to emulate a more "natural" way of pheromone spreading

The enhanced visualization (=videos) make it easier to understand what is going on.

With the ability to automatically save the gene pool and then later load it back into a simulation, it's now possible to, for example, run multiple simulations and then (using a text editor) merge creatures from those scenarios into a new simulator session. Also, resuming a simulation is now much easier, with the caveat that the generation number starts from the beginning.

@davidrmiller
Copy link
Owner

Thanks for the PR. You present some very interesting ideas in this collection. When time permits, I would like to look more closely at some of these changes and isolate a few of them into their own individual PRs.

For now, I'd like to refer interested readers to your excellent fork of the project.

@cavac
Copy link
Author

cavac commented Jan 31, 2022

I'm happy to provide the ideas and the source code. But you are way better at making an explanatory video.

There will be more commits. My current plan is to:

  • finish up the visualization (add all the other challenge modes)
  • Add some scripts that make it easier to backup results after a simulation run.
  • Add scripts to allow batch-running multiple simulations
  • rework some of the reproduction stuff. sexualReproduction always results in a very homogeneous population because it is mixing all the creatures. There might be a way to track two or more distinct populations that don't mix with each other. This could be especially useful for a show-off between distinct evolutionary paths from previous simulation runs.
  • Another thing this forced multi-species evolution might allow is to give the option for a mutualism/symbiosis type interspecies relationship. Still working on a very rough idea.
  • Allow proper "resume simulation" with correct generation number
  • Option to disable video production (videos are very slow to generate). Technically, if we want a video of a specific generation, we could just load the genome back and run a one-generation-simulation (yes, there will be scripts for that). If i switch to a binary save/load format, we would save a lot of space (and processing power) and make it possible to save the genomes of every generation for later analysis and video production.

@mathematicalmichael
Copy link
Contributor

make it possible to save the genomes of every generation for later analysis and video production.

big +1 to that feature.

@mathematicalmichael
Copy link
Contributor

what's with the mercurial files? not sure I understand the purpose of these given git / github.

@cavac
Copy link
Author

cavac commented Jan 31, 2022

I only use git to publish on github.

My local workflow is completely mercurial driven. I prefer it over git (saner command line and all). I have 250+ projects in my mercurial repos (public and private) atm. Been using mercurial for ~15 years now and i have never suffered a single data loss or corruption. I also use mercurial for biosim4 locally. And then only commit in git when i have a major change i want to push to github.

The public (readonly) hg repo for biosim4 is at: https://cavac.at/public/mercurial/biosim4/

As for saving the genome of every generation (binary format), that piece of code is currently in the works. Upload will probably happen in a few days. First, i need to still write some Perl scripts to convert between binary and hex format (for external analysis, the hex format is probably the better choice). And i want to properly handle the big Endian/little-Endian stuff in those converter scripts. Just in case someone has an ARM supercomputer, XBox 360 or OpenRISC system in their basement and wants to run this simulator ;-)

BTW, here's a video of the current visualization: https://www.youtube.com/watch?v=B7MxnGpf8SE
The blue "fog" is pheromones emitted by my creatures. The current crop just seems to love to use them, for whatever reason. Might have to tone it down a bit in the next version.

@davidrmiller
Copy link
Owner

I like the pheromone visualization. Nicely done.

petterreinholdtsen pushed a commit to petterreinholdtsen/biosim4 that referenced this pull request Feb 23, 2022
Change lifted from davidrmiller#59 by
Petter Reinholdtsen.
petterreinholdtsen pushed a commit to petterreinholdtsen/biosim4 that referenced this pull request Feb 23, 2022
Make sure to recompile *everything* if a header file has been modified
to prevent random crashes due to struct misalignment

Change lifted from davidrmiller#59 by Petter Reinholdtsen.
@petterreinholdtsen
Copy link
Contributor

Perhaps some of these improvements should be isolated and merged into main separately?

@daniel-kullmann
Copy link

The change of the copyright holder in the LICENSE file should be reverted.

@davidrmiller
Copy link
Owner

@daniel-kullmann, feel free to elaborate on why the license file should be reverted.

@daniel-kullmann
Copy link

Ah sorry, I thought your Author line had been removed, but it wasn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants