Skip to content

fabrizioT/bDetect

Repository files navigation

---------------------------------------------
bDetect | bullet detection framework - Readme
---------------------------------------------

Author: Fabrizio_T, Ollem (MP code)
Additional code: TPW
File Name: bdetect.sqf
License: GNU/GPL

---------------------------------------------
WHAT IS IT
---------------------------------------------

It's a small SP (Single Player) framework in form of single .sqf file, named "bdetect.sqf". Basic scripting knowledge required.
It was made in order to easily detect any flying bullets close to infantrymen, given some basic configuration (See: CONFIGURATION).
Once a bullet is found being closer enough to some unit, a custom callback function is called: it's up to you defining the contents of this callback function.

---------------------------------------------
REQUIREMENTS
---------------------------------------------

* ArmA2 CO v1.61 BETA or higher (but v1.60 should probably work too)
* CBA - Community Made Addons: https://dev-heaven.net/projects/cca/wiki/CBA

---------------------------------------------
CONFIGURATION
---------------------------------------------

bdetect_enable = true; 								// (Boolean, Default true) Toggle to Enable / Disable bdetect altogether.
bdetect_startup_hint = true;						// (Boolean, Default true) Toggle to Enable / Disable bDetect startup Hint.
bdetect_debug_enable = false;  						// (Boolean, Default false) Toggle to Enable / Disable debug messages.
bdetect_debug_chat = false;  						// (Boolean, Default false) Show debug messages also in globalChat.
bdetect_debug_levels = [0,1,2,3,4,5,6,7,8,9];  		// (Array, Default [0,1,2,3,4,5,6,7,8,9]) Filter debug messages by included levels. 
bdetect_callback = "bdetect_fnc_callback"; 			// (String, Default "bdetect_fnc_callback") Name for your own callback function
bdetect_callback_mode = "spawn"; 					// (String, Default "spawn") Allowed values: "call" or "spawn"
bdetect_fps_adaptation = true; 						// (Boolean, Default true) Whether bDetect should try to keep over "bdetect_fps_min" FPS while degrading quality of detection
bdetect_fps_min = 20; 								// (Number, Default 20) The minimum FPS you wish to keep
bdetect_fps_calc_each_x_frames = 16; 				// (Number, Default 16) FPS check is done each "bdetect_fps_min" frames. 1 means each frame.
bdetect_eh_assign_cycle_wait = 10;  				// (Seconds, Default 10). Wait duration foreach cyclic execution of bdetect_fnc_eh_loop()
bdetect_bullet_min_delay = 0.1; 					// (Seconds, Default 0.1) Minimum delay between 2 consecutive shots fired by a single unit for the last bullet to be tracked. BEWARE: Very low values may lag.
bdetect_bullet_max_delay = 2; 						// (Seconds, Default 2)
bdetect_bullet_initial_min_speed = 360; 			// (Meters/Second, Default 360) Bullets slower than this are ignored.
bdetect_bullet_max_proximity = 10; 					// (Meters, Default 10) Maximum proximity to unit for triggering detection
bdetect_bullet_min_distance = 25; 					// (Meters, Default 25) Bullets having travelled less than this distance are ignored
bdetect_bullet_max_distance = 500; 					// (Meters, Default 500) Bullets havin travelled more than distance are ignored
bdetect_bullet_max_lifespan = 0.7; 					// (Seconds, Default 0.7) Bullets living more than these seconds are ignored
bdetect_bullet_max_height = 8; 						// (Meters, Default 8) Bullets going higher than this -and- diverging from ground are ignored
bdetect_bullet_skip_mags = []; 						// (Array) Skip these bullet types altogether. Example: ["30rnd_9x19_MP5", "30rnd_9x19_MP5SD", "15Rnd_9x19_M9"]
bdetect_mp_enable = false;  						// (Boolean, Default false) Toggle to Enable / Disable MP experimental support
bdetect_mp_per_frame_emulation = false;  			// (Boolean, Default false) Toggle to Enable / Disable experimental server per-frame-execution emulation
bdetect_mp_per_frame_emulation_frame_d = 0.02;  	// (Seconds, Default 0.02) Per-frame-execution emulation frame duration

---------------------------------------------
HOW TO RUN IT
---------------------------------------------

Running bDetect is straightforward if you have some basic knowledge of .sqf scripting. 
There are 5 simple required steps, to be executed from within your own .sqf script file:

* Load "bdetect.sqf"  from within your own script. Put "bdetect.sqf" into your mission folder and call it from there.
* Set any bDetect variables you wish having values different than default.
* Set bDetect "bdetect_callback" special variable: it holds the name of your own callback function, which will be executed on a per-unit basis when a bullet is detected close.
* Declare your own callback function, named as "bdetect_callback", and define its payload. Make function as simple, fast and compact as possible.
* Initialize bDetect and wait for completion.

Other stuff is optional.

---------------------------------------------
INITIALIZATION EXAMPLE
---------------------------------------------

See bottom part of bdetect.sqf for instructions.

About

bDetect | bullet detection framework - for ArmA2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published