1
Game Development / Seperating Data, Logic, and Graphics.
« on: September 26, 2011, 03:11:25 PM »
(I seek wisdom, I hope this isn't too mundane a question.)
I can see how the separation of Graphics works rather well when using a tool like Unity, so I will skip that part and just straight to something that has me a bit heavy headed at the moment...
I am wondering whether or not I should go out of my way to create separate classes for data and logic parts of a program. (Having never coded for more then small 'fun' things its never been something to consider)
I can not seem to decide how much an object should do for itself, and how much should be done by a proxy class.
Example... A PC attack can be handled by the PC object, directly accessing its own methods stats the PC object has, or by a 'CombatResolution' object that gets an event that the PC is attacking an Enemy, and grabs each involved objects stats through get/set's.
Take a simple attack event. Should the event access an attacker class method, a weapon/ability class method, a combat resolver class method? etc... Each will accomplish the same result, but I am at a loss as to how to implement it with future (ease of) use/extensibility in mind.
Am I explaining this correctly?
What do you recommend?
I can see how the separation of Graphics works rather well when using a tool like Unity, so I will skip that part and just straight to something that has me a bit heavy headed at the moment...
I am wondering whether or not I should go out of my way to create separate classes for data and logic parts of a program. (Having never coded for more then small 'fun' things its never been something to consider)
I can not seem to decide how much an object should do for itself, and how much should be done by a proxy class.
Example... A PC attack can be handled by the PC object, directly accessing its own methods stats the PC object has, or by a 'CombatResolution' object that gets an event that the PC is attacking an Enemy, and grabs each involved objects stats through get/set's.
Take a simple attack event. Should the event access an attacker class method, a weapon/ability class method, a combat resolver class method? etc... Each will accomplish the same result, but I am at a loss as to how to implement it with future (ease of) use/extensibility in mind.
Am I explaining this correctly?
What do you recommend?
