Control a Farming Drone with C++ — Play It in Your Browser (Cropbot)
What if a farming game didn’t let you click anything?
Control a Farming Drone with C++ — Play It in Your Browser (Cropbot)


What if a farming game didn’t let you click anything?
What if the only way to control the world… was to write C++?
I built exactly that.
A browser-based game where you control a farming drone entirely through C++ code — compiled to WebAssembly and executed live in the game.
You can try it right now:
👉 **https://cropbot.fly.dev/**
No install.
No setup.
Just open and start coding.
You Don’t Play. You Program.
The world is a grid.
Each cell can be:
- Empty
- Tilled
- Planted
- Growing
- Ready to harvest
- Or the base station
The drone can:
- Move around the grid
- Prepare soil
- Plant crops
- Water them
- Harvest them
- Buy seeds
- Manage energy and water
- Earn gold
- Increase score
But here’s the twist:
You never click to move.
You never press harvest.
You write the logic.
Then the drone executes your code.
It Quickly Stops Being “Farming”
At first, it feels simple.
Check the cell.
If it’s empty — plant.
If it’s ready — harvest.
But then systems start stacking:
- Water tank has limits.
- Energy runs out.
- Seeds cost gold.
- Crops grow over time.
- The grid must be traversed efficiently.
- Score depends on smart decisions.
Now it’s not a farming game.
It’s an optimization problem.
It’s About Designing Behavior
You don’t react.
You design.
You write loops.
You define conditions.
You structure traversal.
You manage resources.
If your logic is inefficient:
- You waste ticks.
- You waste energy.
- You miss harvest windows.
- Your score drops.
It becomes a game about algorithm design.
Why C++?
Most programming games use Python.
I deliberately chose C++.
Because C++ forces you to think more like an engineer:
- Strong typing
- Explicit control flow
- Deterministic execution
- Clear system boundaries
It feels less like scripting.
More like building a machine.
And your drone is that machine.
How It Works Under the Hood
- Your C++ code is compiled to WebAssembly.
- A restricted drone API is injected.
- The simulation runs in a sandbox.
- The grid size is provided dynamically.
- Only safe functions are exposed.
Your code becomes the AI brain.
The game becomes the environment.
Clean separation.
Deterministic simulation.
Pure logic.
Where This Could Go
Right now, it’s the first iteration.
But the idea has room to grow:
- Competitive bot leaderboards
- Optimization tournaments
- Different maps with obstacles
- Energy-constrained challenges
- Multi-drone simulations
- Profit-maximizing strategies
- Time-based scoring competitions
It could evolve into:
A C++ automation strategy game.
Or even a competitive AI arena in the browser.
Try It
If you enjoy:
- Automation
- Systems thinking
- Algorithm design
- Programming-driven gameplay
You might like this.
Open it.
Write some C++.
Watch your drone think.
👉 https://cropbot.fly.dev/ repo-> https://github.com/pioner92/cropbot
This started as a small experiment.
But I think “control a drone with C++” is a concept with serious potential.
메타데이터
- post_id
- 38537fe28cb2
- slug
- control-a-farming-drone-with-c-play-it-in-your-browser-cropbot-38537fe28cb2
- url
- https://medium.com/@shumolek/control-a-farming-drone-with-c-play-it-in-your-browser-cropbot-38537fe28cb2
- canonical_url
- https://medium.com/@shumolek/control-a-farming-drone-with-c-play-it-in-your-browser-cropbot-38537fe28cb2
- author_url
- https://medium.com/@shumolek
- status
- ok
- fetched_at
- 2026-06-29 01:02:39