I'm writing an FPS XNA game. It is going to be multiplayer, so I came up with the following:
- I'm making two different assemblies — one for the game logic, and one for drawing it and the game irrelevant stuff (like rocket trails).
- The type of the connection is client-server (not peer-to-peer), so every client connects to the server, and then the game begins.
- I have decided to use the
XNA.Framework.Game
class, for the clients to run their game in window (or fullscreen), and theGameComponent
/DrawableGameComponent
classes, to store the game objects, update, and draw them on each frame.
What should I do on the server side? I got few options:
- Create my own
Game
class on the server, which will process all the game logic, without graphics. I am not using the standardGame
class because, when I callGame.Run()
, the white window appears and I cant figure out how to get rid of it. - Somehow, use the original XNA
Game
class, which already has theGameComponent
collection and Update event (60 times per second, just what I need).
I have additional questions:
First, what socket mode should I use? TCP or UDP? How do I actually let the client know the order in which packets are meant to be processed?
Second, if I am going to use the exact GameComponent
class for the game objects, which are stored and processed on the server, how do I get them to draw on the client side? Should I inherit them, while they are combined in an assembly), or something else?