Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Keeping track of object data

This topic is 5562 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

While I was trying to work up some code, I came into a dilemma for my strategy game. I wanted to create a CommTest function that would test whether one object could establish a communication link with another object. The trouble was that of the parameters that I thought would be releveant...I wasn''t sure if some of these parameters should be inherent to the object, or if the object should run a test to determine the parameter value. For example, in a CommTest function, the function needs to know several pieces of data: 1. The target (a pointer to that object) 2. The sender''s comm range (a variable included within the object itelf...determined by its IntelligenceModule capability. I.e. this.IntelligenceModule.CommSend = 10) 3. The target''s comm range (i.e. NHobject->IntelligenceModule.CommReceive =5) 4. Any EW, Electronics Warfare being targeted at either the sender or reciever 5. Any ECW, Electronics Counter Warfare, being targeted at either object 6. Terrain for both objects (which may reduce the comm send or receive for each object) Herre''s what I was wondering though. Is it a better design it so that the object always knows what kind of terrain it is on, or only when necessary? Ditto for keeping track of things like whether it is under EW attack. Some kinds of data seem a little nebulous as to whether the data is internal to the object, or external. Which will have the worse overhead? I''d imagine it would be if the object always has to keep the data internal to itself, because it will always have to poll world data to see what terrain it is in, check to see if it is under attack, if it has EW on it, etc etc. If you only have to check when called for, say what kind of terrain its in...then you only need to test when it''s called for. Say for example, while it''s moving, when it is firing or being fired on, etc. The disadvantage to this is that as a local variable, it may need to make several tests at once (if for example it is moving, shooting, trying to make a commtest, and being targeted). In this scenario, the internal tracking is better, because it only makes a test once, and then as a data member variable, all the other functions can use this data...so only one test is run once).

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!