OPTIMA — Battlefield Simulation
Operational-level multi-agent battlefield simulation; profiling and optimization cut resource use ~5× and made it ~5× faster.
- role
- Java Developer (Mid) → shared technical ownership
- period
- 2022 – 2025
Problem
An operational-level battlefield simulation that could not scale: 30 agents needed 128 GB of RAM on a medium map, with memory leaks and a codebase whose complexity blocked new features.
What was built
- Implemented new mechanics requested by the client:
- Sensors — complex mechanics for radars and vision.
- Effectors — agentized munitions, self-destructing drones.
- Transformers — an AI-based solution that can be calibrated for optimal information processing by agents.
- Behaviours — genetic algorithms and reinforcement learning of neural networks responsible for agents’ actions.
- Resupplying — agents can drop and pick up ammunition, or supply it directly.
- Unit behaviour and hierarchy — order of commands, rank-based behaviours, wave deployments.
- Reporting — reporting agents’ internal states, presented with Cesium visualisation and NATO symbology.
- Hierarchical communication system — echelons, rules of engagement, effector usage based on orders.
- Agents’ memory (run-based) and persistent memory — simulating experience and training from previous sessions.
- Events mechanics — designed and implemented a system for passing different kinds of information between agents and the actions they perform as a result.
- Profiling and refactoring that substantially reduced simulation-code complexity and resource consumption.
- Containerized and deployed on AWS, with automatic initialization of the fleet using spot instances — a cost-optimized way of running many simulations at once.
- Further developed the simulation and spatial engines — forked from the MASON library.
- Delivered for a Swiss partner — all communication and documentation in English.
Outcome
- Clean and modernized codebase ready for further development.
- Reduced resource needs ~5× — from 30 agents / 128 GB RAM to 200 agents on a 2× larger map.
- Memory leaks eliminated.
- Enabled 3D simulations.
- Presented at the Bundeswehr academy in Hamburg.
- Many new features and expanded analysis capabilities.
Challenges and Lessons
- Inheritance in OOP needs to be used with caution – complex objects can be constructed and parametrized using composition.
- Prefer self-documenting code with proper structure over complex code with good documentation.
- Complex simulation scenarios might seem to perform correctly until tested against simpler ones.
- Cache mechanics and parallelization can significantly speed up programs – be aware of race conditions.