Additional Ideas


The game runs fine now and if you got through the final testing it is ready to be released. But even after that you might not have enough of it and you still might want to try additional ideas or think about future extensions. I often find myself reusing one of my existing engines just to test out new game ideas. It is just so much easier to use an existing engine you are already familiar with than to start from scratch.

This section is about additional ideas I had before even starting the development of the game and during the development time.

More Cars

Having more car models was one of my earlier wishes, but since I’m not a modeler and none of the modelers I know have much time and think it is “fun” to create a couple more car models for my little racing game, I never got beyond the initial 3D car model that was made specifically for the racing game. It was relatively easy to change the appearance of the car by changing the texture a bit and the starter kit version features three different car textures and some code to recolor the cars dynamically, but they all use the same underlying geometry.

The Speedy Racer Game mod, which is shown at the end of this chapter, will also feature another car model (just a free one from the Internet), but having even more different car types would be fun, especially if you give each car different speeds, acceleration, and braking parameters. For a multiplayer game it would also be more fun to have different cars so every player can choose his favorite car type.

But I guess having as many cars as the commercial racing games you saw in Chapter 12 will cost a lot of money to develop and it also takes a lot of time to get them as good as they are done in those games. Hopefully the community will find ways to import new car models, and after a while when there are more game modifications available enough cars can be found to make even better game modifications.

The car rendering code for the racing game is pretty specific; for example, the Model class uses a customized render method called RenderCar just for rendering the car. If you have more than one car model it would be harder to keep this method up to date and it would probably make more sense to implement the cars with the normal Render method.

Online Highscore List

Implementing a call to a web service and getting the top 10 online highscores from there is probably not a big problem. You would add such code in the Highscore class and you could even reuse most of the existing code from the Rocket Commander game.

Before you can use web services you will have to add the System.Web.Services assembly to your references list, which is only available on the Windows platform. All the web services code you are going to add to the Highscore class must be disabled on the Xbox 360 platform.

  Highscore[] onlineHighscores = new Highscore[10]; Thread onlineGetHighscoreThread = null; /// <summary> /// Get online highscores /// </summary> /// <param name="onlyThisHour">Only this hour</param> private void GetOnlineHighscores(bool onlyThisHour) {   // Clear all online highscores and wait for a new update!   for (int num = 0; num < onlineHighscores.Length; num++)   {     onlineHighscores[num].name = "-";     onlineHighscores[num].level = "";     onlineHighscores[num].points = 0;   } // for (num)   // Stop any old threads   if (onlineGetHighscoreThread != null)     onlineGetHighscoreThread.Abort();   // Ask web service for highscore list! Do this asyncronly,   // it could take a while and we don't want to wait for it to complete.   onlineGetHighscoreThread = new Thread(new ThreadStart(     // Anoymous delegates, isn't .NET 2.0 great? ^^     delegate     {       // See notes above       try       {         string ret = new www.xnaracinggame.com.           RacingGameService().GetTop10Highscores(onlyThisHour);         // Now split this up and build the online highscore with it.         string[] allHighscores = ret.Split(new char[] { ',' });         for (int num = 0; num < allHighscores.Length &&           num < onlineHighscores.Length; num++)           {           string[] oneHighscore =             allHighscores[num].Split(new char[] { ':' });           onlineHighscores[num] = new Highscore(             oneHighscore[0].Trim(), oneHighscore[2],             Convert.ToInt32(oneHighscore[1]));         } // for (num)       } // try   catch { } // ignore any exceptions!     }));   onlineGetHighscoreThread.Start(); } // GetOnlineHighscores(onlyThisHour) 

In order for this code to work you need a web service running at the specified location of the RacingGameService class. Writing the web service itself is rather trivial, but implementing a nice looking website that shows all this data to the visitors is quite a bit of work. Maybe this will be done in the future.

More Shaders and Effects

Having more shaders and effects in a game today is always a good thing, at least from the player’s perspective because games look cooler and more different than a few years ago when many games used similar rendering techniques and looked at least in that regard similar.

One thing you could plug in quite easily would be the parallax mapping shader from the Rocket Commander game, but you would also need a height map on all materials where you want to use the parallax shader instead of the standard normal mapping shader.

