LizardNet / LizardIRC-Beancounter

Beancounter - a Java IRC bot to function as a game bot serving various games over IRC. Developed for use for the LizardIRC network. Please do not push directly to this repo - it is a publish-only mirror of a repository at LizardNet Code Review.
https://git.fastlizard4.org/gitblit/summary/?r=LizardIRC/Beancounter.git
Other
3 stars 1 forks source link

Implement game framework #22

Open FastLizard4 opened 8 years ago

FastLizard4 commented 8 years ago

Implement a basic framework for handling IRC games in the bot.

I was thinking that we probably want to handle game-related commands separately from other CommandHandlers. I was thinking have a GameHandler that acts as an intermediary CommandHandler between the bot and the various game packages, and is a per-channel CommandHandler.

Basic sketch:

  1. When no games are being played, GameHandler provides a ?play command that takes the name of the game to be played as an argument.
  2. Now, with a game selected but not yet started, GameHandler hands control of game setup to the appropriate game classes, but allows the selected game to be changed too - i.e., proxying the commands of the game's CommandHandler, but also still responding to the ?play command.
  3. Once the game setup is completed and it starts, the game classes signal GameHandler that the game is now properly in progress, and prevents the game from being switched - at this point, the game is under control of game class entirely, and GameHandler proxies everything to the game class's commandhandler.
  4. When the game is over, the game class signals this to GameHandler; return to 1.

Blocks #10, #20, and #21

FastLizard4 commented 8 years ago

Oh, and maybe for commands to be passed through to the games' CommandHandlers, use a different trigger to prevent conflicts with the bot's primary commands?

wlritchi commented 8 years ago

Worth noting that this architecture may be obsolete or require changes in the post-PircBotX era (no guarantees either way; the PircBotX replacement is still in prototyping)

FastLizard4 commented 8 years ago

Right, but since there's no timeframe for replacing PircBotX, I'd say we might as well implement this now so we can get started on the games, and cross the post-PircBotX bridge when we get to it.