/Seldon

DF Bot

Primary LanguageTypeScript

Seldon: A set of scripts for Dark Forest Eth

Things the bot can currently and will do

[WIP] is planned [NEXT] in progress

Directives: Strategic use of routines

  • sprawl[WIP]: non-top 15 planets with no set subroutines should explore
  • score[WIP]: Move silver to top 15 planets and upgrade them

Routines: Groups of subroutines for many planets

  • swarm: continous small uncoordinated attacks
  • flood: large coordinated one-off attack to land in close succession
  • overload: funnel nearby energy into an all out attack from one planet
  • take[NEXT]: Chain overloads into one attack to capture a planet

Subroutines: atomic actions for one planet

  • pester: a small recurring attack
  • explore: find and take medium sized pirate planets
  • delayedMove: launch an attack after a certain time
  • snipe[WIP]: find nearby enemy planets that can be taken in 1 attack
  • supply[WIP]: Send energy to friendly planet when below 50%
  • bank[WIP]: send silver to friendly planet with minimal energy spent

Warning/Disclaimer

This is Alpha software that could crash your game if abused to heavily.

You will need to copy this script into your browser console. This is scary and should not be taken lightly. Scripts run in your browser console have access to your secret key and wallet. I could take all of the money in your wallet. The whole bot is about 500 loc with no external dependencies aside from the bundler. You or someone you trust should be able to review it.

Feel free to fork this repo and review the code so you can be sure there are no shenanigans.

Usage & Setup

Copy and Paste /dist/seldon.umd.js into your chrome devtools.

let op = new Seldon()

Things To Mess Around With

Annoy a large enemy planet with a smaller nearby planet

op.pester(yourSmallPlanetId,theirLargeplanetId)

or set up a lot of pesters quickly

op.swarm(theirLargePlanetId)

or launch a large coordinated attack from all over the map

op.flood(theirLargePlanetId)

or pull in nearby energy and launch an all out attack from one planet, (current logic doesn't work great for howNearbyInSeconds < 5 mins )

op.overload(yourLargePlanetId, theirLargePlanetId, ?howNearbyInSeconds)

or scour your empire for the energy needed to capture your enemy's crown jewel

__Not complete__ op.take(theirLargePlanetId)

or setup a far off planet to capture pirate planets as they're discovered

op.explore(yourPlanetId)

High Level: How this works or Architecture

There is core loop that runs every 60 seconds. That core loop iterates over the actions array. The actions array is a big list of subroutines to run. op.pester() inserts an action into the actions array. op.swarm() inspects the game state and inserts actions based on the best planets for the job.

FAQ

Q: What happens if I refresh, will I lose all of the actions in memory?

A: Actions are stored in localStorage when ever the op.createAction() is called. createAction() runs underneath every subroutine. Seldon reads from localStorage on initialization, so actions should persist across sessions, unless you clear your application state.

Q: Will the core loop continue to run if I lose access to the Seldon reference?

A: Yes, the core loop will continue to run, this is important if you overwrite the variable you've set it to. If you initialize a new Seldon instance, the old coreLoop will be stopped and a new one started. This is important for protecting against multiple core loops running at the same time.