ScalarR/General Surfing Framework

From Robowiki
Jump to navigation Jump to search
This article is a stub. You can help RoboWiki by expanding it.

ScalarR is probably the first bot to implement 1v1 style Wave Surfing in melee, especially Second Wave Surfing, which couldn't be possible without the development of general surfing framework. To describe how it works, let's first look at how Minimum Risk Movement, True Surfing and GoTo Surfing works.

Minimum Risk Movement
Each tick (when certain conditions meet, e.g. upon reaching current point), evaluate a set of points, go to the one with minimum risk.
True Surfing
Each tick, evaluate a set of movement options (mostly forward, stop and backward), execute the one with minimum risk.
GoTo Surfing
Each tick (when certain conditions meet, e.g. first wave changed), evaluate a set of points, go to the one with minimum risk.

All three ways above can be redescribed as:

Each tick when certain conditions meet, evaluate a set of movement options, execute the one with minimum risk.

A general surfing framework needs only 4 methods:

  • needReEvaluate
  • getMovementOptions
  • evaluateMovementOption
  • executeMovementOption

Everything else can be perfectly reused. To implement a new surfing strategy, all you need is to fill in the 4 methods.

However, second wave surfing is different. To precisely surf the second wave, you not only evaluate the risks of current movement options, but also all possible movement options upon reaching the current one. Also, as a general framework, tricks like Second Wave Speed Optimisations should also be supported.

If wave surfing is reconsidered as a tree searching process, all problems above are solved. Details like whether to surf the second wave or even the third wave can be abstracted as a new method:

  • isLeaf

Once isLeaf is true, tree searching stops. Otherwise, end-point of each movement option is expanded (by calling getMovementOptions on the end-point). Optimization tricks like tree pruning are applied, naturally.