Research Tank Royale debug drawing API #148
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Question
What drawing primitives does the Tank Royale bot API expose for debug visualization? Specifically: what procs are available (drawLine, drawCircle, drawText, etc.), what coordinate system do they use, are they per-tick, and what are the limitations? This determines how the SNN debug overlay is designed.
Parent map: #147
Tank Royale Debug Drawing API — Research Summary
Drawing Primitives Available:
The Tank Royale bot API (Nim) exposes these SVG-based debug drawing procs in the
graphicsmodule:drawLine(x1, y1, x2, y2)— line from point to pointdrawRectangle(x, y, w, h)— outline rectanglefillRectangle(x, y, w, h)— filled rectangledrawCircle(x, y, r)— outline circlefillCircle(x, y, r)— filled circledrawPolygon(points: seq[(float, float)])— outline polygonfillPolygon(points: seq[(float, float)])— filled polygondrawText(text, x, y)— text at positionCoordinate System:
getX(),getY())floatPer-Tick Behavior:
<g>tags and sent asdebugGraphicsJSON fieldgo()call,clearGraphics()resets:Style Control (persistent within tick):
setStrokeColor(color)— outline/line colorsetFillColor(color)— fill colorsetStrokeWidth(width)— line thicknesssetFont(family, size)— text font and sizeColor Support:
fromRgb(r, g, b)orfromRgba(r, g, b, a)where r,g,b,a areuint8fromHex("#RRGGBB")orfromHex("#RRGGBBAA")Limitations:
Usage Pattern:
All draw calls within a single
run()iteration accumulate in a buffer. Whengo()is called, the SVG is serialized into BotIntent and sent to the server, then the buffer is cleared for the next tick.Example (from GotoTest.nim):
This answers the SNN debug overlay design requirements: use stroked primitives + text for lightweight visualization, with per-tick refresh guaranteed by automatic clearing.