Skip to content

HC Experiment and Strongpoints#102

Draft
Landric wants to merge 4 commits into
Crowdedlight:mainfrom
Landric:feature/strongpoint
Draft

HC Experiment and Strongpoints#102
Landric wants to merge 4 commits into
Crowdedlight:mainfrom
Landric:feature/strongpoint

Conversation

@Landric
Copy link
Copy Markdown
Contributor

@Landric Landric commented Aug 31, 2024

Experiment to incorporate headless clients to improve performance. If CZA is also loaded on any HCs, create a "register" so that units can be spawned directly on HCs.

Demoed with a "Strongpoint" module - garrisons a number of buildings in a radius (using LAMBs, if present)

If CZA is *also* loaded on any HCs, create a "register" so that units can be spawned directly on HCs
Copy link
Copy Markdown
Owner

@Crowdedlight Crowdedlight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it is still marked as draft. Just did a glimpse through and put in the comments I got from it.

Comment on lines +11 to +13
private _hcRegister = GETMVAR(GVAR(hcRegister),createHashMap);
_hcRegister set [clientOwner, diag_fps];
SETMVAR(GVAR(hcRegister),_hcRegister);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, not sure if it is worth it to sync an entire hashmap across the network, compared to an array of HCs, and then use setVariable[GVAR(hcFPS), round diag_fps, true];

Or even do nested array so [[hc1,fps],[hc2,fps]...]

As I the usage would be to loop through them, not know the key of the one you want, until you have been through them all.

transmitting an entire hashmap every 5 sec, compared to a single int value, should have some impact ;-)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use setVariable[GVAR(hcFPS), round diag_fps, true];

That would only work for one HC though, right? Otherwise you'd still need a mapping from HC id to fps.

Or even do nested array so [[hc1,fps],[hc2,fps]...]

Is it much faster to send a nested array than a hashmap? (It'd definitely make updating slower, because you'd have to iterate through the whole array until you found the right HC, rather than just using a key?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could simply update the register every, say, 60 seconds instead

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm.

So good point that when updating the value a nested array wouldn't be quicker.

Usually I would do player setVariable[GVAR(hcFPS), round diag_fps, true]; as then any other client with a reference to that player, could use the _unit getVariable[] syntax to get the value. So if you have a list of registered HCs, you loop through it and read the public variables placed on the reference to the HC. Thus only needing a list of HCs, as you can lookup the variable saved on that player "object".

I believe that would work with the HC too, as that is the same reference you need to send spawn event to the HC with CBA events?

But I am honestly not sure if there is any real performance benefit in that compared to sending a hashmap over the network. 😅

Comment thread addons/misc/functions/fnc_strongpoint.sqf Outdated
if(!isNull _unit) then { _params = _params - ["_composition"]; };
if(!EGVAR(main,zeiLoaded)) then { _params = _params - ["_sandbags"]; };

_dialogResult params _params;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be commented out when done testing ;-)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully by the time I'm finished, that line will be necessary :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants