Fun Infused Games  |   Smooth Operator RSS 

  Home   |    Archive   |    Subscribe   |    Search   |    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


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