The MMO Project: Halloween edition.

The MMO Project: Halloween edition.

Last night after I left the office I continued to work out a way to save account info during the testing phase, then implemented it on the auth server. Now if a user logs in with an unknown username it automatically creates an account and hashes their password with SHA-256, then stores it as an individual file in a folder called accounts.

This will change when I write the DB connector but for now we make due with simple flat-file storage. It's better for testing anyway or at least that's my excuse. I want to get into state sync across clients and to do that I need to be able to track account data and display usernames above characters in the game so I don't lost track of which is which and... yeah. Plus I need this infrastructure in place for when I do implement the DB so... eh?

First thing I will be doing is piggybacking the user data (sans password of course) onto the login token that I send to the game server by converting it to a dict before sending it from the auth server. Next I will unpack that on the game server and if there is no current data for that account, create it. Once I have it created I will then link up the account info with the game server's "database" and retrieve the player info, sending whatever is necessary back to the client(username, stats, world position, etc).

Then on the client I will setup the player depending on the data received from the game server on login. This will also allow me to start setting up state sync, exp, levels and a lot more. Basically this is the nut I need to crack to continue on to the meat of the thing. However; I will also need to remember to implement encryption on all inter-server communications once I have this stuff starting to come together. Don't want no MITM allowing an account to be hijacked via the token, bypassing all the work I did on auth.

Now to set about implementing the thing.

Alright, I can now extract account information from the token object and login. Now it's a matter of CRUD operations for the character data. For now there will be one char to account and the char name will be the username since I don't see the point of creating a character creation system without the proper DB. Also there was some esoteric error implying I had misconfigured the connection between the client and game server. This was incorrect. The error (after much debuggery) was discovered to be the failure of the server to remove expired tokens after the modifications. This has been fixed.

Hey man, it's debug info.

Well, I can now make the round trip with the character and account data all the way to the client on login. The character data is then populated within the client and can be used to setup the initial state of the character after logging in. Next is location updates with the server fired from the client, then saving the changes to the character "db" in the server every XX seconds.

Data go to server, server save data to "database"

Now that I got the server saving the character data and the client loading the data from the server on login I am running into an issue with changing the damn map and putting the player on it. I will just make it a child of the damn SceneManager for now and see if that works.

Well that at least allowed me to test the player location saves properly. At least that's going right. I need to figure out why the scene management seems to be running async. The order it should go it changes the map, sets up the player and adds it as a child to the map. Sometimes the player would be null, sometimes the map would be null. I need to rethink my scene transitions if this is going to be a thing.

Alright, rewrote the scene manager. Somehow it was causing multiple instances of itself to spawn and yeah... it got ugly. Now I can load the player in almost right. Lots of trial and error here, but almost to the point I can have multiple players displayed in the world.

Log out.

Now that I got the accounts generating and characters generating and player information updating with the server and saving to the character "database" I am ready for Client State Sync. Which will involve spawning nodes for holding characters from the server on the client, then controlling and animating them based on commands crom the server. Interpolation is gonna be a bitch, methinks.

Generating characters for accounts and saving them and their location on the server.

The hard part begins either tomorrow or Monday.

Happy Halloween