Jump to content

  • Log In with Google      Sign In   
  • Create Account

Creating a stable and fast modual communications Infrastructure.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Mithrandir   Members   -  Reputation: 607

Like
Likes
Like

Posted 29 January 2001 - 04:16 AM

Well, I''ve been playing around with module designs lately, and its always very easy to build the individual game modules (graphics, audio, input), but arranging them in the grand sceme of things seems to stump me. About a year ago I got into the ''pluggable factory'' mode for an infrastructure which makes its own modules and organizes them based on thier priority. While the priority processing aspect of this style is a great idea, the need for a huge dynamic (and text based messaging system) moular system seemed kind of lofty. Why would we need a system this flexible? So then I took a look at managing techniques, and experimented with a tree based management hierarchy. BAD IDEA. The concept that a sub module can only communicate with its corresponding manager module slows things down to a crawl, especially if one low level module wants to speak to another low level module. Now, I''m thinking about using globals. gassp! The problem is, I want modules which can be replaced on a whim throughout the game. I have no idea where Im going with this, Im going to finish this post later, class starts in a few minutes.

Sponsor:

#2 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 29 January 2001 - 05:31 AM

Here are some lessons i''ve learned from creating my modular entity system:

-Modules will need precedent (order of update within 1 tick)
-Modules need a way to communicate to each other, i use:
a)event system similar to windows events. A message loop within an update queries a central message repository for that entity, responding to events of a particular nature.

b)indirectly through the use of a special type of module class i call the interface module.

Within an interface module, the calling module can invoke a stored callback within the interface module, which was registered by another module at creation time of the entity. The callback is nessecary for performance reasons (as the event system takes 1 tick to process which can add significant latency if a tick is greater than 100ms.)

Interface modules are special in that an entity can only have 1 of a particular type. I have various interface modules for collision, AI, etc..

They also serve as a repositroy information, usually stored in tables with logical name id mapping scheme. (a constant such as AI_TRACK_TARGET which maps into a hastable etc..)

-Use refrence counting for entites stored within the various lists/tables of the modules. It''s impossible to keep track of all the entites within such a dynamic system, best design for it from the begining.

-Balance modularity with complexity. If you can get a behaviour you want out of a minimum number interconnecting of modules and they are reuseable then thats good. Don''t try to get complex behavior through many small modules, rather a large customizeable one is better.

-You''ll need to instantiate your entity classes at start time, you''ll need a way to convert the text name of a module into its logical class. Name each module uniquely.

-You''ll need to implement a save/load function for each module. This function saves/loads data between loading/saving games. It doenst have to save any data but some updates do need to.

Good Luck

-ddn





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS