Hello everyone,
I’m developing a custom server in c# with a custom library used in the server project and exported to be compatible with unity (c# scripting)
Everything is ok, i have set up the connection, database access and communication between cliend and server is working very well.
But i have some questions that maybe you will answer. (Yeah i know, my english is really bad)
I’m using, for the Lobby, a TCP protocoll ( I know is slow and UDP is better, but i think for lobby things is not too much bad)
The procedure of the game will be this:
-
Login using username and password
– Server will reply with a success or an error message based on a DB Query (Check credentials)
– If all is ok, the server will send another packet containing information about the player, Money, Experience, Items etc… -
Lobby:
– RoomList , Public Chat, FriendList, and some buttons, one of this go to the Item-Shop
Players can create Rooms, Can select a map, a gamemode, password etc…
When the game start, i will start an UDP connection between players and the server (I want to make this server-based, so no p2p connections)
The game is a 2d game and i have just to syncronize all players and an object that collide with players (Already done this part in “single player”)
- I’m making a Player class, where there are stored PlayerInformations, like Username, Money, Experience etc. so make a List of class where all connected players informations will be stored, and every X minutes sync all to database.
My questions are :
How i will connect the “sock” of the connected client? I have to add a Sock var to the Player class?
Is good to use TCP protocol for lobby and UDP for game?
Thanks in advance,
Artenio.