This week, I began outlining the next major step in my game's development: implementing a secure player authentication and data-saving system. The goal is to allow players to register and log in to the game, while also tracking and storing their scores in a persistent online database. The scores will be implemented in the later part, I mainly focused on Registration and Login and also having a secure password using Hash and Salt so that even if a Hacker looks at our database he won't be able to see our password.
To achieve this, I will be using:
Key Features I’m Aiming to Implement:
Players can create a new account which takes a username and password both have to be minimum of 8 characters via a form.
PHP script will validate and sanitize input data.
Passwords will be hashed before storing in the database for security.


Players can log in using their existing credentials.
PHP will authenticate input against stored hashed passwords.
A session/token system may be used to manage login state.

Once logged in, player scores will be stored and updated in the MySQL database.
This ensures player progress is persistent even after quitting the game.
I plan to implement measures such as SQL injection prevention, password hashing and salting using password_hash() and password_salt() using the sha-256 encryption method to encrypt the password ( I have kept it to 5000 rounds , the more rounds you enter the more secure and encrypted your password becomes , but it may affect the loading time)
While everything is currently being tested in a local environment via MAMP, the long-term plan is to migrate the database and PHP files to an online hosting server, making the system accessible across the internet.

In next week's blog, I aim to show working screenshots and breakdowns of the PHP scripts, database schema (mySQL), and Unity integration (likely using UnityWebRequest for server communication, a bridge between Unity and the mySQL Database on a server).
Did you like this post? Tell us
Leave a comment
Log in with your itch.io account to leave a comment.