The Third Person Demo is very similar to the Login Demo as it has a very simple Login/Register system. The difference is that the player's data is saved (submitted by the game's code) rather than a data string submitted by the player.
The Third Person Demo saves and loads the player's position, and the position of the 5 cubes in the scene and whether they are in the player's inventory or not.
Make sure you have setup the demo before you try using it.
Once you have setup the demo, you can delete the 'DeleteMe' object from the scene. (It is a child of the canvas)
The Third Person Demo can be found at:
Assets>Database Control Pro>Demos>Main Demos>Third Person Demo>DCP Third Person Demo
The Third Person Demo uses the Smooth UI animation system to translate the in-game ui menu on and off the screen.
All of the code is split into two groups. The menu code and the in-game code. The menu code handles logging in and registering while controlling the login and register UI, whereas the in-game code handles the save game, load game and inventory code as well as controlling the in-game UI. The 'Transition Manager' object controls which of these two groups is active. E.g. When a player logs in, it disables the menu code (and UI) and enables the in-game code (and UI) by enabling/disabling objects.
The Structure of the Database:
First play the demo and register at least one accounant and save the game. Then Open the Setup Window and View the Database which you set the demo up with.
The Database should look something like this:
The first column of the database stores the player's usernames.
The second column of the database stores the player's passwords.
The third column of the database stores the players data string. The data string combines the player's position, the cubes in the player's inventory and the positions of the cubes not in the player's inventory. The structure of the data string is explained in the comments of the DCP_TPD_SaveLoadManager script (line 120 onwards).
This means every row of the database represents a single player's account.
The Command Sequences:
The Third Person Demo comes with 3 Command Sequences which are very similar to the Login demos sequences (where the Login and Get Data sequences have been combined).
1. Login: This sequence looks down the first column of the database (through all of the usernames), and looks for the submitted player username. If it isn't found, 'UserError' is returned. If it is found the 2nd column of the player's row is looked at (the player password), if this is the same as the submitted password 'Success' is returned along with the player's data, otherwise 'PassError' is returned. This sequence is run when the 'Login' button is pressed.
2. Register: This sequence looks down the first column of usernames and makes sure none of the usernames are the same as the submitted username. If they are then 'username in use' is returned as the player has to choose a different username. If it is not in use then 'Success' is returned after adding a new row to the database containing the submitted username and passsword. The data string is left blank as a blank data string tells the game to load the default data with the player and all the cubes in their default positions. The sequence is run when the player presses 'Register' to show the register UI and 'Register' again to register a new account.
3. Save Data: The sequence looks down the first column of the database for the player's username. If it is found then it checks the submitted password with the value from the second column of the same row. If the password is correct then the sequence writes the submitted data string to the third column of the row and returns 'Success'. If the username is not found or the password is not correct, 'Error' is returned. The sequence is run when the player has logged in and the 'Save Game' button is pressed in the in-game menu.