Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
b4285ec
migration to CBA system, rework of functionality
indig0fox Mar 26, 2022
8a26ce2
ready for debugging
indig0fox Mar 27, 2022
5606d06
bunch more changes
indig0fox Mar 28, 2022
89659ec
ready for playtesting?
indig0fox Mar 29, 2022
0665d5c
changes cap loop to persist, prevent duplicate changers of record stat
indig0fox Mar 30, 2022
fbef91a
removes cba_settings_whitelist
indig0fox Mar 30, 2022
e55ac6d
initialmarkers, zeus fired, ace_bft exclude, fix gren dupe
indig0fox Apr 8, 2022
7ff41d0
counter,respawntickets,drawicon for entities
indig0fox Apr 11, 2022
62affe4
remotecontrol, settings, wep display text, notifications on start/stop
indig0fox Apr 12, 2022
64c1aed
finalize 2.0.0-RC2
indig0fox Apr 12, 2022
f9ca0b0
admin diary controls, some fixes
indig0fox Apr 14, 2022
d6549e4
fixes exportData minMissionTime parse; excludes HC for saveOnEmpty
indig0fox Apr 15, 2022
286774e
Update x/ocap2/addons/recorder/fnc_init.sqf
indig0fox Apr 15, 2022
e397415
account for countermeasure shots (flares) in tracking/deletion
indig0fox Apr 21, 2022
b5a820c
start fire EH rework for bullets
indig0fox Sep 27, 2022
c5e6ac2
change addon back to OCAP instead of OCAP2
indig0fox Sep 29, 2022
834a1cb
utilize new deleted EH for projectiles
indig0fox Sep 30, 2022
cb3178e
fix bugs, ready for testing
indig0fox Oct 2, 2022
fabd8a2
fix projectile and submunitions rework, admin controls
indig0fox Oct 9, 2022
21a2057
many tweaks
indig0fox Oct 12, 2022
bef670d
minor fixes to eventWeaponText, weaponState command misbehaving remotely
indig0fox Oct 18, 2022
5d379dc
massive documentation write-up and cleanup
indig0fox Oct 19, 2022
a46b2b3
move marker deletions back to projectileMonitors
indig0fox Oct 20, 2022
436f0cc
fix non-deleting UGL rounds - testing on dedi w AI
indig0fox Feb 22, 2023
3a3b895
add database export module for new extension, start basic implement
indig0fox Jul 12, 2023
e26f6f0
see extension repo for changes
indig0fox Jul 25, 2023
4294ef8
fix radio events
indig0fox Jul 26, 2023
57acca1
add rounding to radio freq
indig0fox Jul 27, 2023
8152f6e
add ace events, tidy up initDB functionality
indig0fox Aug 6, 2023
c8baed4
numerous additions incl new fired tracking
indig0fox Aug 22, 2023
db52408
add hemtt build support
indig0fox Sep 18, 2023
70b43c8
Merge origin/main into database
fank Jan 31, 2026
6c0b568
Update CLAUDE.md for new modular architecture
fank Jan 31, 2026
9408522
Add README.md
fank Jan 31, 2026
3843bb0
Fix HEMTT build errors
fank Feb 1, 2026
358c1dd
Fix extension DLL name and params order
fank Feb 1, 2026
2d8c374
Add debug logging for extension communication
fank Feb 1, 2026
415d974
Handle new extension response format
fank Feb 1, 2026
3df61e9
Rename storage initialization commands
fank Feb 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ root = true

# every file
[*]
indent_style = tab
indent_size = 4
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
*.pbo

*.bak

.hemttout/

hemtt.exe
17 changes: 17 additions & 0 deletions .hemtt/project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name = "OCAP"
prefix = "ocap"
mainprefix = "x"
author = "OCAP2 Team"
[files]
include = [
"mod.cpp",
"licence.txt",
"logo_ocap.paa",
]

[lints.sqf]
# Suppress errors until code is fixed
command_case = false
banned_commands = false
undefined = false
format_args = false
103 changes: 64 additions & 39 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,68 +9,93 @@ OCAP2 (Operation Capture and Playback v2) is an Arma 3 addon that records gamepl
**Language**: SQF (Arma 3 scripting language)
**Dependencies**: Arma 3 2.04+, CBA (Community Base Addons), optional ACE3 integration

## Development
## Build

There is no build system for SQF development. Edit `.sqf` files directly and pack the addon as a `.pbo` file using Arma 3 tools (Addon Builder or similar).
Uses HEMTT for building PBO files:
```bash
hemtt build # Development build
hemtt release # Release build
```

The extension DLL (`OcapReplaySaver2`) handles performance-critical data export and requires separate compilation.
The extension DLL (`ocap_recorder`) handles database export and requires separate compilation (see extension repo).

## Architecture

Modular CBA-style addon structure:

```
addons/@ocap/addons/ocap/
├── config.cpp # CfgPatches, CfgFunctions, CfgRemoteExec definitions
├── script_macros.hpp # LOG, DEBUG, BOOL macros and ARR2-ARR6 array helpers
└── functions/ # All SQF functions
addons/
├── main/ # Core settings, macros, version info
├── recorder/ # Capture loop, event handlers, export
├── database/ # Database connection, metrics, real-time data streaming
└── extension/ # Extension DLL wrapper
```

