Skip to main content
edited tags
Link
DMGregory
  • 140.8k
  • 23
  • 257
  • 401
Tags go in tags, not title.
Link
House
  • 73.5k
  • 17
  • 188
  • 276

XNA Client Server Multiplayer Project - Windows Forms and XNA

added 421 characters in body
Source Link
George
  • 127
  • 7

I have reviewed the relevant WinForms/XNA samples here and here.

However, my requirements are slightly different.

Given the following:

  • I am developing a multiplayer (Client - Server) game
  • There will be three projects in the solution, one for Client and Server respectively, plus an additional one containing the core game/engine
  • The instances will share common code from this engine project (core Game Engine functionality)
  • I require the Server instance to also allow management of the server (e.g. connection list etc.) via a Windows Form
  • Finally, and importantly, I am proposing to use the Dependency Injection pattern on initialisation of the client/server instances to inject the relevant network management class as required - similar to the approach here

What is the best way to achieve this? Specifically, are there any flaws with organising the projects in the solution the way I have proposed above? For the Server project, do I start it as an XNA project and then call the Winform, or vice versa?

Thank you for any advice you can spare.

Edit - a brief example of the "dependency injection" style pattern I plan to use. Forgive me if this is not an example of "pure" / full / traditional DI!

// Create the server
using (var game = new ExampleGame(new ServerNetworkManager()))
{
    game.Run();
}

// Create the client
using (var game = new ExampleGame(new ClientNetworkManager()))
{
    game.Run();
}

I have reviewed the relevant WinForms/XNA samples here and here.

However, my requirements are slightly different.

Given the following:

  • I am developing a multiplayer (Client - Server) game
  • There will be three projects in the solution, one for Client and Server respectively, plus an additional one containing the core game/engine
  • The instances will share common code from this engine project (core Game Engine functionality)
  • I require the Server instance to also allow management of the server (e.g. connection list etc.) via a Windows Form
  • Finally, and importantly, I am proposing to use the Dependency Injection pattern on initialisation of the client/server instances to inject the relevant network management class as required - similar to the approach here

What is the best way to achieve this? Specifically, are there any flaws with organising the projects in the solution the way I have proposed above? For the Server project, do I start it as an XNA project and then call the Winform, or vice versa?

Thank you for any advice you can spare.

I have reviewed the relevant WinForms/XNA samples here and here.

However, my requirements are slightly different.

Given the following:

  • I am developing a multiplayer (Client - Server) game
  • There will be three projects in the solution, one for Client and Server respectively, plus an additional one containing the core game/engine
  • The instances will share common code from this engine project (core Game Engine functionality)
  • I require the Server instance to also allow management of the server (e.g. connection list etc.) via a Windows Form
  • Finally, and importantly, I am proposing to use the Dependency Injection pattern on initialisation of the client/server instances to inject the relevant network management class as required - similar to the approach here

What is the best way to achieve this? Specifically, are there any flaws with organising the projects in the solution the way I have proposed above? For the Server project, do I start it as an XNA project and then call the Winform, or vice versa?

Thank you for any advice you can spare.

Edit - a brief example of the "dependency injection" style pattern I plan to use. Forgive me if this is not an example of "pure" / full / traditional DI!

// Create the server
using (var game = new ExampleGame(new ServerNetworkManager()))
{
    game.Run();
}

// Create the client
using (var game = new ExampleGame(new ClientNetworkManager()))
{
    game.Run();
}
Source Link
George
  • 127
  • 7
Loading