Overview
ThePlayer class is a simple data model that represents a player’s information in the ACHCE Client system. It’s primarily used to store and transmit player data to the Firebase database.
Class Definition
Properties
The public IP address of the player. This property is used to uniquely identify and track players in the Firebase database.
Usage
ThePlayer class is instantiated when a player connects to the system. It stores the player’s IP address retrieved from the PublicIPAddress class.
Creating a Player Instance
Storing Player Data in Firebase
The player object is serialized and stored in Firebase under a randomly generated name:Integration
ThePlayer class works in conjunction with other ACHCE Client components:
- PublicIPAddress: Retrieves the player’s public IP address (see IP Address)
- GenerateRandomNames: Creates a unique identifier for database storage (see Random Names)
- Form1: Manages the player lifecycle and database operations (see Forms)
Database Structure
When stored in Firebase, the player data follows this structure:The IP property is the only data currently stored per player, but the class structure allows for easy extension to include additional player information such as username, connection time, or game statistics.