§ Game engine
Timeless engine.
Timeless is my open source game engine, written in C++, which also exports to WebAssembly. It's what I build my games with. They run right in the browser, so they can be shared with anyone, anywhere, without hassle.
C++OpenGLWebAssembly
View on GitHubgrutto.engine
#include "timeless/timeless.hpp"#include "timeless/components/behaviour.hpp" // Boot the engine and register a time-sequencing system.TE::init();TE::create_system<NpcAiSystem>("ai", new NpcAiSystem()); Entity npc = create_entity();TE::add_component(npc, new Transform(glm::vec3(0.0f))); // One Instruction per tick. The reverse flag replays the// same timeline backwards, so undo/rewind comes for free.std::vector<Instruction> timeline;timeline.push_back(Instruction( [](Entity e, bool reverse, float speed) { auto t = TE::get_component<Transform>(e); t->position.x += reverse ? -speed : speed; })); TE::add_component(npc, new Behaviour(timeline));TE::get_system<NpcAiSystem>("ai")->register_entity(npc); // Advance the simulation one tick each frame.TE::loop([&](GLFWwindow* w, ComponentManager& cm, WindowManager& wm) { TE::get_system<NpcAiSystem>("ai")->update(cm);});