matthewjwhite / crystal-skull

:skull: Highly-configurable, telnet-compatible, text-based RPG
MIT License
0 stars 0 forks source link

Implement initial game loop #5

Closed matthewjwhite closed 4 years ago

matthewjwhite commented 4 years ago

What?

The game loop will drive the basic flow of the game.

At the moment, this game does not contain a loop of any sort. Once authenticated, the connection is killed.

Acceptance Criteria

matthewjwhite commented 4 years ago

Regarding battle:

Regarding exploration:

matthewjwhite commented 4 years ago

Location

I think a perfect place for the initial game loop is GameSession::run; as currently written, GameSession represents a single user's interaction with the server, and run is effectively the "main" method for that session.

Algorithm

  1. Get or create user account (already implemented).
  2. Enter loop on GameSocket::get (note reference via self.socket in GameSession).
  3. If input from user is exit, then save the user's state and kill the connection.
  4. Else, there should be a set of additional possibilities which the user is either presented with or tossed into.
    • As part of this initial implementation, there will only be two possibilities, battle or explore.
    • It seems suitable for this initial implementation to not present a menu of options, though it should be extensible enough to accommodate that at a later point.
      1. If battle, carry out battle. Choose from the available list of monsters randomly.
    • It seems suitable at this point to create a battle method in the User class, which accepts an input monster.
  5. If not battle, then explore. Choose a direction.
    • It seems suitable at this point to create a move method in the User class, which accepts a direction.
    • When legitimate region boundaries are implemented, logic should be in place to determine whether a certain move is allowed or not.
  6. Continue to next iteration.
matthewjwhite commented 4 years ago

⬆️ is being implemented here: https://github.com/matthewjwhite/crystal-skull/tree/initial-game-loop.