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 8: Rule Change and Voting Logic Implementation #21

Open
jkbrooks opened this issue Apr 15, 2024 · 1 comment
Open

Ticket 8: Rule Change and Voting Logic Implementation #21

jkbrooks opened this issue Apr 15, 2024 · 1 comment

Comments

@jkbrooks
Copy link
Contributor

Description:
Develop the backend logic required to manage the process of proposing changes to the game rules and the associated voting mechanisms. This includes tracking proposals, managing votes, updating game states based on outcomes, and ensuring the integrity and consistency of game rules throughout the gameplay.

Key Tasks:

  1. Rule Change Proposal Logic:

    • Functionality: Implement functions to handle the submission of rule change proposals. This includes validating the proposal content, saving it in the database, and initiating the voting process.
    • Storage: Store proposals with metadata including proposer ID, proposal time, rule change content, and current voting status.
  2. Voting Mechanism:

    • Functionality: Develop a voting system where players can vote on active proposals. Each vote should update the proposal's status in real-time.
    • Details: Ensure that each player can only vote once per proposal and that the vote is counted accurately towards the final tally.
    • Timers: Implement a time limit for voting on each proposal after which the voting is closed and the decision is executed based on the majority.
  3. Game State Updates:

    • Functionality: Depending on the outcome of the voting, apply the rule change to the game state if approved, or discard the proposal if rejected.
    • Consistency: Ensure that all changes to the rules are propagated accurately across all game instances and are reflected in ongoing and future gameplay.
  4. Notification System:

    • Functionality: Notify all players about new rule change proposals, the start and end of voting periods, and the outcomes of votes.
    • Real-time Updates: Consider using WebSocket for real-time updates to keep all players in sync with the current state of rule proposals and voting.
  5. Database Transactions:

    • Safety: Use transactions to ensure that all database operations related to rule proposals and voting are atomic and consistent, preventing any partial updates or data corruption.
  6. Error Handling and Validation:

    • Robustness: Implement comprehensive error handling to manage scenarios like duplicate votes, voting after deadline, invalid rule proposals, etc.
    • User Feedback: Provide clear feedback and error messages to users for all operations related to rule changes and voting.
  7. Testing:

    • Unit Tests: Write unit tests for all new logic and functions, ensuring they handle expected and edge cases correctly.
    • Integration Tests: Conduct integration tests to verify that the new functionalities interact correctly with the existing game logic and database.
  8. Documentation:

    • Code Documentation: Document all functions and their interfaces clearly, explaining the parameters, expected outputs, and side effects.
    • API Documentation: Update Swagger or similar API documentation tools to reflect new endpoints related to rule changes and voting.
    • README Update: Update the README file with details about the new functionalities for rule changes and voting, including examples and guidelines for developers.

Deliverables:

  • Backend logic for managing rule change proposals and voting processes.
  • Database schemas and migration scripts for storing rule proposals and votes.
  • Real-time notification system for rule change events.
  • Full suite of tests (unit and integration) ensuring functionality and robustness.
  • Updated API and code documentation.

This ticket is critical for enhancing player interaction and engagement, providing a dynamic and evolving gameplay environment where players have a real impact on the game's rules and strategies.

@jkbrooks
Copy link
Contributor Author

I don't think we want this

Consistency: Ensure that all changes to the rules are propagated accurately across all game instances and are reflected in ongoing and future gameplay.

Because some rule changes will require code changes and those changes will only be applied to future games

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