starting overview of my new project animal_game
Tags: rust, gamedev
Published: 2023-09-21 13:08:34

The goal is to create an ecosystem simulator similar to [Rainworld](https://rainworldgame.com/). Maybe turned into a game if I get an idea that wouldn't just copy Rainworld. The main purpose is to learn (however with the ambition to reach a working product). One of the side goals is to find a better name.

This project currently consists of three repos. The [game/simulator](https://github.com/pgurtner/animal_game). The minimalistic [game engine](https://github.com/pgurtner/animal_game_engine) written in parallel for this project. The [macros repo](https://github.com/pgurtner/animal_game_ecs_macros) for ECS abstractions.

I'll try to write blog posts about this project to...
 * practice writing in English
 * get additional motivation from these little milestones (blog posts about what I did or maybe what my plans are if they're interesting enough for a post)
 * to be forced to think through ideas well enough to be able to explain them
 * the tutorial style posts maybe will help someone (like [this one](https://dev.to/dexter_76/how-to-abstract-away-library-interfaces-working-directly-through-syntax-in-rust-with-procedural-macros-3pgm) that's actually the first post about this software project) and the rest might be interesting to read

## some technical aspects
This project will use 
 * Rust, because I want to further learn the language, my experience is limited to reading the book and an unfinished tetris game
 * the Entity Component System pattern, I'm intrigued by the concept and want to try it 
 * a minimalistic [game engine](https://github.com/pgurtner/animal_game_engine) written in parallel that's build on top of [ggez](https://docs.rs/ggez/latest/ggez/), I want to learn how to implement the physics part of a game and I already used ggez. ggez is just there for the fundamental parts like game loop or drawing graphics, the rest is something I want to learn myself.
 * decentralized algorithms for animal behaviour, I'm currently very interested in decentralized, self-correcting, etc. systems/algorithms/... and want to learn about it (this was the main reason why this project idea won against others)
 * clean code and architecture, I've read about these concepts in multiple books by Robert C. Martin, but until now only used it to rewrite my last project in the middle of development which turned it from pure hell to something nice, this time I want to create a clean system from the start

In terms of software architecture (especially interfaces), my current approach is to look at what I need right now (and maybe in the not so distant future) and built it in a way that enables future extensions and easy switching of components. With that I hope I don't get into perfectionistic planning hell while ensuring a clean architecture. Let's see how this approach will develop and how/whether it will work.

## current plans for the game engine
 * graphics: 
   * draw various objects including abstract ones (light, fluids)
   * varying window sizes
 * physics:
   * applying forces: hitting, throwing, grabbing
   * dynamic vs. static objects
   * fluids
   * friction (no idea if friction is doable or how to do it, in school this thing did not exist, I have no idea about it)
 * animal bodies:
   * bone system for movements
   * body rendering that uses individual body parts instead of whole sprites

## current plans and ideas for the game/simulation
The game itself is about visualizing animals and environment and (the main part) animal behaviour.
The current ideas include (not exhaustive, a lot taken from Rainworld):
 * basic senses: seeing, hearing, touching?, smelling?
 * basic reflexes: attack vs. run, hunting/eating
 * more complex behaviour
   * personality: small set of fundamental characteristic aspects that influence the behaviour. E.g. impulsiveness, willingness to take risks
   * social memory: remembering interactions with others to cause things like rivalry, groups, etc. (maybe even revenge)
   * dynamic food chain position: no fixed positions, a worm should in theory be able to kill a giant somehow
 * somehow evolution (not sure if some parts are doable)
   * implement mating and giving birth functionality (the foundation for evolution)
   * newborns get a mix of their parents' personality with some randomness
   * try to make physical appearance affected by evolution
   * try to make dynamically developed instincts