Fun Infused Games  |   Smooth Operator  |   Evil Scale  |   Starcraft Live  |   Wellplayed.net RSS Feed Available 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!    (7)

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

Wellplayed.net
This article has been view 33 times.

Advertisement:

Comments

Scott

Avatar

2/9/2010 9:37:27 PM

With the exception of multiple score boards, this is something I've wanted to look at doing. I think you're making me rethink that idea ;).h
Kris

Avatar

2/10/2010 7:32:28 AM

I don't think it would be that bad with one scoreboard... still not all that easy to test, but several other developers have had good luck with it. I would give it a shot at least. The multiple scoreboards/lists is what has made this the most challenging.?si
Kris

Avatar

2/10/2010 7:33:00 AM

IF i can get this working right with the multiple scoreboards, I'll post my code here too.<ifr
Beringela

Avatar

2/11/2010 3:55:00 AM

Hi Kris, worth mentioning the possibility of code 4 crashes when using the highscore component as outined here: http://forums.xna.com/forums/p/41636/283442.aspx#283442
You are maybe already aware, but just in case :)is
Beringela

Avatar

2/11/2010 4:47:50 AM

Hi Kris, worth mentioning the possibility of code 4 crashes when using the highscore component as outined here: http://forums.xna.com/forums/p/41636/283442.aspx#283442
You are maybe already aware, but just in case :)is
Beringela

Avatar

2/11/2010 4:48:08 AM

Hi Kris, worth mentioning the possibility of code 4 crashes when using the highscore component as outined here: http://forums.xna.com/forums/p/41636/283442.aspx#283442
You are maybe already aware, but just in case :)is
Kris

Avatar

2/11/2010 9:37:14 AM

Yes, that is something to be very careful of. For Abduction Action!, I'm limiting the number of scores saved. I was going to do just 50, but I don't think it would hurt to allow 100 or so. That should hopefully prevent a bug like this.


Add Comments

Current disabled. Check back soon!
top
top


top
Tags
ASP.net (17)  Annoyances (4)  Video Games (6)  Sage-Like Advice (12)  Domain Name (1)  Internet (5)  NFL (2)  Writing (1)  Visual Studio (1)  Hypership (12)  Site News (2)  Xbox (1)  C# (15)  Sage-Like Advise (1)  Education (1)  Tech Support (1)  MSSQL (1)  Absurd (1)  Abduction Action! (27)  Nasty (36)  Economy (1)  Cool (2)  Sports (11)  .Net (1)  Web Tools (2)  Abduction! (1)  Rant (40)  XBLIG (20)  Tutorial (2)  Nastier (1)  Books (1)  Realty (1)  Programming (3)  Weird (1)  Vista (1)  Development (14)  Design (3)  XNA (35)  Links (1)  Security (2)  JavaScript (7)  CSS (1)  Video (2)  Web Development (1)  Computing (1)  Abudction Action! (1)  Popularity (1)  Game Design (4)  Google (1)  AJAX (4)  Game Development (8)  
top

top
top


Twitter

    Follow me on Twitter



    Buy My Games:
    Abduction Action!
    Nasty

    I'm with Coco.