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:

<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?




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.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .