This example uses Express and Preact to render 'config' and 'log' views, which can be useful since firebase logging is awkward for anything other than basic debugging.
For a easier version of this bot, checkout the first commit to this repo.
This example also offers an endpoint 'https://battlecube-teebot.firebaseio.com/config' for changing bot parameters: .
{
"minMoves": 1,
"moveFraction": 2,
"implodeRadiusFraction": 2,
"explodeImplodeRatio": 0.8,
"randomMovement": false,
"randomTargeting": false,
"randomSpread": false,
"deterministic": false,
"verbose": false
}
- Get a Firebase account.
- Install the firebase cli
npm install -g firebase-tools
Some useful commands:
firebase login
firebase init functions
firebase init hosting
(only needed if you want to render html)firebase deploy --only functions
firebase functions:log
firebase server only --functions,hosting
(run locally)