Jump to content
  • Advertisement
Sign in to follow this  
maxfire

Game Logic

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

Hey gys, I am currently coding/designing and SDL game Engine and Designer for old RPG style games (zelda, gauntlet, etc). I am currently up to implementing my combat system. Was just wondering if you gys could help me decide on my final design for my implementation.

Currently I have all my logic in one class. this class holds every game item then deals with movement and collisions, calling update function telling individual items how to react depending on the parameters passed in.

Now would it be wise to simply add my new logic combat logic to this class, still directly informing the game object, or should I decouple my logic so that I split the new logic into a new class.
I would then have this scenario, the logic engine would detect a collision decided on the type of collision (an attack, wall boundary, ect) and then pass the relevant object pointers to correct system class.
In game terms if an attack collision was detected the attack object and the attacked object would be passed to my combat system, this system would then make the relevant decision.

See my diagrams bellow;

My question is is this a logical way to go about it, since im simply passing pointer memory references there wont be much of a memory increase so performance loss isnt an issue. Or am I simply making it over complex.


Sorry for the long winded explanation :D

Share this post


Link to post
Share on other sites
Advertisement
Depends on the code and your goals for it, really; the first approach is certainly simpler and will likely be easier to implement the first time, but the second will likely be more flexible in case you want to expand or enhance the game logic down the road. If you can make it work with the first method, I say go for it; just pay careful attention to areas where things seem awkward or sticky, and think about whether or not it would make sense to split out into the second design. Nothing says you can't switch horses in mid-stream, after all!

In general, though, I say prefer the simpler solution unless you find that it's getting in your way.

Share this post


Link to post
Share on other sites
Sign in to follow this  

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