Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

Fish Fillets - Next Generation Documentation

GenGine is work name for our Game Engine. Engine architecture composes of agents responsible for specific action.

AgentPack

AgentPack groups agents which have something to do. It inits agents, update them and shutdown them at the end.

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.

Minimal application

 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;

Note:
MessagerAgent is always included in AgentPack. It is need to register every agent as listener during AgentPack::addAgent().

BaseAgent

Every agent inherits from BaseAgent.

Rules for agents:

  1. Agent must not call other agents in his constructor.
  2. Agent can call only agents with lower names and oneself in his init().
  3. Agent can call only agents with higher names and oneself in his shutdown().

For example, agent "30video" can ask agent "20option" about screen_width in his init().

Communication

Every agent has static method agent(). It asks AgentPack::getAgent() for agent instance.

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.

How to get screen_width

 OptionAgent::agent()->getAsInt("screen_width");

Generated on Wed Jun 1 09:54:30 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2