Sign in to follow this  

Game Modules - Feedback request

This topic is 4664 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I'm planning on using a modular design for my game essentially these modules are black boxes with a set of inputs and outputs. Modules trigger another module by activating the appropriate input trigger of the target module. Then the module does whatever processing is needed and actives the appropriate output trigger. The design for a module is as follows: Input data - sends needed data to the module, Input trigger – triggers the module. Output data - sends returned data to the caller. Output trigger – triggers another module. Mechanics – The mechanics of how the module functions. Rules - The instance specific rules for handling the module. There can be multiple inputs and outputs for a given module. Base modules will normally have a set of predefined inputs and outputs, which may be different in a particular instance of a module. The overall purpose of using this design and implementation method is to keep different game mechanics separate, to allow for easy customization of instance specific game mechanics, and to create complex in game interactions but at the same time limiting and simplifying the connections between different modules. It should also hopefully allow from improved creation of procedurally generated content, which my current game relies heavily on. An example of module might be this: Security Control: Input triggers – Security Alert - Explosion - Containment breach - Security device Activated. Output triggers - Investigate - Activate security device. - Evacuate - Call for assistance - Activate failsafe The rules for a given how Security control work would differ depending on the facility a low security facility might active the investigate trigger after 3 security alerts occur from that source. While a high security facility might activate a half dozen motion tracking guns after one security alert. What do people think of this method? Do you see an obvious flaws or problems with it that, as well as possible solutions to them? :)

Share this post


Link to post
Share on other sites
i think its related...

#ifndef NODE_H
#define NODE_H

#include "signal.h"

class World;

/**Base abstract 'Node' framework class

This class is the class inherited by each node.
Node's are different part's of the application,
and can be thought of as little clients.
Signals are recieved and sent as strings.*/

class Node
{
public:
/**update class pointer to parent*/
Node(World *par);
/***/
~Node();

/**Recieve and Interpret a signal

RecieveSignal should be overriden, by all derived
node classes*/

virtual void RecieveSignal(const string &id , Signal &sig);
protected:
/**Send a signal to parent to broadcast

Broadcast should not be overriden as it is used
to communicate with the other nodes, via the parent*/

void Broadcast(const string &id , Signal &sig);
/**Send a signal to parent to relay

SendSignal should not be overriden as it is used
to communicate with the other nodes, via the parent*/

void SendSignal(const string &name , const string &id , Signal &sig);
private:
World *parent; ///< Node's Parent
};

#endif


all game nodes, derive from that class (like Backgrounds, Events .etc).

#include "world/world.h"
#include "node/background.h"
#include "node/startupresource.h"

int main()
{
World myworld;

BackgroundNode bg(&myworld);
StartUpResourceNode sur(&myworld);

myworld.Register("background",bg);
myworld.Register("startup",sur);

return 0;
}


so if inside one of the nodes i ever want to signal to another node.

/*testing testing*/
Signal sig("xmlpath startup");
sig("str" , (const char*)"hello")
("age" , (int)10)
("pi" , (float)3.141592654);

SendSignal("startup","do startup",sig); //send signal to startup
Broadcast("do startup",sig); //send signal to all nodes


hope it helps!

Share this post


Link to post
Share on other sites

This topic is 4664 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this