GenGine is work name for our Game Engine. Engine architecture composes of agents responsible for specific action.
Every agent has init(), update() and shutdown() methods. These methods are empty by default.
Available agents:
AgentPack will call agents ordered by their names. See Name.cpp for names. AgentPack::init() calls init() on all agents. AgentPack::update() calls update() on all agents. AgentPack::shutdown() calls shutdown() on all agents.
AgentPack *agents = new AgentPack(); try { agents->addAgent(new ScriptAgent()); agents->addAgent(new OptionAgent()); agents->init(); while (true) { agents->update(); } } catch (BaseException &e) { LOG_ERROR(e.info()); agents->shutdown(); } delete agents;
Rules for agents:
For example, agent "30video" can ask agent "20option" about screen_width in his init().
agent() method is made by AGENT(TYPE, NAME) macro. This allows us to obtain agent of preferred type and is not need to write agent() method for every agent.
OptionAgent::agent()->getAsInt("screen_width");