Fun Infused Games  |   Smooth Operator

  Home   |    Archive   |    About
Posts prior to 8/2/2010 may be missing data. If you need one of those posts, please contact kriswd40@yahoo.com and I will try and recover/find it.

Global High Score Woes
Date 2/8/2010    Tags XBLIG, XNA, Abduction Action!    (0)

Like many XNA developers, I decided to use the most excellent High Score Component in order to create global high scores for Abduction Action!. I believe the setup to be pretty straight forward but my needs for Abduction Action! have made its implementation far more difficult.

The first big change I had to make was to change the component into just a basic class that I can initialize and use. Lots of XNA developers like game components (you register them and they call their own draw/update/etc methods in tune with your game class) but I prefer to explicitly call the update/draw/ etc methods from my game class. It's a bit more work to setup, but I like the added control this gives me and it makes it easier to pass objects into these methods.

The next big change I had to make was with the storage device. I have logic already built into my game (at the correct times) to prompt for and set the user's selected storage device. The high score component likes to set this itself right away. After removing this logic, I had to then update each method to pass it the correct storage device (if needed) which was made easier because my class was no longer a game component (see, there is some method to my madness).

The third (and far and away most challenging) change came due to the fact that I need to save not one list but two lists of high scores (for story mode and for score attack mode). The high score component was not designed with this scenario in mind. I managed to get this working by setting the Message property of each high score to either "ScoreAttack" or "StoryMode" and then adding a lot of new logic to break these apart when displaying them.

Largely this all worked but occasionally it ran into subtle bugs (things like Score Attack scores refusing to display more than 42 entries) and I believe this was also the reason remote scores were not being shared with other gamers. I found myself struggling to fix lots of little bugs and found the high score component hard to work with because of all the different lists it uses (userScores, aggregateScores, etc). This weekend, I finally bit the bullet and decided to quit trying to making this work and rather develop something from the ground up based on my needs.

My current implementation has four collections (I like collections because in addition to keeping track of all items in them, they can also have their own methods). These four collections are for local story mode scores, remote story mode scores, local score attack scores, and remote score attack scores. The two local score sets will save the top 50 (each) scores that come from your local system only. The two remote score sets will save the top 50 (each) scores from everyone sharing scores. By having four separate collections of scores, it makes it much easier to manage saving, displaying, and pruning scores than it was with one list containing all four types (or several lists that eventual became one list and then went back to being two lists).

Locally I got this all working with not too much trouble (though it was time consuming). I feel my new system is much easier to use and maintain than the previous one.

Remotely I am seeing this will be more challenging since I'm now sharing multiple lists and really have no prior experience with XNA network development. Fortunately the High Score Component does have a lot of networking functionality written that I can borrow from and in fact doesn't appear to need that significant modification.

Last week I attempted to test the remote sharing of scores without success... I suspect that it was actually sharing the data but not correctly saving it. That was another driving force for making these sweeping changes. I feel better now that when I get to the point of saving data, it will correctly do just that. Now the i


This article has been view 1342 times.


Comments

No comments for this article.


Add Comments

Name *
Website
  Name the animal in the picture below:

*  
Comment *
Insert Cancel
Things To Click


Tags
Video Games (7)  Trivia or Die (3)  SQL (1)  iOS (3)  Game Dev (11)  Advise (14)  PC (1)  World of Chalk (2)  FIN (20)  Abduction Action! (27)  XBLIG (32)  Abduction Action (1)  Nastier (4)  ASP.net (18)  Absurd (2)  Volchaos (11)  Web (19)  Fin (1)  XNA (40)  Rant (50)  Cool (2)  Visual Studio (1)  Trivia Or Die (1)  Xbox (1)  C# (14)  Sports (11)  Design (2)  Development (13)  Hypership (28)  WP7 (8)  VolChaos (1)  Nasty (34)  Abdction Action! (1)