Simulated Evolution on the PICO-8
2 days ago
- #Game Development
- #PICO-8
- #Simulated Evolution
- The author was burnt out from previous articles and took a break to work on a simple PICO-8 project, porting Simulated Evolution.
- The simulation was adapted from earlier C/assembly implementations into PICO-8's Lua dialect, with design changes such as using separate BORN and DIED tables for bug management.
- To efficiently track and render plankton without extra arrays, screen memory was utilized as real memory by mapping a 150×100 world onto a 128×128 spritesheet using custom coordinate functions.
- Scrolling was implemented easily using PICO-8's CAMERA and CLIP commands to handle the large world not fitting entirely on-screen.
- PICO-8's 16-bit signed integer limit was circumvented by using its 32-bit fixed-point numbers and adjusting values, with bit shifts accommodating fractional values.
- A Garden of Eden feature was added via the MENUITEM() facility for the pause menu, allowing toggling and simulation resets without rebooting.
- Graphical data was generated externally with Python, though initial hex formatting issues corrupted map data silently; PICO-8's IMPORT command helped with spritesheet and label imports.
- The simulation runs efficiently at 60Hz using only 60% CPU, but lacks custom seeds due to reliance on built-in RNG and no keyboard input for convenience.
- The finished cartridge includes steganographically encoded program art, with source available on GitHub and added to the SimEvo project collection.