Skip to main content
GameDev.net gamedev.net
🔒 Locked

Code Design Suggestion

Started by aardvarkpoker Feb 11, 2012 at 1:19 AM 0 replies 2k views
Original Post
aardvarkpoker
aardvarkpoker
I'm working on the very start (design doc) of a game coded in java. It is a management-type game where the player controls characters (think The Sims). Each character will have stats relating to all sorts of things. I have never looked at the code for a game like this, so I don't know what the typical way of coding this is. Right now I have a Character Object which all characters will be based on, and Character members have members of that Stat object (Stat dagger, Stat sword) etc. etc. Is this how they is typically done? The Stat object will have members such as int level, int xp, int[] stat_modifiers, etc. I'm thinking they will also have Stat strength, Stat speed, etc. As the player has the character perform certain actions xp will be gained and every so often xp will reach a certain level and the character goes up a level in each Stat.

So my summarized question: Do characters usually have a series of Stat objects which keep track of level, xp, and modifiers or is there another way this information is stored?
Gasimzada
Gasimzada
I would use Component Based Game Entity system, where you have an entity class object, which has different components (health, ammo, level, etc etc). and each component will have an update function where they will send events like "levelUp" to different components and the components will react to them using observer/listener pattern. Start with that. The system I built started like that but as time passed and I started adding new features to my engine, through experience, you will make it better and better over time. Like adding subsystems, attributes, behaviors etc. But start simple and then see what features you need.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.