Jump to content

  • Log In with Google      Sign In   
  • Create Account


Code Design Suggestion


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 aardvarkpoker   Members   -  Reputation: 100

Like
0Likes
Like

Posted 10 February 2012 - 07:19 PM

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?

Sponsor:

#2 Gasimzada   Members   -  Reputation: 206

Like
0Likes
Like

Posted 11 February 2012 - 10:52 PM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS