AnymaEngine
Game engine in C++ with a focus on evolution simulations
Install / Use
/learn @buddhaman/AnymaEngineREADME
AnymaEngine
<img src="anyma_engine_logo.png" alt="Anyma Engine Logo" width="300"/>This will be the most large scale and fastest evolution simulation out there.
Building
~~Make sure you have cmake, vcpkg and all necessary c++ development tools for your operating system.~~
Cmake is gone! Simply run build.bat in an x64 Native Tools Command Prompt (you get the x64 command window when installing visual studio).
Large scale TODO
- Switch to HandmadeMath linear algebra library.
- Break world up in chunks and process chunks using multithreading.
- Make cute renderer.
- Make the world absolutely huge and do processing by chunk offsets to prevent floating point errors.
- Two pass collision solving.
- Improve standard library: Add string type, better sorting.
- Improve standard library: Make own multithreading primitives.
- Build introspection and profiling tools.
- Do real good collision detection, fix the fact that lots of agents are being checked twice.
- Do rendering on background thread such that the main thread doesnt block and feels smooth.
- Saving and loading the state of an entire world.
- Tracking succesful agents.
- Tracking lineage.
- Track generation number.
- Showing the entire state of the brain and genes.
- Make a circular buffer.
- Port to webassembly and run online.
- IDEA: Create a kind of business rule table where you can set rules like:
- Required speed for carnivores to do damage to herbivores
- Allow sprinting, how much energy to take on a sprint?
- Do carnivores get a reproduction boost if their population is low?
- IDEA: Sensor: Average direction and distance of a certain type of agent in the neighbourhood as sensor.
- IDEA: Genetic playback, show entire evolution of phenotype as animation.
TODO
- Brain soup experiment: better token representation. (Not only one-hot)
- Put all entities in a giant list and do a kind of GC sweep to remove entities out of their respective list.
- Fix the scale of the agents.
- Move rendering to world and reuse world code in the editor.
- Render a non-moving version of the agent based on the phenotype.
- Plants should sleep when no interaction. (This also fixes the constant rotation).
- Make tools to visualize genes and gene changes such that agent phenotype can be designed properly.
- Design genes such that limbs appear and disappear gradually.
- Create food. Make bushes with berries and herbivore agents have to stand still and collect.
- Create tilemap and interpolate colors on the edges for biomes.
- Make decorations on the terain, rocks.
- Collision detection with solid tiles.
- Show work done per thread. Internal profiling tools.
- I just realized that the lifespan arena is just a more complicated circular buffer. Implement circular buffers.
- Design mouth.
- Make graph in real seconds as units.
- FUN: Make a creature editor.
- Modular sensor and actuator system + editor.
- FUN: Make a mass-add feature.
- FUN: Make a mass-death feature.
- FUN: Make a mutation gun. Radiation.
- FUN: 3D particles.
- Change to local coordinates instead of fov, this is easier to work with.
- Make boid-like inputs with average position and average velocity of nearby agents.
- Change charge such that they can charge partly and agents get feedback on the amount of charge they have.
- Make carnivores brighter so you can see them better.
- Custom text rendering.
- Create simple entity system.
- STATS: Energy collected.
- Change rendering to 2.5D.
- Calculate frame update time and render time, use this to reccomend speedup or create adaptive speedup.
- Add terain.
- Show charge of agent in ui.
- OPTION: Change sensor info, give angle and distance of nearest same species and nearest opponent.
- OPTION: Pheromones for herbivores.
- OPTION: Evolve possibility for pheromones.
- OPTION: Put food in the ground and signal food availablity by pheromones. LIKE ANTS!
- Make checkbox whether to show health bar in world.
- Show graphs of deaths and births.
- Store most succesful agents. (Requires herbivores to collect plants).
- Edit total lifespan of agents.
- Remove health bar in world with checkbox.
- Make grass fields , energy in ground.
- Configure amount of eyes and fov.
- Create real and simple memory pool with chunks
- Show indicator when herbivore is hurt.
- Edit reproduction rate calculation, more offspring if population is low for instance.
- Implement my own std::function.
- Plotting utility functions.
- Make active and inactive chunks.
- Fix agents popping into view.
- Draw scale with some text too.
- Show agents in chunk in debug window.
- Consistently call everything either draw or render.
- Make random number generator.
- Make rain and clouds when zooming out.
Done
- Make plants.
- Use perlin noise for terain and biome generation.
- Turn off toroidal world.
- Mutate genes gradually.
- Turn agent into entity? At least something such that collision detection and vision is possible between both plants and agents.
- Refactor simulationscreen to use renderer. Do this gradually.
- Build creature in local coordinates.
- Make terrain look good.
- Rebuild only phenotype when changing in editor.
- Add arms.
- Generate random genes.
- Visualize mutations.
- Turn editable parameters into a genome and generate the phenotype.
- Edit creatures in an interface. Number of legs, hands, sizes.
- Make texture region.
- Global empty texture for convenience.
- Make list of common colors.
- Show charge when zoomed in.
- Throw away memory pools and use lifetime arenas for everything.
- Design eyes.
- Render a detailed agent in the editor.
- Walk cycle.
- Design legs.
- Make a camera looking down.
- Create a renderer instead of passing all these meshes and textures around.
- Use textures to draw a circle.
- Get textures working and set default texture.
- Get camera working in editor.
- Add different sensor type instead of eyes: nearest agent.
RELEASE 4
- Remove CMAKE. I decided to use CMake for this project and i regret it. Very much.
- Make particles when agent gets killed or dies.
- Show health when zoomed in.
- Recoil, or however you wanna call it when a herbivore is hurt. They cannot move unless they sprint?
- Use the charge or refractory value to disable movement for herbivore agents.
- Fix colors everywhere, follow imgui layout.
- Give carnivore agents a charge/attack procedure that is controlled by a neuron. This costs energy.
- Configure energy transfer on hit.
- Show overlays: Make coloring of genes to show genetic distance of different agents.
- Make color helper functions.
- Better agent selection, give feedback on agent hitboxes.
- Plot low dimensional version of genes.
- Draw active chunks.
- Compare two agent genes.
- FIX BUG: SelectFromWorld often has idx out of range.
- Highlight currently hovered agent.
- Create some background in the world, it looks boring right now.
- Make neural network library.
- Implement alpha blending.
- Icons for imgui.
- Make a startup screen to start simulation with new persistent parameters.
- Turn off asserts when not debugging.
- Show number of workers and available threads. Make settings.
- Custom font for imgui.
- Show time also in seconds, not just ticks.
- Make agents squishy in direction of their velocity.
- Make carnivore attack.
- Collide herbivores and carnivores.
- Implement simple jobsystem.
- Do sensor updates and brain updates in parallel.
RELEASE 3
- More options for user. Spawn agents.
- Make mutation_rate adjustable in gui.
- Keep selection when moving camera around.
- Organize interface.
- Debug tools for memory arenas, check if clearing doesnt lead to problems.
- Implement 2 memory arenas for lifetime management.
- Make super simple brain.
- Agent lifespan.
- Agent asexual reproduction with mutations.
- Make cumulative graph of types of agents.
- IMPORTANT: Solve the huge memory leak in AddAgent.
- Remove agents.
- Pause simulation.
RELEASE 2
- Simple behavior.
- Setup screen to make new simulation.
- Show agent sensors when selected.
- Set debug option: Show chunks etc.
- Refactor main loop and main in general. Move to SimulationScreen.
- Show agent rays when selected.
- Show agent info in debug window.
- Raycasting for all eyes.
- Sort agents into all chunks they belong to.
- Draw grid in a more efficient way and in the background.
- Grid based collision detection for rays.
- Camera to world position.
- Make agents selectable.
- Handle collisions using chunks.
- Draw eye rays for selected agent.
RELEASE 1
- Create itch.io page.
- Asexual reproduction.
- Collect statistics about chunk occupancy.
- Only render visible agents.
- Divide the world into chunks.
- Update creature sensor info based on raycast (seeing).
- Do raycast;
- Do simple collision detection.
- Resize screen.
- Fix Array issues.
- Level of detail.
- Render eyes.
- Use N-gon to draw creatures.
- Sorting in Array
- Render N-polygon
- Make creature struct (Agent).
- Line rendering.
- Fix frame update rate at user specified FPS with SDL_Delay.
- Create window struct for platform handling.
- Render a creature.
- Implement scrolling.
- Move the 2D camera with WASD.
- Move the 2D camera with the mouse.
- Handle user input.
- Make a 2D camera.
- Make a basic 2D renderer.
- Import imgui with docking.
Ideas
- For an overview of how the world is evolving, create a kind of sampling minimap. Dont render each individual creature but take a couple of samples for each pixel using the bsp-tree and take the average color. Store these frames and show as animation.
- Set business rules for evolution.
- Make interesting presets, make it easier for the user.
- Cool water shader.
- The editor is just a kind of playground where you can test out things in small before letting evolution do its thing. Its a bunch of tools for myself to design genes and bodies.
Engine and more games.
- Move game-engine related stuff to different folder and turn into reusable game-engine.
- Create
