Skip to content

Game Lifecycle Management #10

@aji70

Description

@aji70

📚 Overview
Implement and stabilize the game lifecycle logic for the Monopoly game on Starknet using Dojo models. This includes creating new games, generating unique game IDs, joining games, and maintaining correct player turn orders. The methods should ensure correct state persistence and clean transitions between game phases (e.g., new, ongoing, ended).

🛠️ Tasks

Implement create_new_game with input validation and initial state setup.

Implement create_new_game_id to generate unique and sequential game IDs.

Implement join_game with player registration and turn order initialization.

Implement roll_dice ensuring it follows game rules and updates state.

Ensure retrieve_game correctly reflects the current game state from storage.

Implement game lifecycle transitions and protect against illegal state mutations.

✅ Definition of Done

New games can be created and uniquely identified.

Players can successfully join a game and get assigned their symbols.

Dice rolls reflect accurate values and impact player state.

Game transitions (pending → ongoing → ended) are logically and technically sound.

All lifecycle-related functions have passing tests and persist state correctly.

🔧 Technical Considerations

Ensure safe and predictable game ID generation using u256.

Validate that players joining a game do not exceed the allowed number.

Follow Dojo’s model traits and Starknet best practices for state storage.

Prevent race conditions or invalid transitions due to multiple calls.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions