Labyrinth Game Setup and Initial Player Flow - wwestlake/Labyrinth GitHub Wiki
Labyrinth Game Setup and Initial Player Flow
Overview
This document outlines the initial setup of a player in the Labyrinth game, including the process of character creation, managing multiple characters, and how characters interact with the game world. This guide is intended for developers and contributors to understand the flow and mechanisms that drive the player experience, particularly during the initial stages of the game.
Player Initialization and the Lobby
-
Joining the Game:
- When a new player joins the Labyrinth game, they are placed in a virtual space known as the Lobby. The Lobby serves as an entry point where players can create and manage their characters before entering the game world.
-
Lobby Characteristics:
- Lobby Purpose:
- The Lobby is not a room in the traditional sense. It is a transitional area where no gameplay occurs other than character creation and management.
- Player State in the Lobby:
- Players themselves are not tied to specific rooms in the game. Instead, their characters are. In the Lobby, the player does not have an active character in the game world yet.
- Lobby Purpose:
Character Creation Process
-
Creating a Character:
- In the Lobby, players can create a character that will represent them in the game. Characters are stored in the database and associated with the player.
-
Character Attributes:
- Upon creation, a character is assigned various attributes such as:
- Name: The unique identifier for the character.
- Level: Starting at 1, characters can level up as they progress.
- Health, Mana, Strength, Dexterity, etc.: These stats define the character’s capabilities and will impact gameplay.
- CurrentRoomId: Upon creation, this field is empty since the character is not yet placed in the game world.
- Upon creation, a character is assigned various attributes such as:
-
Storing Characters:
- Characters are stored in a MongoDB collection. Each character is uniquely identified by an
Id
, and attributes are stored alongside.
- Characters are stored in a MongoDB collection. Each character is uniquely identified by an
-
Assigning a Character to a Room:
- Once a character is created, it can be placed into a room. This is done by setting the
CurrentRoomId
attribute, which links the character to a specific room in the game world. - Important: Only the player's current character (the one they are actively playing) can be associated with a room at any given time.
- Once a character is created, it can be placed into a room. This is done by setting the
Managing Multiple Characters
-
Character Switching:
- Players can create multiple characters. However, only one character can be active (the Current Character) at a time.
- Switching Characters:
- When a player chooses to switch characters, the
CurrentCharacter
attribute in theirUserContext
is updated, and the newly active character’sCurrentRoomId
is set to reflect their position in the game world.
- When a player chooses to switch characters, the
-
UserContext Object:
- The
UserContext
object is a crucial structure that holds information about the player and their current session, including:- User: The
ApplicationUser
representing the player. - CurrentCharacter: The character the player is currently controlling.
- AvailableCharacters: A list of all characters that belong to the player.
- CurrentRoom: The room the
CurrentCharacter
is currently in.
- User: The
- The
Conclusion
This document serves as a foundational guide to the initial player setup process in the Labyrinth game. By following the outlined steps, developers can create a robust system for managing player characters and their interactions with the game world. Once these basics are in place, more advanced features such as the rules engine can be layered on top to enhance gameplay.