Sign up ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm working on a small-ish 2d fixed shoot 'em up for iPhone.

I have a master Game object that stores lives, score, current level, etc...

The game will have some other persistent attributes like Music and Sound mute state, difficulty level (easy, medium, hard).

Should I put those attributes in the Game class or should they be on their own?

What's the rule of thumb to decide how to partition attributes among classes?

share|improve this question
Rule of thumb I use: If it needs releasing, don't bother too much. If it's scalable, try your best to keep it organised. – The Communist Duck Nov 18 '10 at 16:50

2 Answers 2

up vote 3 down vote accepted

It's all subjective, but consider the Single Responsibility Principle as a "rule of thumb". If you break them up now then you can potentially do things with the separate classes later without worrying about messing it up. Maybe you'll want the game object to be deleted and recreated every level, and if you split them up you won't have to worry about the design needs of one affecting the other.

share|improve this answer

This is a relative question and I'd say it depends on how you feel would be easier to maintain. If your game would grow 2, 3 or 10 times its size. Would it get lost outside the Game object? Or would it be lost inside the Game object? You just have to put it where you feel it belong, I don't think there are any rule of thumb here.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.