Lately I've been working on bringing my game Pong RPG to the Xbox.  I've slightly changed the title to Ping Pong RPG to make it less like the Atari version and more like my own.  The most exciting part though is the new code!  Here are some of the details of the new code...

In the PC version of Pong RPG, every image/sprite had it's own file.  This means every time I loaded a menu I had to load each menu item, the background, and any other pieces that weren't part of the already loaded images.  To make matters worse, since all my menu items are custom text images, I needed a way to show the user was 'hovering over' (remember, on PC they have a mouse to use) the image.  This means not only did every menu item have it's own file, but the outlined, 'hovered' version also had it's own file that needed to be loaded.  This obviously led to unintentional lag and memory usage.  To fix this issue, I've started creating Sprite Sheets that have all the different textures needed for a screen in 1-3 larger files.  My sprite objects then have Source rectangles that pull the correct image from the sprite sheet.  I haven't worked on the menu items that have hovered versions, but I'm considering simply making a background image to go behind the menu item to signify it's hovered.  Also since it's on Xbox, there will be a little 'A' button image next to the highlighted item.

But wait, it gets worse.  The code written for the PC version of Pong had hundreds upon hundreds of lines of code per class.  For Pong RPG PC, I created functions that essentially create a sprite for me, taking the parameters Name, Scale, Position, Rotation, FILE, etc...  What ended up happening was I needed to write a line or two of code PER image I wanted to load.  Remember, I had tons of images including menu items and their hovered counterparts.  This led to very, very long load statements.  In Pong RPG for Xbox I've simplified the code somewhat by introduing 'LoadFiles'.  A LoadFile is a simple text file filled with statements used to load sprite and image data.  Here is a sample:

'Comment Line - Not Read
SpriteSheet, Sprites\Common\MainMenu
Sprite, MainMenu, CreditsButton, CENTER, CENTER, 0, 1.0, 1.0, 0.1, true, 0, 0, 100, 100

Obviously this is somewhat cryptic to those who don't know the format, but essentially it defines all the parts of the sprite; texture file, sprite name, screenX, screenY, rotation, scaleX, scaleY, layer, visible, sourceX, sourceY, sourceWidth, sourceHeight.  Now, using a text file may be somewhat of a performance hit but I think it really simplifies the code and makes it much easier to read.  Towards the end of Pong RPG PC development was becoming unbearable due to the size of the files, this alleviates my issue.

A final little side note, since I'm running the game on a 1280x720 resolution rather than a 1024x768, all my images are in 'HD' and look pretty cool when plastered upon my plasma TV.

All in all the conversion of Pong RPG PC to Xbox is going pretty well.  A lot of the work is technical and the end user won't ever see and even though the development time may increased slightly due to my work on the updates, the code is much more managable and easier for future work.  I'd like to work on another series of XNA tutorials detailing some of the implementation strategies I've done but I'll have to see how much time I have.