Managing the player's account
Let's start with the basics: let the player create an account and log into the game. To store information server side, we will use a database (MySQL). The table structure we will use is very simple as there is not much to store. The player's account will be stored in a table we will creatively call players
.
This table will have the following rows:
NAME: This is a string holding the name of the player. It will be unique so that no two players can have the same name.
PW: This is a string holding the player's password. It is hashed (more on this in the next section, Searching elements in the database).
X: This is a double that will hold the player's x coordinate.
Y: This is a double that will hold the player's y coordinate.
DIR: This is an integer that we will use to store the direction the player is facing.
STATE: This is an integer that holds the state of the player: standing, walking, or fighting.
LASTUPDATE: This is a time stamp that will hold the last time the server...