Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

So I am making a simple 2D game in XNA, and I want to implement different users (players), so each person playing can have their own high score, can only play levels they've already played, can only edit levels they've made, etc.

The levels are currently stored in XML, in the format:

<level>
<name>Level Name</name> <number>14</number> <authorTime>12.45</authorTime> <map>...</map> </level>

I was wondering what would be the most efficient way, and the best practise approach, to implementing this?

I am currently torn between two options: 1. each level having a <users> tag, containing a user ID and a time if they have completed the level. 2. Having a separate XML file, containing users and a list of their levels and times.

Are these good ways to do this? Are there other ways to do this better?

Thanks,

Simon

share|improve this question

1 Answer 1

I'd not mix users with level database. Second variant (separated user base) is easier to expand and support. If you'd ever want to implement mid-stage save, rewriting the whole levels.xml for the save would be..sub-optimal.

If you want to store all the levels (including user-made) in a single file, then user id tag would be enough to distinct them. Otherwise you can create additional xmls for every level created, with creator id attached.

share|improve this answer
    
Yeah, that makes sense - thanks :) –  simonalexander2005 Jan 31 '14 at 17:51

Your Answer

 
discard

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.