Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ticket 9: Advanced Gameplay Logic and Enhanced API Endpoints for Nomic Game #24

Open
snobbee opened this issue Apr 16, 2024 · 1 comment

Comments

@snobbee
Copy link
Contributor

snobbee commented Apr 16, 2024

Title: Advanced Gameplay Logic and Enhanced API Endpoints for Nomic Game

Description:
Enhance the existing Nomic game's API endpoints and gameplay logic to support a comprehensive game lifecycle. This includes dynamic rule enforcement, advanced move validation, and robust game state management to ensure an engaging and interactive gaming experience.

Prerequisites:

  • Review the existing implementation of player interaction endpoints.
  • Familiarize with the existing database schema, particularly the Game and Rule models.

Acceptance Criteria:

  1. Game Lifecycle Management:

    • Develop a service to manage the game lifecycle, including starting, pausing, and ending games.
    • Endpoint for starting a game (/game/{game_id}/start): Initializes the game state and notifies all players.
    • Endpoint for ending a game (/game/{game_id}/end): Finalizes the game state, provides a summary, and declares a winner if a player reaches 100 points.
  2. Dynamic Rule Enforcement:

    • Enhance the /propose-rule/{game_id} endpoint to validate new rules against existing game constraints before submission.
    • Implement middleware to enforce active rules for each player's turn and move submission.
  3. Move Validation System:

    • Update the /make-move/{game_id} endpoint to validate player moves based on the current ruleset dynamically.
    • Integrate a rules engine to apply game rules to moves and actions in real-time.
  4. Real-time Game State Updates:

    • Synchronize game state updates across all players after every action, rule proposal, and vote to ensure consistent gameplay.
    • Use WebSockets to push real-time updates to clients.
  5. Voting System Enhancements:

    • Revise the voting mechanism to manage tiebreakers and handle abstentions effectively.
    • Implement a timed voting process with automatic resolution for non-votes, ensuring that a majority is needed for a vote to pass.
  6. Rule Change Implementation:

    • Establish a system for immediate application of non-code-related rule changes.
    • Outline a procedure for code-required rule changes, including pull request creation and review protocols.
  7. Documentation and Examples:

    • Update the Swagger UI documentation for all new and revised endpoints.
    • Provide detailed examples and guidance in the Swagger UI for engaging with the updated game logic.
  8. Testing:

    • Develop unit tests for new game state management and rule enforcement logic.
    • Execute integration tests to validate the complete game process, including rule changes and the scoring mechanism.
  9. Rule Violation Handling:

    • Implement a voting system to determine rule violations. If confirmed, the violating player's turn is skipped.

Deliverables:

  • A complete suite of endpoints supporting advanced Nomic gameplay functionalities.
  • Real-time synchronization of the game state across all participants.
  • Comprehensive documentation for developers and players on how to interact with the enhanced game features.

Note for Developers:

  • Maintain backward compatibility with established game rules and player interactions.
  • Focus on creating a seamless and intuitive player experience, with clear, immediate feedback for all in-game activities.
  • Additional context, here's an example game interaction
    Steve takes action.
    This is a string broadcast by Steve in which he describes himself doing something to confirm he’s following the rules of the game. For example, if there is a rule that each player must drink a glass of water before proposing a rule, here Steve would post “drinks a glass of water
    All players vote on whether Steve’s action complies with all rules. If they vote no, his turn is skipped
    Steve proposes rule change as described in standard Nomic
    All players vote to approve or reject the rule change which will be applied for the next user’s turn (if it’s a regular rule) or some time later if it’s a code change
    Steve roles 2 dice to determine what points Steve gains
    Next player’s turn

From https://docs.google.com/document/d/1UXFIwpAGgFR10Y6q5zbOCx7RdL-VSXaGLZD3XHa3IBw/edit

@snobbee
Copy link
Contributor Author

snobbee commented Apr 16, 2024

we take majority of yes or no (abstained players are skipped)
we add a proposal timeout before proposal gets rejected if no votes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant