OmniFlow is a Java 17 + JavaFX city traffic simulator built for our OOAD final project. The finished version now focuses on a single polished Downtown Intersection scene with cars, buses, emergency vehicles, bikes, and pedestrians moving through a shared 2D traffic model.
The goal is not hyper-realistic traffic modeling. The goal is to demonstrate clean OO design, polymorphism, dependency injection, design patterns, JavaFX UI work, and basic persistence in a way that is easy to explain during the final code/demo interview.
- Evan Mohan
- Jake Huebner
- Java 17
- JavaFX
- Gradle
- JUnit 5
- One polished demo layout:
Downtown Intersection
- Agent types:
- cars
- buses
- emergency vehicles
- bikes
- pedestrians
- Features:
- start, pause, and single-step simulation controls
- speed control
- agent type filtering
- downtown-only layout focus
- agent selection/details
- save/load of layout state
- manual emergency-vehicle spawn from the control panel
- longer pedestrian walk windows with "finish crossing" behavior
- directional pedestrian signals with separate crossing phases and flashing walk countdowns
- four-lane downtown roads on both axes
- bus-stop dwell behavior with trailing vehicles queueing behind the bus
- one-shot emergency vehicles that despawn after clearing the scene
- temporary all-red emergency preemption with lane-clearing behavior for vehicles ahead
- bikes staying on sidewalk routes and stopping short of pedestrian crosswalks
- pedestrians and bikes exiting the map instead of looping/teleporting back through the scene
- Windows:
.\gradlew.bat run - macOS/Linux:
./gradlew run
- Windows: set
GRADLE_USER_HOMEto a non-OneDrive folder, then run.\gradlew.bat test - macOS/Linux: set
GRADLE_USER_HOMEto a local writable folder, then run./gradlew test
This repo currently lives in a OneDrive-backed path on our machine, and Gradle lock files can fail there. If that happens, use a local temp directory outside OneDrive for GRADLE_USER_HOME.
src/main/java/app: JavaFX startup and controller wiringsrc/main/java/ui: JavaFX view and canvas renderingsrc/main/java/sim: simulation engine, world state, camera, selection modelsrc/main/java/model: agent abstractions, factory, shared enums/constantssrc/main/java/model/agenttypes: concrete traffic agentssrc/main/java/model/layouts: layout strategies and layout helperssrc/main/java/persistence: save/load supportsrc/test/java: unit tests and starter scaffolding
AgentFactorycreates agents from shared type names.- The engine and persistence layer code to the
AgentProviderabstraction.
MapLayoutis the layout strategy interface.DowntownIntersectionLayoutis the active demo layout and owns downtown-specific drawing, signal timing, queueing, pedestrian crossing rules, and emergency preemption.
BaseAgentowns the sharedupdate(...)algorithm.- Agent subclasses customize behavior through small override hooks.
OmniFlowControllerwires UI actions to the model.- JavaFX listeners react to control changes and selection updates.
- Rendering reads model state rather than owning simulation logic.
SimulationEnginedepends onAgentProviderandMapLayout.WorldstoresAgentinstances polymorphically.
SimulationEngineacceptsWorld,AgentProvider, and a random supplier through its constructor.
- Each agent is updated through the shared
Agentinterface. - Agent subclasses vary behavior without large if/else trees or switch statements.
Main tests already in the repo:
AgentFactoryTestSimulationEngineTestLayoutBehaviorTestLayoutStoreTestCamera2DTest
Starter TODO-style scaffold:
LayoutBehaviorTodoTest
For this class project, we are aiming for meaningful coverage rather than perfect coverage. The model/simulation code matters more than exhaustive UI testing.
DESIGN.md: where the four required patterns are documentedREQUIREMENTS.md: rubric trace to concrete codeDEMO_INTERVIEW.md: quick guide for what to show during the final demo/interviewTODO.md: finish-line checklist
- Earlier project ideas included broader multimodal scope. The final submission is intentionally narrowed to a cleaner downtown traffic simulator because it is easier to finish well and explain clearly.
- The JavaFX UI was AI-assisted, which our instructors explicitly allowed for the project UI.