Forum C# Global Game Specific Serverside Code - Not Just Room Code

Global Game Specific Serverside Code - Not Just Room Code

Postby mulatto401 » June 17th, 2010, 12:01 am

Hi,

As far as I understand, the way the server works is when a room is made it creates an instance of your server-side logic code. But there is no server-side logic code for your game in general?

Being able to have server-side logic that can control and handle all users connected to your game and not just allowing room level code is a powerful thing.

For example: to be able to build a "quick match" type concept. You would need to be able to read all players connected to a single room/lobby/extension/whatever you want to call it and pair up players, create a room and then add them into the room, but because you cannot create rooms on the server-side nor remove them nor have any global logic code this seems impossible.

If anyone knows of a way to do this, please do explain. Unless I have this all wrong and there is a way to do global server-side code logic.

Chris
mulatto401
Paid Member
 
Posts: 34
Joined: June 13th, 2010, 11:13 pm

Re: Global Game Specific Serverside Code - Not Just Room Code

Postby fox1980 » June 17th, 2010, 12:27 am

Any multiplayer game from the simplest to the most complex uses some kind of room/instance/zone/whatever you want to call it. They just hide this pretty well. There's an explanation for why this is needed in the documentation, and you'll also have no trouble googling it.
For your specific example, you're right, you can't create rooms server side, but you can list existing rooms on the client. If there are none, create one from the client. You don't need to let the user know he created a room, just show him a message saying "looking for opponents".
The next player to log in should be able to see it when they list rooms, you can have the client connect automatically if a room is available so there is the solution to your quick match concept.
fox1980
 
Posts: 206
Joined: April 1st, 2010, 10:39 pm

Re: Global Game Specific Serverside Code - Not Just Room Code

Postby mulatto401 » June 17th, 2010, 12:33 am

Very good. That simply works, but when you get into ranked matches where your logic wants to pair up users with the same experience, you cannot get this information until a room based extension is in place, no?
mulatto401
Paid Member
 
Posts: 34
Joined: June 13th, 2010, 11:13 pm

Re: Global Game Specific Serverside Code - Not Just Room Code

Postby fox1980 » June 17th, 2010, 12:55 am

You don't need to join a room to know a user rank. You can use joindata to send the players rank when they connect, then in listrooms function you look for someone with the joinData close to your rank. You can do something like wait for 30 seconds and if no one close to your rank is found just join someone's room even if the rank disparity is big.
fox1980
 
Posts: 206
Joined: April 1st, 2010, 10:39 pm

Re: Global Game Specific Serverside Code - Not Just Room Code

Postby mulatto401 » June 17th, 2010, 1:15 am

Oh I didn't see that joinData, hmm. It is coming from the client. Having ranks or any user data saved on the client is not safe. My current system saves all player data on my servers. In which would have to be grabbed from my server to the client then back to the player IO server, which isn't too safe.
mulatto401
Paid Member
 
Posts: 34
Joined: June 13th, 2010, 11:13 pm

Re: Global Game Specific Serverside Code - Not Just Room Code

Postby fox1980 » June 17th, 2010, 1:28 am

Use BigDB to save users ranks. You do a query on the client to get the user rank, and then send that info back in joinData. In the server you can check joinData with BigDB and if the client is lying you can prevent him from creating the room in the first place, disconnect him, send him a warning message, or ban him straight away.
Well there's many ways to accomplish this. What i mean is that PlayerIO is not the limitation, it's up to us (the developers) to come up with solutions to the logic we want to implement.
fox1980
 
Posts: 206
Joined: April 1st, 2010, 10:39 pm

Re: Global Game Specific Serverside Code - Not Just Room Code

Postby Benjaminsen » June 17th, 2010, 6:22 am

The classical way to solve this issue is to have a special lobby type room, which sole purpose is to match users together for a match. And yes you are right that you cannot create rooms on the server, you can however generate unique and secret game ids and tell both clients to join that room.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark


Return to C#



cron