So i've been without internet for almsot 2 weeks now and its been killing me lol. But last week i started actually producing some code for a game i'm making. So far i've got a Loginserver a Worldserver and a client. I might branch the worldserver off into other servers to manage game and just use the worldsever for character selection and a few other things i'm not sure yet. I also thing i might add a chat server to manage the chat for the game so players can communicate even if they're on different servers.
But basically heres what i've got working.
All of the programs
- Send and Recv packets of information
- Interpret the packets recieved and decide what to do with this information
- Combine multiple structs of data into a single packet (must be same type) to reduce the ammount of data sent.
- Each packet knows where it came from, where its suppose to go, its size, and the type of packet.
- The ability to dump the contents of the packet in hex or binary to a file or the console screen.
- Load settings from an ini file. Such as login server port, ip to connect to.
- Reconizes any dropped connections and deals with them accordingly.
Loginserver
- Accepts connections from multiple worldserver and users
- Authenticates the login of the worldserver and users by checking information with a MySQL database and replies letting them know if it was successfull, or there was an error (if there was an error it goes into more detail)
- Sends the client a list of worldservers to connect to upon request with the world name and status (Up, down, locked)
- When the user asks to log into a worldserver it double checks that the server is up and unlocked then it does a type of hand off to the worldserver. It lets the world know which client to expect a connection from. Then sends the client the ip and port to connect to. Then disconnects the client from the loginserver.
- Connects to a MySQL database from data loaded into the program by a ini file. It can then recv any information it wants from this database such as username password for clients and worldservers.
- Reconizes special types of users ( GameMasters or Devs etc )
Worldserver
- Doesnt really do much right now except for connecting to the loginserver and accepting clients upon the request of the loginserver.
- Reads a ini file containing the port its listening on and the port and ip of the loginserver
- It can connect to the database the same way the loginserver can though it doesnt use it for anything yet.
- If a connection with the loginserver is lost it will attempt to reconnect every 20 seconds or so you dont have to stop people from playing if something happens to the loginserver.
Client
- Checks for available loginservers ( right now it can check for three ) which are all loaded from an ini file. It will connect to the first available loginserver that it finds.
- Upon connecting to a loginserver it will send authentication information such as username password to verify that we have an account.
- Send a request to the loginserver for a list of worldservers to choose from.
- Request to connect to a specific worldserver. If the reply from the loginserver gives the ok it will attempt to connect to the worldserver and if successful it will drop the connection from the loginserver and send some validation information to the worldserver so i can log in
Anyways thats basically what i've done this past week. You'd be supprised how much codeing you can get done when you have no internet, no current job and classes havent started back up yet. I guess my whole point in writing this is to see if i'm going along the right path or if something in this architecture needs to change before i get to much into this. Also i'm not sure what type of security measures i need to take to prevent a client from bypassing the authentication process from the loginserver and going straight into the worldserver. It doesnt seem like it would be that difficult for someone to spend some time with a packet collector and figure out how to immitate a loginserver for the client. So if you have any advice/criticism, besides complaining that my post is too long, then it would be appreciated, cause i'm very new to this and i've already torn down my programs and rebuilt them from scratch cause i didnt like the way i handled things. I'm not afraid to do it again to make the code better and learn more.
Oh yeah almost forgot. I know how to use a md5 encrpytion for php or something but how would you get a cpp program to generate one. Cause right now the passwords arent encrypted in the database ( go go hackers ).
PS: I forgot to add Mr Mike, I just moved to austin lol i'm loving every minute of it.
But basically heres what i've got working.
All of the programs
- Send and Recv packets of information
- Interpret the packets recieved and decide what to do with this information
- Combine multiple structs of data into a single packet (must be same type) to reduce the ammount of data sent.
- Each packet knows where it came from, where its suppose to go, its size, and the type of packet.
- The ability to dump the contents of the packet in hex or binary to a file or the console screen.
- Load settings from an ini file. Such as login server port, ip to connect to.
- Reconizes any dropped connections and deals with them accordingly.
Loginserver
- Accepts connections from multiple worldserver and users
- Authenticates the login of the worldserver and users by checking information with a MySQL database and replies letting them know if it was successfull, or there was an error (if there was an error it goes into more detail)
- Sends the client a list of worldservers to connect to upon request with the world name and status (Up, down, locked)
- When the user asks to log into a worldserver it double checks that the server is up and unlocked then it does a type of hand off to the worldserver. It lets the world know which client to expect a connection from. Then sends the client the ip and port to connect to. Then disconnects the client from the loginserver.
- Connects to a MySQL database from data loaded into the program by a ini file. It can then recv any information it wants from this database such as username password for clients and worldservers.
- Reconizes special types of users ( GameMasters or Devs etc )
Worldserver
- Doesnt really do much right now except for connecting to the loginserver and accepting clients upon the request of the loginserver.
- Reads a ini file containing the port its listening on and the port and ip of the loginserver
- It can connect to the database the same way the loginserver can though it doesnt use it for anything yet.
- If a connection with the loginserver is lost it will attempt to reconnect every 20 seconds or so you dont have to stop people from playing if something happens to the loginserver.
Client
- Checks for available loginservers ( right now it can check for three ) which are all loaded from an ini file. It will connect to the first available loginserver that it finds.
- Upon connecting to a loginserver it will send authentication information such as username password to verify that we have an account.
- Send a request to the loginserver for a list of worldservers to choose from.
- Request to connect to a specific worldserver. If the reply from the loginserver gives the ok it will attempt to connect to the worldserver and if successful it will drop the connection from the loginserver and send some validation information to the worldserver so i can log in
Anyways thats basically what i've done this past week. You'd be supprised how much codeing you can get done when you have no internet, no current job and classes havent started back up yet. I guess my whole point in writing this is to see if i'm going along the right path or if something in this architecture needs to change before i get to much into this. Also i'm not sure what type of security measures i need to take to prevent a client from bypassing the authentication process from the loginserver and going straight into the worldserver. It doesnt seem like it would be that difficult for someone to spend some time with a packet collector and figure out how to immitate a loginserver for the client. So if you have any advice/criticism, besides complaining that my post is too long, then it would be appreciated, cause i'm very new to this and i've already torn down my programs and rebuilt them from scratch cause i didnt like the way i handled things. I'm not afraid to do it again to make the code better and learn more.
Oh yeah almost forgot. I know how to use a md5 encrpytion for php or something but how would you get a cpp program to generate one. Cause right now the passwords arent encrypted in the database ( go go hackers ).
PS: I forgot to add Mr Mike, I just moved to austin lol i'm loving every minute of it.
- Brian Wight
The post was edited 2 times, last by Monalin ().