Skip to content

Commit

Permalink
Release preparations
Browse files Browse the repository at this point in the history
- Disabled remaining debug macros
- Removed debug logging
- Modified AAF sector to be capturable (used for debug purposes anyway)
  • Loading branch information
Cre8or committed Mar 11, 2024
1 parent d6514ab commit cd7444d
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 52 deletions.
24 changes: 12 additions & 12 deletions mission.sqm
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ class EditorData
};
class LayerIndexProvider
{
nextID=6833;
nextID=6856;
};
class Camera
{
pos[]={5934.0225,643.97058,10825.905};
dir[]={3.8576559e-006,-0.99331278,-0.11614408};
up[]={3.315126e-005,0.11578291,-0.9932816};
aside[]={-1.0000865,-1.7608251e-006,-3.5187993e-005};
pos[]={5491.7139,738.74988,11001.508};
dir[]={0.44747117,-0.83718854,-0.31447837};
up[]={0.68496013,0.54690415,-0.48138228};
aside[]={-0.57499671,-5.7043508e-009,-0.81816232};
};
};
binarizationWanted=0;
Expand Down Expand Up @@ -3532,7 +3532,7 @@ class Mission
{
dataType="Trigger";
position[]={5826.2158,105.93578,10799.777};
angle=4.023437;
angle=4.0234375;
class Attributes
{
name="sector_G";
Expand All @@ -3543,12 +3543,12 @@ class Mission
sizeC=17.254;
repeatable=1;
activationType="NOT PRESENT";
activationBy="GUER";
activationBy="GUER SEIZED";
isRectangle=1;
};
id=5112;
type="EmptyDetector";
atlOffset=-0.14498901;
atlOffset=-0.14499664;
};
};
id=39;
Expand Down Expand Up @@ -36021,7 +36021,7 @@ class Mission
};
};
id=2951;
atlOffset=-0.0033416748;
atlOffset=96.5;
};
class Item29
{
Expand Down Expand Up @@ -52465,7 +52465,7 @@ class Mission
class PositionInfo
{
position[]={5759.8633,40.094688,11360.396};
angles[]={-0,0,6.1906505};
angles[]={0,0,6.1906505};
};
side="Empty";
flags=4;
Expand Down Expand Up @@ -52497,11 +52497,11 @@ class Mission
};
};
id=1558;
atlOffset=0.47418594;
atlOffset=0.5693512;
};
};
id=3646;
atlOffset=-65.179008;
atlOffset=-65.091171;
};
class Item25
{
Expand Down
2 changes: 1 addition & 1 deletion mission/settings.inc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// ----------------------------------------------------------------------------------------------------------------------------------
// AI SETTINGS
// ----------------------------------------------------------------------------------------------------------------------------------
#define MACRO_AI_MAXCOUNT 32 // How many AI units can exist at most at any given time
#define MACRO_AI_MAXCOUNT 64 // How many AI units can exist at most at any given time
#define MACRO_AI_INCLUDEPLAYERS false // Whether or not players are counted towards the AI limit
#define MACRO_AI_ALLOWVEHICLES true // Whether or not the AI is allowed to use any vehicles at all. Only affects vehicles that would otherwise be allowed for AI use
#define MACRO_AI_PEACEFULMODE false // Whether or not the AI is allowed to engage other units.
Expand Down
8 changes: 4 additions & 4 deletions res/common/macros.inc
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@
#define MACRO_NM_COSTMULTIPLIER_OFFMESH_INF 1.5 // By how much the node cost is multiplied when travelling to/from points outside of the nodemesh (such as the origin/destination), for infantry
#define MACRO_NM_COSTMULTIPLIER_OFFMESH_VEH 3 // By how much the node cost is multiplied when travelling to/from points outside of the nodemesh (such as the origin/destination), for vehicles
#define MACRO_NM_MAXCOUNT_NODES 10 // How many start/end nodes may be considered in each findPath query (more may yield better results, but impacts performance)
#define MACRO_NM_DANGERLEVEL_INF_DECREASERATE 1 // By how much the danger level of all infantry node edges should decrease, per second
#define MACRO_NM_DANGERLEVEL_VEH_DECREASERATE 2 // By how much the danger level of all vehicle node edges should decrease, per second
#define MACRO_NM_DANGERLEVEL_INF_DECREASERATE 2 // By how much the danger level of all infantry node edges should decrease, per second
#define MACRO_NM_DANGERLEVEL_VEH_DECREASERATE 3 // By how much the danger level of all vehicle node edges should decrease, per second
#define MACRO_NM_DANGERLEVEL_INF_GAIN 100 // By how much an edge's danger level increases if an infantry unit dies on it
#define MACRO_NM_DANGERLEVEL_VEH_GAIN 600 // By how much an edge's danger level increases if a vehicle is destroyed on it (does not account for the crew!)
#define MACRO_NM_DANGERLEVEL_INF_MAX 1000 // The maximum cap for an infantry node edge's danger level
Expand Down Expand Up @@ -758,10 +758,10 @@
//#define MACRO_DEBUG_AI_COMMANDER_DISABLED
//#define MACRO_DEBUG_AI_DRIVER
//#define MACRO_DEBUG_AI_DRIVER_HALT
#define MACRO_DEBUG_AI_MOVEPOS
//#define MACRO_DEBUG_AI_MOVEPOS
//#define MACRO_DEBUG_AI_DODGEVEHICLES

#define MACRO_DEBUG_CA
//#define MACRO_DEBUG_CA

//#define MACRO_DEBUG_GM_PRESLOT

Expand Down
64 changes: 30 additions & 34 deletions scripts/nodeMesh/fn_nm_findPath.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ if (alive _startNode) then {
_nodeStrX = str (_nodeX getVariable [QGVAR(nodeID), -1]);
_namespace_isEndNode setVariable [_nodeStrX, true];
_namespace_endNodesCost setVariable [_nodeStrX, _cost];
diag_log format ["End node cost (%1): %2", _nodeStrX, _cost];
//diag_log format ["End node cost (%1): %2", _nodeStrX, _cost];

// If this node is a segment node, fetch its 2 end knots and make them end nodes aswell.
// This way the next stage will be able to trace these knots back to the actual end node.
Expand Down Expand Up @@ -242,13 +242,13 @@ if (_startNodesCount == 0 or {_endNodesCount == 0}) exitWith {
//systemChat "[fnc_nm_findPath] ERROR: Could not determine the start/end node!";
[[],[],[]];
};

/*
diag_log "";
diag_log format ["Candidates (start): %1", _nodeQueue apply {(_x # 1) getVariable [QGVAR(nodeID), -1]}];
diag_log format ["Candidates (end): %1", (allVariables _namespace_isEndNode) apply {
[parseNumber _x, (_namespace_endNodes getVariable [_x, []]) apply {_x getVariable [QGVAR(nodeID), -1]}]
}];

*/



Expand All @@ -275,18 +275,18 @@ while {true} do {
_curCost = _curEntry param [0, _const_maxCost];
_curKnotStr = str (_curKnot getVariable [QGVAR(nodeID), -1]);
_namespace_unvisited setVariable [_curKnotStr, false];
diag_log format ["Checking knot %1 (cost: %2)", _curKnotStr, _curCost];
//diag_log format ["Checking knot %1 (cost: %2)", _curKnotStr, _curCost];

// Abort early if this knot's cost exceeds the highest determined cost
if (_curCost >= _maxCost) then {
diag_log format ["Ending search - candidate knot is too expensive (max: %1)", _maxCost];
//diag_log format ["Ending search - candidate knot is too expensive (max: %1)", _maxCost];
_nodeQueue = []; // Also clear the queue, as any subsequent entries will be even more expensive than this one
continue;
};

// If this knot leads to the destination, compare it to the current best end node
if (_namespace_isEndNode getVariable [_curKnotStr, false]) then {
diag_log format [" Knot %1 leads to the end", _curKnotStr];
//diag_log format [" Knot %1 leads to the end", _curKnotStr];

// Let the knot's end nodes have the first go at being the best candidate
private _endNodes = _namespace_endNodes getVariable [_curKnotStr, []];
Expand All @@ -298,15 +298,15 @@ while {true} do {

// If this node has a lower cost to the destination than the previous maximum, set it as the new end node
if (_newCost < _maxCost) then {
diag_log format [" Knot %1's end node %2 is new best end node (%3 < %4)", _curKnotStr, _nodeStrX, _newCost, _maxCost];
//diag_log format [" Knot %1's end node %2 is new best end node (%3 < %4)", _curKnotStr, _nodeStrX, _newCost, _maxCost];
_maxCost = _newCost;
_bestEndNode = _nodeX;

_namespace_precedents setVariable [_nodeStrX, _curKnot];
_namespace_segmentIndex setVariable [format ["%1_%2", _curKnotStr, _nodeStrX], _segmentCost # 1];
} else {
/* } else {
diag_log format [" Knot %1's end node %2 costs more (%3 > %4), ignoring...", _curKnotStr, _nodeStrX, _newCost, _maxCost];
};
*/ };
} forEach _endNodes;

// Only after checking the knot's end nodes (if it has any), we check the knot itself as a candidate.
Expand All @@ -319,23 +319,23 @@ while {true} do {
_newCost = (_namespace_endNodesCost getVariable [_curKnotStr, 0]) + _curCost;

if (_newCost < _maxCost) then {
diag_log format [" Knot %1 is new best end node (%2 < %3)", _curKnotStr, _newCost, _maxCost];
//diag_log format [" Knot %1 is new best end node (%2 < %3)", _curKnotStr, _newCost, _maxCost];
_maxCost = _newCost;
_bestEndNode = _curKnot;
} else {
/* } else {
diag_log format [" Knot %1 costs more (%2 > %3), ignoring...", _curKnotStr, _newCost, _maxCost];
};
*/ };
};

diag_log format [" Neighbouring knots: %1", _curKnot getVariable [_varName_knots, []]];
//diag_log format [" Neighbouring knots: %1", _curKnot getVariable [_varName_knots, []]];

// Iterate through this node's neighbour knots
{
_nodeStrX = str _x;

// Only check this knot if it hasn't been visited yet
if !(_namespace_unvisited getVariable [_nodeStrX, true]) then {
diag_log format [" Skipping neighbour %1 (already visited)", _x];
//diag_log format [" Skipping neighbour %1 (already visited)", _x];
continue;
};

Expand All @@ -347,27 +347,27 @@ while {true} do {

// If the new cost is lower, update the node's precedent
if (_newCost < _oldCost) then {
diag_log format [" Saving new cost (%1 -> %2: %3) - previous: %4", _curKnotStr, _nodeStrX, _newCost, _oldCost];
//diag_log format [" Saving new cost (%1 -> %2: %3) - previous: %4", _curKnotStr, _nodeStrX, _newCost, _oldCost];
_namespace_costs setVariable [_nodeStrX, _newCost];
_namespace_precedents setVariable [_nodeStrX, _curKnot];
_namespace_segmentIndex setVariable [format ["%1_%2", _curKnotStr, _nodeStrX], _segmentCost # 1];
} else {
/* } else {
diag_log format [" Neighbour knot %1 costs more (%2 > %3) - ignoring...", _x, _newCost, _oldCost];
};
*/ };

// Add the new node to the queue
// Generally we only do this for nodes that are undiscovered, but if a lower cost is found to a previously
// disovered neighbour, we'll want to update its value in the queue (so it evaluated sooner).
if (_namespace_undiscovered getVariable [_nodeStrX, true]) then {
_namespace_undiscovered setVariable [_nodeStrX, false];
_nodeQueue pushBack [_newCost, _nodeX];
diag_log format [" Adding neighbour knot %1 to the queue (cost: %2 / %3)", _x, _newCost, _oldCost];
//diag_log format [" Adding neighbour knot %1 to the queue (cost: %2 / %3)", _x, _newCost, _oldCost];
} else {
if (_newCost < _oldCost) then {
_nodeIndex = _nodeQueue findIf {_x # 1 == _nodeX};

if (_nodeIndex >= 0) then {
diag_log format [" Updating queued neighbour knot %1's cost (%2) - previous: %3", _x, _newCost, _oldCost];
//diag_log format [" Updating queued neighbour knot %1's cost (%2) - previous: %3", _x, _newCost, _oldCost];
_nodeQueue set [_nodeIndex, [_newCost, _nodeX]];
};
};
Expand All @@ -380,21 +380,20 @@ while {true} do {

// If we finished searching and failed to reach an end node, it means no path could be found
if (isNull _bestEndNode) exitWith {
systemChat "ERROR: Couldn't find a path! Exiting...";
diag_log "ERROR: Couldn't find a path! Exiting...";
//systemChat "ERROR: Couldn't find a path! Exiting...";
//diag_log "ERROR: Couldn't find a path! Exiting...";
[[],[],[]]
};

_lastNode = _bestEndNode;
_curKnot = _namespace_precedents getVariable [str (_bestEndNode getVariable [QGVAR(nodeID), -1]), objNull];
_result pushBack _bestEndNode;

diag_log format ["Reversing path (starting at %1)", _bestEndNode getVariable [QGVAR(nodeID), -1]];

//diag_log format ["Reversing path (starting at %1)", _bestEndNode getVariable [QGVAR(nodeID), -1]];
while {alive _curKnot} do {
_curKnotStr = str (_curKnot getVariable [QGVAR(nodeID), -1]);
_lastNodeStr = str (_lastNode getVariable [QGVAR(nodeID), -1]);
diag_log format [" At node %1...", _curKnotStr];
//diag_log format [" At node %1...", _curKnotStr];

// Fetch this node's segment and segment index
_segment = _curKnot getVariable [format [_varName_segmentsX, _lastNodeStr], []];
Expand All @@ -407,7 +406,7 @@ while {alive _curKnot} do {
if (_segmentIndex >= 0) then {
_segment = _segment # _segmentIndex;
};
diag_log format [" Appending segment #%1 (%2 -> %3): %4", _segmentIndex, _curKnotStr, _lastNodeStr, _segment apply {_x getVariable [QGVAR(nodeID), -1]}];
//diag_log format [" Appending segment #%1 (%2 -> %3): %4", _segmentIndex, _curKnotStr, _lastNodeStr, _segment apply {_x getVariable [QGVAR(nodeID), -1]}];

// Reverse the segment so the nodes are in the correct order, then append it to the results
_segment = +_segment;
Expand All @@ -420,7 +419,7 @@ while {alive _curKnot} do {
_curKnot = _namespace_precedents getVariable [_curKnotStr, objNull];
};
reverse _result;
diag_log format ["Preliminary path (%1): %2", _maxCost, _result apply {_x getVariable [QGVAR(nodeID), -1]}];
//diag_log format ["Preliminary path (%1): %2", _maxCost, _result apply {_x getVariable [QGVAR(nodeID), -1]}];



Expand Down Expand Up @@ -461,13 +460,13 @@ if (_shouldRebuildResult) then {
};

_result = _resultCopy;
diag_log format ["Removed redundant loops - new path: %1", _result apply {_x getVariable [QGVAR(nodeID), -1]}];
//diag_log format ["Removed redundant loops - new path: %1", _result apply {_x getVariable [QGVAR(nodeID), -1]}];
};




/*

// --------------------------------------------------- STAGE 4 / 6 ----------------------------------------------------
// Check if the head and tail of the path can be optimised
private _indexLast = count _result - 1;
Expand Down Expand Up @@ -557,20 +556,17 @@ if (_newHeadIndex < _indexLast) then {

if (_newHeadIndex > 0 or {_newTailIndex < _indexLast}) then {
_result = _result select [_newHeadIndex, _newTailIndex + 1 - _newHeadIndex];
/*
if (_newHeadIndex > 0) then {
//systemchat format ["Optimised away %1 head node(s)", _newHeadIndex];
diag_log format [" Optimised away %1 head node(s)", _newHeadIndex];
};
if (_newTailIndex < _indexLast) then {
//systemchat format ["Optimised away %1 tail node(s)", _indexLast - _newTailIndex];
diag_log format [" Optimised away %1 tail node(s)", _indexLast - _newTailIndex];
};
};
*/
diag_log format ["Found a path! (%1 ms) Cost: %2 - Nodes: %3", (diag_tickTime - _timeStart) * 1000, _maxCost, _result apply {_x getVariable [QGVAR(nodeID), -1]}];
};
//diag_log format ["Found a path! (%1 ms) Cost: %2 - Nodes: %3", (diag_tickTime - _timeStart) * 1000, _maxCost, _result apply {_x getVariable [QGVAR(nodeID), -1]}];



Expand Down
2 changes: 1 addition & 1 deletion scripts/units/fn_unit_onKilled.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ if (!isMultiplayer and {_unit == player}) then {
private _newUnit = _grp createUnit [typeOf _unit, [0,0,0], [], 0, "CAN_COLLIDE"];

// Switch units and reassign the curator module
selectPlayer _newUnit;
unassignCurator GVAR(curatorModule);
selectPlayer _newUnit;
_newUnit assignCurator GVAR(curatorModule);
GVAR(curatorModule) addCuratorEditableObjects [[_newUnit], false];

Expand Down

0 comments on commit cd7444d

Please sign in to comment.