Multiplayer split screen on one PC?
by Andrew Larder · in Torque Game Engine · 06/26/2007 (3:28 pm) · 1 replies
(This should probably be posted in the TSE private forums, except they seem to have disappeared. Anyhow, the technology should be exactly the same in the std torque as well.)
How easy would it be to add the ability to have split screen multiplayer to Torque, for up to 4 local players? I can see that adding multiple 3D views shouldn't be that hard, but the infrastructure between the client and server looks a lot more difficult. As far as I can see the engine only sends move data from one player to the server, and I guess only supports one net connection to the server as well. Looks like I'd have a lot of C++ recoding to do to support multiple channels, unless there is some code hidden away that I haven't come across yet.
Could someone in the know give me some idea of which bits will have to be recoded?
Cheers,
Andy.
How easy would it be to add the ability to have split screen multiplayer to Torque, for up to 4 local players? I can see that adding multiple 3D views shouldn't be that hard, but the infrastructure between the client and server looks a lot more difficult. As far as I can see the engine only sends move data from one player to the server, and I guess only supports one net connection to the server as well. Looks like I'd have a lot of C++ recoding to do to support multiple channels, unless there is some code hidden away that I haven't come across yet.
Could someone in the know give me some idea of which bits will have to be recoded?
Cheers,
Andy.
Associate James Lupiani
Sickhead Games
There are a few ways to go about it. The one that seems to have the lowest impact (that I've tried so far) is to subclass GameConnection in a manner similar to AIClient/AIConnection. The downside with this approach is you might run into problems updating and interpolating objects. You also might run into problems sending and receiving RPC-type calls (commandToServer/commandToClient) depending on the engine and how you set up your connections.
A second way is to make GameConnection support multiple control objects. This can get hairy because there are so many places that assume a given connection has only one client. You can work around this by storing off index numbers in GUI controls and scripts, but it's a pain. The further you are into your project, the more work this takes.
In both cases you'll run into a few organizational concerns with the architecture being based around one instance of the game having one connection (GameConnection::getServerConnection() or GameConnection::getConnectionToServer() depending on the version of the engine). Scoping of objects for rendering as well as networking are concerns as well.
Either way, you'll probably have to add support for multiple controllers in MoveManager. This essentially involves making those static variables into arrays, and is covered by another resource on GG (the URL currently eludes me).