Callsign | Lat/Lng | Altitude | Speed | Heading | Destination |
---|
MapleSweep is a browser-based radar simulation designed to emulate aircraft behavior using agent-based modeling principles.
Each aircraft, represented by an independent AirplaneAgent
, enters the airspace from either a defined touchpoint
or the edge of the simulation zone, navigates toward a waypoint, and exits through a specified navigation point.
The system combines a PHP backend that simulates aircraft movement, altitude changes, and heading corrections, with a JavaScript-powered frontend radar interface. Aircraft data is polled every second and rendered in near real-time using a canvas-based radar, a D3 globe view, a sorted data table, and a raw JSON viewer. Out-of-bounds aircraft are also represented at the radar edge for tracking continuity.
This project was created as a learning and experimentation platform for:
Agent-based modeling is a core concept in artificial intelligence, where autonomous entities—called agents—perceive their environment and act based on internal state and goals. In MapleSweep, each aircraft behaves like a simplified AI agent, dynamically adjusting its heading, altitude, and speed to simulate real-world flight behavior under varying conditions. These agents make decisions about movement and altitude adjustments based on proximity to navigation targets, mimicking basic air traffic behavior and transitions.
Each AirplaneAgent
operates in a continuous decision loop that models realistic navigation behavior over time.
Upon spawn, an agent determines its entry point—either from a predefined touchpoint (such as an airport) or at the edge of the simulated airspace—and randomly selects a destination waypoint or exit.
Agents then calculate an optimal heading toward their target and initiate acceleration, altitude changes, and bearing corrections based on both current position and target proximity.
Altitude transitions are handled through stepwise changes, with a ceiling and floor range based on flight phase: entering aircraft gradually ascend toward cruising altitude (e.g., 36,000 ft), while exiting agents maintain high speeds and level flight. In contrast, touching aircraft (those simulating terminal proximity) descend toward lower altitudes and apply speed reduction algorithms that simulate approach dynamics.
Heading changes are controlled using an angular correction algorithm: if the deviation between the current heading and desired bearing exceeds a certain threshold, the agent temporarily pauses forward movement and focuses on reorienting its track. This prevents unrealistic or jittery turns and mimics real-world turn radius limitations.
Behavioral state transitions are triggered based on target proximity and timing: once an aircraft nears its assigned waypoint or crosses an altitude gate, it may transition from entering to touching or from touching to exiting. Each transition results in new targets, modified speed and climb parameters, and behavioral logic updates to reflect the next phase of flight.
The backend "radar" system continuously updates each agent and exposes their current state as structured JSON through a lightweight API. This "radar feed" includes details such as ICAO address, callsign, position, altitude, speed, heading, and status flags (e.g., emergency, ident, alert)—mirroring concepts found in real-world surveillance formats like ASTERIX.
A 2D radar interface built with HTML5 Canvas renders aircraft movement in near real-time, including callsign labels, directional triangles, and out-of-bounds markers. A scanline effect and range circles provide a classic radar-style experience.
Simultaneously, a D3-powered globe visualization presents aircraft positions in geospatial context. Each aircraft is dynamically rendered with altitude offsets and headings, offering an interactive global view of the simulated airspace.
The system is powered by a custom PHP backend and rendered using HTML5 Canvas and D3.js, with state updates polled from a near real-time JSON API. Its modular structure and behavioral design make it extensible for future enhancements such as sector-based ATC agents, conflict detection, or procedural flight planning logic.