WIP survivors game built using flecs, Raylib, C# and custom solutions for everything else. More of a prototype for the tech than an actual game.
Features:
- Flecs ECS architecture
- Raylib as low level graphics API
- Multithreaded collision detection
- Collision broad phase using grid hashing
- Pathfinding with flow fields and steering behaviors
- Property tweening
- Sprite animations using one big packed atlas
- Tilemap rendering of level using Tiled format
- Menus and state changes between scenes
Note: not all art assets are commited yet
Start with hot reloading
dotnet watch
Error handling inside systems doesn't work with .NET 9.0. Run with following to use old system that reports errors correctly
DOTNET_LegacyExceptionHandling=1 dotnet run
If the native library crashes, it won't normally show you the stack trace for the managed app. To get the C# stacktrace at the time of the crash you can run with coredumps enabled on crash
DOTNET_DbgEnableMiniDump=1 dotnet run
Then open the coredump for more details
dotnet-dump analyze /path/to/coredump
clrstack
Install dotnet-trace.
# cd to build directory
dotnet-trace collect --format Speedscope -- flecs-survivors
Creates trace that can be loaded in speedscope
Or use ultra for higher frequency sampling. dotnet-trace is limited to fixed 1ms which is not great
Packed sprite atlas is generated using Free Texture Packer and then processed into a runtime friendly format using a python script. Original split sprites are not includeed in this repo.
Tilemaps are generated using Tiled
TODO better description of phases
- OnLoad
- PostLoad: player input
- PreUpdate: process inputs before physics
- PrePhysics: spatial queries
- PhysicsPhase
- PostPhysics: update GlobalTransform
- OnUpdate: collision response, etc
- OnValidate:
- PostUpdate:
- PreStore:
- OnStore: Rendering. Actually done in separate pipeline with RenderPhase
Some inspiration from unity phases And Bevy: https://docs.rs/bevy/latest/bevy/prelude/struct.Main.html
TODO