Game Development Reference
In-Depth Information
Mission briefing
This project will start with a creation of the simple high score table so that the players can
submit their names and scores locally as well as post it to the server database. We will con-
tinue the project from
Project 7
,
Forge a Destructible and Interactive Virtual World
.
First, we will create the high score menu UI using
OnGUI()
, which will be visible when
the game is over. The menu will include the final score, a text input area for the player's
name, a submit button, a local hi-score button, a server hi-score button, and a restart button.
Then, we will have the
UserData
script that contains the name and score for each user.
We will also create the
LocalHiscore
script, which we will use to save and load the
local hi-score using
PlayerPref
,
BinaryFormatter
, and
MemoryStream
to seri-
alize and deserialize the data.
Tip
The serialize and deserialize techniques will make it easy for us to save complex data as
well as preventing the user from changing the data outside the game.
Next, we will create the
XMLParser
script to get the XML value from the provided data-
base server and the
ServerHiscore
script to save and load the user's data to the server
using the
www
object. We also encrypt our data for security purposes using the
MD5
en-
cryption class written by Matthew Wegner, which we will download from
ht-
Tip
The MD5 encryption script will allow us to encrypt the hash key, which will prevent the
submission of fake high scores.