Game Development Community

Multi-player in same client

by Joey Skinner · in Torque Game Engine · 11/05/2007 (8:12 pm) · 4 replies

I'm trying to find a resource or hints on how to have 2 players controlled from different keys/gamepads on the same computer. I haven't been able to find anything. I see how to do a split screen. But does anyone know how to have multiple players and be able to make certain input keys/buttons go to control the moves on a specific player while other keys/buttons control the moves on the other player? I'm sure it will take engine changes but I've done plenty of those already.

#1
11/10/2007 (10:38 am)
Anyone? I'm surprised nobody has seen or asked this question before. Given all the co-op type games out there.
#2
11/10/2007 (1:12 pm)
It's doable, but not particularly trivial. Torque is set up to expect only one control object per client, on both the server and the client, and it becomes rather complicated with a lot of code areas to touch when you want co-op in a standard TGE game.

For starters, you'll need to look at:

The networking layer on the client, to make sure you are creating two Move structs, and collecting them (default.binds.cs, as well as implementing the second struct and initializing it on startup)

Networking layer on the server, to make sure it keeps track of which control object is to receive each of the move structs. This also requires actually being able to receive two move structs, and passing them to the right control objects for each player.

That doesn't sound like a lot, but off the top of my head it's having to interact and modify some very complex, and very core systems. It might almost be worth taking a look at simply running two Torque clients on one machine, but that has another completely different set of issues, performance being a big one.
#3
11/13/2007 (5:31 pm)
There is a resource for this. For contolling 2 players at the same time on one PC. I think the camera just follows the first player. By combining this along with the split screen resource you can get it to work. It will slow down your frame rate a bit. I will search for this and let you know in my next post.
#4
11/13/2007 (5:37 pm)
Try this.

SINGLE SCREEN MULTIPLAYER for TGE

http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10170