Each addon follows XEH structure:
- `XEH_preInit.sqf` - CBA settings registration
- `XEH_postInit.sqf` - Post-init logic
- `XEH_prep.sqf` - Function preparation
- `config.cpp` - CfgPatches, CfgFunctions
- `script_component.hpp` - Component-specific macros

### Key Files

- **fn_startCaptureLoop.sqf**: Core capture loop (runs ~10Hz), tracks all units and vehicles per frame
- **fn_extension.sqf**: Wrapper for native DLL extension calls
- **fn_addEventHandlers.sqf**: Sets up fired/hit/killed/connected event handlers
- **fn_getUnitType.sqf**: Classifies unit roles (medic, engineer, crew, etc.)
- **recorder/fnc_captureLoop.sqf**: Core capture loop, tracks units and vehicles per frame
- **recorder/fnc_addEventMission.sqf**: Mission event handlers setup
- **recorder/fnc_eh_firedMan.sqf**: Fired event handler with projectile tracking
- **database/fnc_initDB.sqf**: Database connection and mission context initialization
- **database/fnc_metricsLoop.sqf**: Server performance metrics collection

### Configuration

User settings are in `userconfig/ocap/config.hpp`. Key options:
- `ocap_autoStart`: Auto-start recording on session begin
- `ocap_minPlayerCount`: Minimum players required to start
- `ocap_frameCaptureDelay`: Capture interval in seconds
- `ocap_excludeClassFromRecord`: Classes to exclude from recording
All settings use CBA Settings system (configurable in-game via addon options):
- `OCAP_enabled`: Master recording toggle
- `OCAP_settings_autoStart`: Auto-start on session begin
- `OCAP_settings_minPlayerCount`: Minimum players to start
- `OCAP_settings_frameCaptureDelay`: Capture interval in seconds
- `OCAP_settings_excludeClassFromRecord`: Classes to exclude

## Code Conventions

### Function Documentation
Every function has a JSDoc-style header block:
### CBA Macros
Functions use CBA component macros defined in `main/script_macros.hpp`:
```sqf
/*
* Script: fn_example.sqf
* Description: What this function does
* Parameters:
* _param1 - description
* Returns: description
* Examples: (examples)
* Public: Yes/No
* Author: Name
*/
FUNC(name) // Expands to OCAP_recorder_fnc_name
GVAR(name) // Expands to OCAP_recorder_name (component variable)
EGVAR(comp,name) // Expands to OCAP_comp_name (external component variable)
QGVAR(name) // Quoted variable name
LOG(), INFO(), WARNING(), ERROR() // Logging macros
```

### Includes
All functions must include at the top:
```sqf
#include "\userconfig\ocap\config.hpp"
#include "script_macros.hpp"
#include "script_component.hpp"
```

### Naming
- Global functions: `ocap_fnc_<name>` (defined in config.cpp)
- Global variables: `ocap_<name>`
- Macros: `LOG("message")`, `DEBUG("message")`, `BOOL(value)`
### Function Documentation
```sqf
/* ----------------------------------------------------------------------------
FILE: fnc_example.sqf

FUNCTION: OCAP_recorder_fnc_example

Description:
What this function does

Parameters:
_param1 - description

Returns:
description

Public:
No

Author:
Name
---------------------------------------------------------------------------- */
```

### ACE3 Integration
ACE3 support is optional with graceful fallback. The `fn_trackAce*.sqf` functions handle:
- Explosive lifecycle tracking (throw-to-detonation)
- Placed charges and mines
- Remote detonation events
- Thrown grenades with 3D position tracking
ACE3 support is optional with graceful fallback. `fnc_aceExplosives.sqf` handles placed explosives and detonation tracking.
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,39 @@
OCAP-addon
# OCAP Addon

Arma 3 addon for Operation Capture and Playback (OCAP). Records gameplay data during missions for web-based playback analysis.

> **Note:** For general OCAP information, documentation, and issue tracking, see the main repository: https://github.com/OCAP2/OCAP

## Requirements

- Arma 3 2.10+
- [CBA_A3](https://steamcommunity.com/workshop/filedetails/?id=450814997)
- [OCAP Recorder Extension](https://github.com/OCAP2/extension) (for database export)
- Optional: ACE3 for enhanced medical state tracking

## Installation

Subscribe via Steam Workshop or download the latest release and place the `@OCAP` folder in your Arma 3 directory.

## Building from Source

Requires [HEMTT](https://github.com/BrettMayson/HEMTT):

```bash
hemtt build # Development build
hemtt release # Release build with signed PBOs
```

## Configuration

All settings are configurable in-game via CBA Settings (Options > Addon Options > OCAP).

Key settings:
- **Recording Enabled** - Master toggle
- **Auto Start Recording** - Start recording when minimum player count is reached
- **Minimum Player Count** - Players required for auto-start
- **Frame Capture Delay** - Interval between position captures (seconds)

## License

GNU General Public License v3.0
82 changes: 0 additions & 82 deletions addons/@ocap/addons/ocap/config.cpp

This file was deleted.

41 changes: 0 additions & 41 deletions addons/@ocap/addons/ocap/functions/fn_addEventHandlers.sqf

This file was deleted.

Loading