46
TNet 3 Support / Hosting your own server and be a client same time
« on: September 29, 2015, 08:43:40 PM »
Hello again Aren,
I almost finshed the logic for connection and player database in my game.
But there is something I cannot think right now:
- After creating my server (TNServerInstance.Start(port, udpPort)
anyone can just join it
- Is there any way to put a password even on the server instance? I want players to host their own server in their own PC and invite other players (right now through IP direct connection, later on I will make a good lobby or something like that in SQL maybe)
- If I keep this way, the only way to make a "room" with password is creating a channel with such (which works fine), but I don't want this, I want a password right after connection and not while entering a channel
- An example for this is to avoid new players to enter if there is already a game going on (a shooter mission, in example)
What is the best way to do this, in your opinion?
What I have now is this:
- player A creates a server with TNServerInstance.Start(port, udpPort);
- I join a simple channel, called "MainMenu", where I apply some game logic and then I load to another scene (using LoadScene from TNet, all working good)
- In the new scene, is some kind of building base, I start another channel (with password, so new players will not get here without it... it works)
- But in this logic, all new players connected needs to pass through the first channel
- I know I could leave the channel open with the password, even if noone is there, but it must has a better way, dont you think?
Let me know if possible.
Thank you.
EDIT: also, there is a problem if I use password in these rooms (empty or not), the auto load scene from the joinchannel call is called even if I use the "null" as parameter. Do you know if this is on purpose?
EDIT 2: I made more tests, I am not sure if it is because I am leaving the "persistent" parameter as true is causing the issue, but looks like it is. It is trying to load a scene, even if I set as "null", so it is causing logic problems in my game.
I almost finshed the logic for connection and player database in my game.
But there is something I cannot think right now:
- After creating my server (TNServerInstance.Start(port, udpPort)

- Is there any way to put a password even on the server instance? I want players to host their own server in their own PC and invite other players (right now through IP direct connection, later on I will make a good lobby or something like that in SQL maybe)
- If I keep this way, the only way to make a "room" with password is creating a channel with such (which works fine), but I don't want this, I want a password right after connection and not while entering a channel
- An example for this is to avoid new players to enter if there is already a game going on (a shooter mission, in example)
What is the best way to do this, in your opinion?
What I have now is this:
- player A creates a server with TNServerInstance.Start(port, udpPort);
- I join a simple channel, called "MainMenu", where I apply some game logic and then I load to another scene (using LoadScene from TNet, all working good)
- In the new scene, is some kind of building base, I start another channel (with password, so new players will not get here without it... it works)
- But in this logic, all new players connected needs to pass through the first channel
- I know I could leave the channel open with the password, even if noone is there, but it must has a better way, dont you think?
Let me know if possible.
Thank you.
EDIT: also, there is a problem if I use password in these rooms (empty or not), the auto load scene from the joinchannel call is called even if I use the "null" as parameter. Do you know if this is on purpose?
EDIT 2: I made more tests, I am not sure if it is because I am leaving the "persistent" parameter as true is causing the issue, but looks like it is. It is trying to load a scene, even if I set as "null", so it is causing logic problems in my game.