Collision avoidance is a subject I try to tackle from time to time. I have tried steering behaviors and custom solutions before. They all had their own pros and cons. Testing ORCA and RVO2 was always on my mind. Thanks to a push from @Alex_8BitSkull , I tumbled down the rabbit hole and somehow managed to come back ![]()
I used RVO2 as a blueprint, but this solution was written from scratch. The only part I use is the ORCA solver, which is obviously based on the same algorithm.
There will be two versions available:
- Standard is free for personal, educational, experimental, and completely free, non monetized games or apps. The Standard version is coming in autumn 2026.
- Pro is available through paid access and requires at least a one time payment of $10 USD via GitHub Sponsors.
The Pro version is already available to all my past and current GitHub sponsors who have contributed at least $10. Special thanks for their support: @Alex_8BitSkull, @Pawel , Defold (team) and Refold (team), @AGulev
If you wanna check out the pro version → GitHub Sponsors
So… what is this?
Defold Crowd is a native extension for local crowd avoidance in Defold. It helps many circular agents move through the same 2D space while avoiding each other and static obstacles.
You provide positions, radii, speeds, neighbor settings, and desired velocity. The extension computes avoidance velocities and updated positions for the next simulation step.
What is it not?
Defold Crowd is not a complete movement AI system.
- No pathfinding. Plug in your own A*, navmesh, waypoint graph, flow field, or route planner.
- No formations or group movement. Squads, offsets, ranks, selection logic, and coordinated movement belong in your game code.
- No universal arrival solution. Stopping, slowing down, snapping, attacking, queueing… They differ from game to game.
- No physical collision solver. ORCA computes avoidance velocities, but your game may still need placement rules or overlap correction.
Extra features
- Polygonal and circular obstacles. Circular obstacles are cheaper than vertex based obstacles.
- Navigation masks. Air units do not collide with ground units, etc.
- Avoidance responsibility. Selected units yield more, or vice versa.
- Defold’s JobSystem and parallel simulation (Pro version only)
Managed game objects
There is a managed game object solution, but it is basically a reference implementation, not a production system. The managed game object API demonstrates how the native side drives Defold transforms, including goals, preferred velocity, simulation steps, and position write back.
It intentionally covers only the simplest case: a single collection of agents moving toward fixed world space goals. It can be treated as a starting point and a code reference. For real projects, you will probably want to extend it or replace it with your own native C/C++ implementation.
Technical features
The extension allocates during context setup and destruction; simulation steps use the memory reserved by the context.
- No C++ STL containers or strings.
- No classes; the core uses
structandnamespace. - No virtual functions.
- No exceptions or RTTI used by the source.
- No runtime allocation during simulation. Memory is reserved at context creation and released at destruction.
- Uses Defold allocation through
dmMemory::AlignedMalloc/dmMemory::AlignedFree. - Explicit types only; no
auto. - Small C/C++ standard headers only + Defold SDK headers.
- Error handling uses result enums instead of exceptions.
- Cache-conscious structs with
DM_ALIGNED(N):Agentis 64-byte aligned,Obstacleis 32-byte aligned.
License Summary (not legally binding)
Standard is free for personal, educational, experimental, and completely free non-monetized games or apps.
Pro is paid-access only and requires at least a one-time payment of $10 USD via GitHub Sponsors.
Any monetized game/app using either version requires at least a one-time payment of $10 USD via GitHub Sponsors.
Free releases are welcome to share project info (name, genre, date, links).
The Software is closed-source; source access may be granted upon request.
See License
