Dimensions icon indicating copy to clipboard operation
Dimensions copied to clipboard

Provide instructions and boilerplate for creating visualizers that use command based replays

Open StoneT2000 opened this issue 5 years ago • 0 comments

Command based replays are just copies of every command in the order they were sent to the design update function.

As this is all in type/javascript, any design written with Dimensions can easily be ported onto the visualizer which may or not be on the web and effectively "run" the entire match again and generate the state using the same commands given same state.

Why?

  1. Tiny replay sizes. No longer need to store every single data point and instead let visualizer generate that data on the fly
  2. If you already just store actions to allow visualizer generate match state for display, this method allows for much less tech debt with generating data the engine and design would've already generated
  3. This also recreates warnings and errors that are outputted when using match.throw

Example: https://github.com/acmucsd/energium-ai-2020/

Rough Steps:

1. Separate Design into 2 files, a logic file and the actual design file

  • design file is a wrapper around the actual logic
  • In logic file, write your design without using any variables from dimensions-ai package (types can still be used)

Reason: To allow for treeshaking. Currently Dimensions is horribly un-treeshakable for some reason. If deployed on web, this will allow for tiny bundle sizes that can completely re run the entire match using just commands sent by agent

2. Provide pseudo functionality of match functions and data for match

This is so compilation doesn't error and the web when rerunning the match and calling things such as match.send won't complain they don't exist as in the web, we are merely recreating match state, not the match itself.

StoneT2000 avatar Oct 21 '20 01:10 StoneT2000