gnista
gnista is a game engine built from scratch in c0, running as a windowed ring-3 program on moonshot. the engine and moonshot are grown together, and every real limitation the engine hits becomes a fix in the kernel or the compiler. infecteria is the game built on it.
entities
an entity is a layout with a position, a size, a velocity, a kind and a
few fields the game uses as it likes. entities live in a pool allocated once at
startup, and their slots are reused. a wall is an ordinary entity that never moves,
so one collision routine and one drawing routine cover everything.
drawing
nothing in gnista draws straight to the window. every frame is drawn into a buffer
of its own and handed over in one present call, so a task switch can
never show half a frame. the buffer is sized for the largest window the machine can
hand out, so the game carries on when its window is resized. there are rectangles,
circles, text in the kernel's font and a camera that follows the player.
movement is a fixed step per frame, so a busy system slows a game down instead of making it skip. animation runs on real time, so a sprite cycles its frames at the right rate whatever the scheduler is doing.
sprites
sprites are loaded at run time from the files pensel saves, so art drawn on the machine shows up in a game with no rebuild. a sprite file can hold several frames, and an animation clip is a run of them. a game carries fallback art for when nothing has been drawn yet.
scenes
a scene is a plain function that runs its own loop for as long as it is on screen and returns the scene to run next, or 0 to end the game.
infecteria
in infecteria you are a bacterium. you infect cells and absorb them or turn them
into factories, while antibacteria hunt you and heal the cells you left half
infected. only your factories can hurt them. you win by taking every cell. a file
called infecteria.seed holding a number fixes the world, so a layout
worth replaying can be kept.