Writing an XNA Network Game

Throughout the rest of this chapter, we'll be building a game that uses the XNA networking APIs to enable multiplayer functionality across a Windows network. The same code can be applied to the Xbox 360 system link networking functionality.

In this section, you'll start with a new project, but you'll be using some code and resources from the project you completed in Chapter 7 of this book. If you don't have the code for Chapter 7, it can be downloaded with the rest of the code for this book.

Tip

I debated creating this chapter as a simple introduction to the networking API, and instead opted to demonstrate the API in a network game. However, because of that decision, this chapter has a large amount of code in it.

If you're weary of typing so much code, feel free to download the source code for this chapter and walk through it while reading the chapter. It might save you some headaches in the long run.

This chapter assumes that you've read through the book and are pretty familiar with Visual Studio 2008 and XNA Game Studio 3.0. If you find yourself not understanding those principles in this chapter, please refer back to the earlier chapters in this book.

Also, because all other games written in this book have used XACT for audio, I've assumed that by now you have a good feel for XACT and how it works. Hence, this chapter will instead implement sound using the simplified sound API provided with the XNA Framework 3.0. If you're looking to learn more about XACT, ...

Get Learning XNA 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.