Friday 19 February 2010

Week 17 : 'How to' , 'Credits' & final testing

So this is the final week of the project and I needed to wrap everything up and finish off a few key things. The biggest task I had to do was creating the how to section. This has been something I'd been putting off throughout the project, mainly because I kept changing the game but also because it was going to take a long time to plan out and condense all the information I wanted to communicate down to as a few a words as possible.

With the game-play finalised I was finally able to create the guide. First I wrote down everything I needed to tell the player, then I split the information into categories and then split those categories into small sub sections. So, for example, in the Combat section of the how to, I had 4 subcategories : Attacks, cooldowns, combos & overload (static charge).

As you can see I also renamed a few things because they were too long, e.g static-charge and fully-charged.

Next, with all the categories and sub categories defined I then needed to come up with a design to navigate through all this information in a clear a way as possible. This is the template I came up with:


Everything is on layers in Photoshop so creating a new screen was a matter of copying the master template then adjusting the text and highlighted sections. I then proceeded to make all the pages with this template, adding images to illustrate the point of each page as well as colour coding key words.

You can see all the screens in the screen-shot album for this project @ http://picasaweb.google.com/lsmton3s/Charged02#

Once I had all the screens, I expanded the place holder how to system to navigate with sub categories. After testing it on both the 360 and windows builds of the game I moved onto the final changes I wanted to make:
  • Added glow to logo screen text
  • Replaced main menu screen with shaded in and improved glow version of original
  • Added the version display at the bottom left hand corner of the main menu
  • Added a credits screen to accredit the sprite animations, button graphics and music
Here's a video of the credits and how to sections:


With everything finalised and tested on the windows build, I went for what I though would be a routine test on the Xbox 360 with version 1.0 of the final game. I'm going through this bug in great detail because it turned out to be a very important fix that may well have gone completely unnoticed.

I loaded the game on the 360, the menus and new assets worked fine and everything was nicely within the tile safe area. Just to be sure that the user couldn't force an error or an unhanded exception out of the how to system (as is relies on two index integers being correct) I spent about 5 minutes just rapidly switching through the menus and subcategories like a mad man. The game didn't crash and everything seemed fine although strangely, the navigation sound click stopped playing after a while. When I noticed this I exited the how to section and the menus weren't making a sound either. Then, when I went to the 'Play' option the game crashed!

This has me in a cold sweat, so I re-ran the game but this time debugging it from my laptop on the windows version. I did exactly the same thing and this time I didn't get an error. From previous experiences with bugs on the 360 and not on the pc I suspected this would bug would be to do with something happening too quickly for the 360 to process. So, I debugged the game via the laptop to the 360. I tried the same thing again and it crashed again but this time it told me what was wrong : There were too many instances of sound effects already existing in menus.

After a little bit of research I found out that the 360 can only store 300 sound instances at once in memory else it throws an exception (crashes the game). This seemed odd as at most my game would be running 20 - 30 sounds at once using the fire and forget system which is when you play a sound effect directly and then it is automatically disposed off once its stopped.

So, to avoid getting this bug I would need to store an instance for every sound I used then delete it myself just to be sure that I wouldn't get this game crashing error. I created a component that has a method that plays a sound effect.

What it does is take the sound effect, make an instance of it, play that instance then add it to a list of all sound effects. That list is constantly looped through, any instances that have stopped playing are disposed of then removed from the list.

Just to be safe I added a condition on playing a sound effect that if there were 200 instances (which there shouldn't be even close to at one time) then don't play the sound effect. I re ran the new build on the 360 and did the same thing as before. What happened this time is that the sound stopped playing , but when I went to play the game it didn't crash because I had stopped it creating new instances if there were too many.

This didn't make any sense, so I drew the number of items in the list to the screen and ran the game again. It was then that I saw the problem. Each navigation click sound was never being deleted, other sounds were being disposed of but not this one. So I used a break point and found that there was a strange error with the click sound. The problem was that the click sound lasts for about 1/10 of a second and the 360 doesn't have enough time to process that it's been stopped so its state is always playing. My list was deleting sounds that had stopped so these clicks were just adding up till eventually there were no more instances left and the game threw the exception.

To solve the problem I edited the sound in Audacity to have 1/2 a second of silence, extending its total duration. When I tested the game with this new sound, it was being disposed of and everything was now working fine. I also noticed that some sounds were taking quite a while to remove so I shortened a few other sounds that had a lot of silence in them.

After that discovery I then spent the next few hours doing every random combination of things I could think of to make the game crash such as going back and forth between menus rapidly, creating and deleting players, d/c controllers etc and thankfully nothing came of it.

This may be my final post as next week is the hand in date however I may be submitting the game to Xbox Live Indie games to purchase for the lowest cost of a game (80p or something like that). Although I'll have to check if I with the music's composer and the rules and regulations of the XNA creators club I'll keep this updated with any Charged! related developments.

No comments:

Post a Comment