Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Oh well...

Sign in to follow this  


I've been working on the TBS engine from friday to saturday night and I stumbled upon some problems with the command behavior I wanted to use for the command machine. In fact, I had some problems to pass around the different paramters that are needed.

Basically, a command is used on a receiver calling some kind of action that has to be done. Mostly this action is bound to some data whichs structure is only known to the invoker and the action itself.

Since I wanted to have a generic command which could handle all kind of unknown commands, I had to pass 4 parameters : the receiver, the action function to use, the data size and a pointer to the generic data (void*). Sooo... the first problem for me was that I always had to know the receiver. It's not possible for an invoker to start a command, if it doesn't pass the receiver to the command class. The second problem was the data itself. Since it was generic and had to be passed to the command class by the invoker, the creation of a command was quite ugly. I wanted to have it in the constructor because the execute function would be a stupid place to pass the data. And this made the CreateCommand function very ugly to use.

So, after a lot of thinking (of 5 hours of work I've only been programming for an hour or two), I decided to skip the command behavior and directly pass register an action function and a receiver for a given message within the command machine. This is as flexible as the command behaviour but has a lot less classes to implement and to manage.

Yesterday I had two hours to work. So I sat down and started to implement the database idea I had. Since I don't want to analyse for every call a "SELECT ... FROM ... WHERE ...", I implemented several functions in my entity management that are called GetEntitiesWhere( param, value ), GetEntitiesWith( param ), etc. Since the entities are all data driven, I can quickly find the entities that have a given value in a parameter ( ie "entitytype" and "building") or that have a given parameter ( ie "timedevents" ). The examples are just those who came into my mind right now.

I also implemented the entity management which contained some functions such as Add, Remove(Entity) and Remove(EntityList). Since the entities can be passed around, I have added reference counting through my libraries IBase class (AddRef, Release and GetInterface).

Basically I now have a complete entity management which will allow me to create the data tables and connections for a game.

One thing I have to think of is how to handle parameter lists within a parameter and template entities.

The same procedures can be used to manage landscape information such as the underground properties for a given landscape/tile/whatever.

I feel I am progressing here.
Sign in to follow this  


Recommended Comments

There are no comments to display.

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
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!