But adding effects and an effect manager system like for the XNA Shooter game would also be nice (see Figure 14-19). You currently have no effect at all, not even for a car explosion or crashing into something.

image from book
Figure 14-19

For more examples of some good post-screen shaders go back to Chapter 8. A racing game would greatly benefit from HDR rendering, especially if you change the lighting situations and drive through tunnels (as you actually do in the game).

The per pixel motion blur effect discussed in Chapter 8 would also be a lot better than the currently implemented whole screen post-processing effect, but it is obviously also a lot harder to implement.

The major thing I would always improve for a racing game mod is to change the color correction factors in the PostScreenMenu and PostScreenGlow shader classes and the underlying shader code. It will give the whole game a completely different experience without having to change all of the textures yourself.

More Game Modes

More game modes would also be fun. I’m not really a racing game expert, but maybe it would be fun to implement one or more of the common racing game modes you can often find in commercial racing games:

  • Beat the best time: This is the mode you have in the racing game currently. It could also be extended to more players and you would need to add some racing car AI for other players.

  • Be the first: For this game mode you obviously need more than one car and more than one driver. This is the main game mode for most racing games. It is currently not possible because you have no multiplayer and no computer AI code for handling other cars. Even with some AI code you would still need to improve the collision code for the cars, because now you would be able to collide with other cars on the track.

  • Practice mode: Special game mode for some racing games that allow you to train on the tracks before actually going into competition. You can test out tricks and train on certain parts of the track, but this whole game mode only makes sense if you would lose something by training in the competition game mode, which again is not the case in the racing game.

  • Time Trails: You have to complete the track or certain parts of it in a specified time frame. This way the game can get a lot harder for beginners because it is usually much harder to beat these times instead of just having to complete the track and beating some highscore or not.

  • Cone Parkour mode or driving lessons mode: You have to drive around cones placed on the road in a certain time frame or by not knocking over to many of them. Other parkours could involve driving on certain sides of the road or following the street signs.

  • Tricks: This is one of the more popular game modes, especially in the street racer games discussed in Chapter 12. Doing tricks means that you have to drift your car, slide through curves, or maybe even jump through certain parts of the track. Games like Trackmania have other kinds of tricks you have to perform to even complete a track. You do have loopings, but not most of the other advanced mode parts Trackmania has to make it more difficult completing tracks.

  • Crash mode: Some games have focused on crashing the car into walls and getting points for it or damaging your car as fast as possible. Sounds like fun for the first couple of times, but I never played those games long enough to discuss this any further.

  • Add weapons to the cars, or at least add items for special abilities. Many arcade racing games have this idea implemented and there are many different game modes that can come out of this idea. Items make even more sense in a multiplayer game where everyone is fighting each other and items help you destroy your enemies or push them aside to let you become the first-place player. Popular examples of these games would be Mario Kart, Wacky Wheels, and games like Micro Machines.

  • Implement your own game ideas or mix in existing game ideas into a racing game. You could even get rid of the racing part altogether and maybe add something completely different. The sky is the limit.

Multiplayer Mode

For most game modes just discussed it would be a lot more fun if you could play the game together with a couple of friends either in your local area network (LAN) or over the Internet. Because networking code is not possible on the Xbox 360, the multiplayer part would only work on the PC right now with XNA.

The main change you would have to do to the game after implementing the basic code for networking is to change the Player class and allow multiple instances of this class. You will also need to handle a list of players and update all the data for each player with help of multiplayer messages. Again, this alone could fill up a book because there are many issues with multiplayer games and many possible ways to implement such code.

As a little example, take a look at Figure 14-20, which shows a couple of such multiplayer network classes working together. The game class holds a list of player objects. Each player receives data from all the other players and adds all received messages to an internal list. Messages are loaded with the help of the Message class and the MessageType enum.

image from book
Figure 14-20




Professional XNA Game Programming
Professional XNA Programming: Building Games for Xbox 360 and Windows with XNA Game Studio 2.0
ISBN: 0470261285
EAN: 2147483647
Year: 2007
Pages: 138

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net