Turn a Graphwar battlefield into a mathematical trajectory.
See it. Shape it. Evolve it. Export the equation.
Graphwar is an artillery game where mathematical functions become projectile trajectories. GraphBot is a local visual laboratory for constructing those functions: click a route, draw a curve for approximation, or search for a trajectory with an evolving population—then copy a Graphwar-ready expression.
Browse GraphBot screenshots on Steam →
GraphBot is not a macro. It turns geometry into several genuinely different mathematical representations.
Sigmoid network — a trainable sum of smooth steps.
Fourier features — a harmonic vocabulary for waves and repeated shape.
Graphwar-safe export — ReLU can be written with abs, rather than max.
For search, a population of candidate trajectories is repeatedly scored and selected:
The short version is here; the implementation-facing explanation is in the mathematics guide.
GraphBot's primary experience is a local browser UI for Windows.
| Mode | Use it when | Output |
|---|---|---|
| Click Mode | You know the route and want exact waypoints. | Piecewise absolute-value segments. |
| Draw Mode | You want to sketch a shape and compare mathematical fits. | A fitted formula from one of five families. |
| Trajectory Search | You have a start and targets and want the computer to search. | The current evolutionary champion. |
It captures the Graphwar client area off-screen, detects useful scene information, and never injects code, reads game memory, or submits shots. You remain in control of pasting and firing the expression.
flowchart LR
A[Graphwar window or blank canvas] --> B[Capture and scene analysis]
B --> C{Construct a trajectory}
C --> D[Click waypoints]
C --> E[Draw and approximate]
C --> F[Trajectory Search]
D --> G[Graphwar expression]
E --> G
F --> G
G --> H[Copy to clipboard]
The field is normalized to approximately
You know where the function should go. Click the waypoints.
The first click is the active soldier; later clicks form targets in route order. GraphBot builds the path from absolute-value segments. For endpoints
This makes a compact piecewise-linear building block that Graphwar can evaluate. Click Mode's exported expression intentionally has no y= prefix.
graphbot_kroshechka_github.mp4
Draw a curve. Let several kinds of mathematics explain it.
The same sampled stroke can be represented by these implemented families:
| Family | Intuition | Good at |
|---|---|---|
| Linear segments | Connect the sampled points directly. | Exact control and simple routes. |
| Sigmoid network | Learn the weights of shifted logistic steps. | Smooth transitions and step-like shapes. |
| Taylor features + MLP | Feed powers of normalized position into a linear model or small network. | Smooth global trends and nonlinear feature combinations. |
| Fourier features + MLP | Feed sine/cosine harmonics into a linear model or small network. | Oscillation and wave-like structure. |
| Cubic spline / B-spline | Build locally controlled piecewise cubics. | Smooth interpolation or smoothing. |
GraphBot reports the selected model's MSE and lets you retrain the neural methods after changing their controls. Taylor is a normal implemented option—not a placeholder.
The planned comparison asset will keep one target stroke on screen while Linear, Sigmoid, Taylor, Fourier, and Spline/B-spline solutions take turns explaining it. Accuracy is only part of the point: the same geometry can be encoded by fundamentally different mathematical families.
Good at: smooth global structure. With zero hidden layers the result is a polynomial in normalized position; with hidden layers, GraphBot trains an MLP on those features.
Good at: periodic or oscillatory structure. Zero hidden layers yield a Fourier-like harmonic sum; hidden layers add a learned nonlinear mapping.
Good at: transitions. The UI exposes the number of steps, steepness, epochs, and learning rate.
Good at: smooth local interpolation. The UI offers natural or clamped cubic splines, plus a cubic B-spline fit with configurable control-point density and smoothing.
Want the derivations, coordinate conventions, and export details? Read docs/MATH.md.
For Taylor and Fourier models, GraphBot can train a small feature MLP:
normalized x → feature vector φ(x) → hidden layers + activation → y
Supported hidden-layer activations are tanh, sigmoid, ReLU, Leaky ReLU, Softplus, Swish/SiLU, GELU (approximation), and Mish. The formula exporter converts the selected network to expression text; for example, it expands ReLU into an abs identity.
Place a start and targets. Watch candidates search for a route.
Trajectory Search is the public name for the UI's former “Dot Mode.” It describes the user outcome and stays accurate if future solvers are not genetic algorithms. The current solver is an evolutionary algorithm.
Each candidate stores
- staying inside the field;
- avoiding the optional detected forbidden region;
- hitting more targets;
- reducing miss distance;
- avoiding configured edge strips and unnecessary length.
The capture pipeline can turn dark obstacle pixels into a safety-expanded occupancy grid. It is a practical collision mask, not a claim of perfect semantic understanding of every map element. Targets left of the start are unavailable because this solver deliberately moves only right.
Requirements: Windows, Python 3.10+, and a Graphwar window titled Graphwar if you want to capture a field.
git clone https://github.com/KroSheChKa/GraphBot.git
cd GraphBot
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
python tools/approximator_server.pyOpen http://127.0.0.1:8765/ if the browser does not open automatically. Choose a mode, optionally press Capture field, create a trajectory, then use Copy y.
For setup, controls, calibration, and troubleshooting, see the user guide. For Graphwar syntax and game behavior, see GAME_RULES.md.
Stable workflows
- Local UI with Click Mode, Draw Mode, and formula copying.
- Draw approximators: linear, sigmoid, Taylor, Fourier, cubic spline, and B-spline.
- Quiet Win32 field capture, active-player detection, and forbidden-mask extraction.
Experimental / research workflows
- Trajectory Search's evolutionary solver and its obstacle interpretation.
- The legacy
GraphBot.pyconsole/OpenCV program, including A*, polynomial search, and symbolic genetic search.
GraphBot.py remains in the repository because it contains distinct research planners not exposed by the UI. It is deliberately not the recommended entry point.
- Mathematics — models, neural features, search, and export.
- User Guide — operating the UI, capture, calibration, and fixes.
- Graphwar Rules — game modes and expression constraints.
- Showcase media plan — stable filenames and animation storyboards.
- Roadmap — implementation work still planned.
MIT. See LICENSE.

