Client / Server Modifications ...
by Melv May · in Torque Game Engine · 11/24/2002 (10:05 am) · 5 replies
Alright, I admit that I'm not exactly an expert when it comes to the details of clients connecting to the server. With that established, I wonder if anyone could give me a little bit of advice on how to proceed with my problem.
As far as I understand, at the moment, we have a NetConnection class that has a GameConnection implementation specific for the FPS game-case where a PC hosts a server and has a local connection and remote clients can connect into the game and appear as and when they like. I'm correct so far?
Okay then, for my game I require a little different functionality. My game is a turn-based system where at the beginning a PC will host a game and specify the number of allowed players. As players connect, the hosting PC will allow or disallow them via the gui on the host PC. When the hosting user is happy then the game will commence and no more connections will be allowed.
This is obviously different to how it's setup at the moment whereas remote clients can pretty much pop into the game at anytime. I require a 'gathering' of clients before the gameplay starts. I assume I'll have to do a new GameConnection class which I don't like the sound of or could it be reworked with minimal effort?
Are there any examples of this kind of modification in anyones game that they could share or simply provide me with a little insight into where to look.
Treat me gentle as I'm pretty new to the connectivity side of things.
Any help would be appreciated though.
- Melv.
As far as I understand, at the moment, we have a NetConnection class that has a GameConnection implementation specific for the FPS game-case where a PC hosts a server and has a local connection and remote clients can connect into the game and appear as and when they like. I'm correct so far?
Okay then, for my game I require a little different functionality. My game is a turn-based system where at the beginning a PC will host a game and specify the number of allowed players. As players connect, the hosting PC will allow or disallow them via the gui on the host PC. When the hosting user is happy then the game will commence and no more connections will be allowed.
This is obviously different to how it's setup at the moment whereas remote clients can pretty much pop into the game at anytime. I require a 'gathering' of clients before the gameplay starts. I assume I'll have to do a new GameConnection class which I don't like the sound of or could it be reworked with minimal effort?
Are there any examples of this kind of modification in anyones game that they could share or simply provide me with a little insight into where to look.
Treat me gentle as I'm pretty new to the connectivity side of things.
Any help would be appreciated though.
- Melv.
About the author
#2
I do need to study the way the script connectivity works but I was hoping for a few pointers before I proceed. I'm trying to fast-track it because I've spent an awful lot of time this weekend getting the fx-stuff into the [HEAD] as lots of people have requested. It took up more time than I had expected.
My game starts by having a player host a session, clients will then connect and request to be part of the game. The host will accept/reject using a gui on their end. When the host player is happy that they have enough players they can proceed with the game. Essential, the game doesn't start until the host is happy with the team.
This is basically what I require but I know that the system as it stands simply allows a player to host a session and clients join into a running game.
You see the difference I require?
As I know little about the way the scripts work with connectivity at the moment I was simply looking for pointers. I was kind of hoping that this had been done before to save me some trouble.
- Melv.
11/24/2002 (1:02 pm)
Xavier,I do need to study the way the script connectivity works but I was hoping for a few pointers before I proceed. I'm trying to fast-track it because I've spent an awful lot of time this weekend getting the fx-stuff into the [HEAD] as lots of people have requested. It took up more time than I had expected.
My game starts by having a player host a session, clients will then connect and request to be part of the game. The host will accept/reject using a gui on their end. When the host player is happy that they have enough players they can proceed with the game. Essential, the game doesn't start until the host is happy with the team.
This is basically what I require but I know that the system as it stands simply allows a player to host a session and clients join into a running game.
You see the difference I require?
As I know little about the way the scripts work with connectivity at the moment I was simply looking for pointers. I was kind of hoping that this had been done before to save me some trouble.
- Melv.
#3
I might be able to help you out... Paintball Net's "Ready Room" functions in a similar fashion. When new players connect, they dumped into the "Ready Room." In the Ready Room, players can mark themselves as "ready" or "unready". When a match begins, only the "ready" players will be pulled into the match. Not exactly what you want, but with some similarities, as I see it. I can see how I would support what you describe.
Part of what you want is in the clientConnection.cs script in common/server:
Hope that helps.
-David
11/24/2002 (1:23 pm)
Melv,I might be able to help you out... Paintball Net's "Ready Room" functions in a similar fashion. When new players connect, they dumped into the "Ready Room." In the Ready Room, players can mark themselves as "ready" or "unready". When a match begins, only the "ready" players will be pulled into the match. Not exactly what you want, but with some similarities, as I see it. I can see how I would support what you describe.
Part of what you want is in the clientConnection.cs script in common/server:
//-----------------------------------------------------------------------------
// This script function is called before a client connection
// is accepted. Returning "" will accept the connection,
// anything else will be sent back as an error to the client.
// All the connect args are passed also to onConnectRequest
//
function GameConnection::onConnectRequest( %client, %netAddress, %name )
{
echo("Connect request from: " @ %netAddress);
if($Server::PlayerCount >= $pref::Server::MaxPlayers)
return "CR_SERVERFULL";
return "";
}Hope that helps.
-David
#4
That's exactly what I want, a kind of ready room. I guess I'm going to have to spend a few nights studying the scripts.
Is there any kind of reference anywhere for the script interactions regarding initial connectivity?
- Melv.
11/24/2002 (1:30 pm)
David,That's exactly what I want, a kind of ready room. I guess I'm going to have to spend a few nights studying the scripts.
Is there any kind of reference anywhere for the script interactions regarding initial connectivity?
- Melv.
#5
Sorry I can't give more than ideas since I never did this before.
11/24/2002 (2:20 pm)
Melv, function GameConnection::onConnectRequest( %client, %netAddress, %name ) is the initial script thing you are looking. That function is executed whenever a request for connection is received. Here you can take that data and popup a gui that would let the server to admin if it should allow or deny the connection request.Sorry I can't give more than ideas since I never did this before.
Torque 3D Owner Xavier "eXoDuS" Amado
Default Studio Name
I guess you could do it that way, or i'm not sure what you want exactly :)
Good Luck.