Basic game engine stuff from Hatchling.