MrEliptik / godot_twitch_games

Collection of small chat interactive games for Twitch
https://bento.me/mreliptik
MIT License
17 stars 5 forks source link

Game loop #66

Open MrEliptik opened 1 year ago

MrEliptik commented 1 year ago

Define the game loop(s) that we want. A flowchart can help visualize.

Also think about the different ways to start a game: after a countdown, after X players joined, on streamer command, etc...

Drathal commented 1 year ago

We can put a game_state.md inside the game directory to document the state flow we want. This works on GitHub and any editor that has an mermaid plugin.

Link: mermaid

Here is an not fully implemented example:

game state

---
title: GAME_STATE
---
stateDiagram-v2
    WAITING
    note right of WAITING
         players !join
    end note

    RUNNING
    note left of RUNNING
         players !fire deg power
    end note

    WINNER : WINNER *

    PAUSED : PAUSED *

    [*] --> WAITING
    WAITING --> RUNNING : 'admin !start'
    RUNNING --> WINNER : one player left
    WINNER --> RUNNING : 'admin !restart'

* not implemented yet

MrEliptik commented 1 year ago

This looks like a good solution!

Drathal commented 1 year ago

Maybe we can define the loop for this game in a stream. There we just draw a picture. And then someone (me) could transform it to a mermaid diagram. At the moment I don`t know exactly what flow you have in mind.

MrEliptik commented 1 year ago

Here are the states I'd like to have 👇 image image

Drathal commented 1 year ago

Pool Royale

game loop (autorun)

The game will start a new one after the winner state.

commands

streamer

This command should be handles trough a admin / streamer script

viewer

This commands are handles trough the viewers.gd autoload

game

This commands are handled trough the game itself

State diagram

stateDiagram-v2 
    (game_start) --> PAUSED
    PAUSED --> WAITING: !start auto &ltseconds&gt
    WAITING --> RUNNING: after &ltseconds&gt seconds
    RUNNING --> WINNER: when one viewer is left
    WINNER --> WAITING: after &ltseconds&gt seconds

States:

PAUSED

stateDiagram-v2
    (game_start) --> PAUSED 
    PAUSED --> WAITING: !start auto &ltseconds&gt

WAITING

stateDiagram-v2
    PAUSED --> WAITING
    !wait --> WAITING
    !reset --> WAITING
    WAITING --> RUNNING: after &ltseconds&gt seconds

RUNNING

stateDiagram-v2
    RUNNING --> WINNER : when one viewer is left

WINNER

stateDiagram-v2
    WINNER --> WAITING : after &ltseconds&gt seconds

TODO:

Drathal commented 1 year ago

@MrEliptik Tried to translate the first picture into diagrams and some text :D