Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize CBA_fnc_players #668

Merged
merged 2 commits into from
May 7, 2017
Merged

Optimize CBA_fnc_players #668

merged 2 commits into from
May 7, 2017

Conversation

kymckay
Copy link
Contributor

@kymckay kymckay commented May 5, 2017

When merged this pull request will:

  • Use allDeadMen instead of allDead

allDead includes destroyed vehicles.

@commy2
Copy link
Contributor

commy2 commented May 5, 2017

#353 (comment)

But I never reproduced this. Will try right now.

@PabstMirror
Copy link
Contributor

PabstMirror commented May 5, 2017

NOTE: In player hosted game, the complete array of allPlayers may get delayed at the start. Use BIS_fnc_listPlayers if you need it earlier
image

Edit: Also see acemod/ACEX#25
Could possibly do if (CBA_missionTime < 200) then {oldWay} else {allPlayers}; but I'm not sure what the cut off is, and might not work for player's jipping.

@commy2
Copy link
Contributor

commy2 commented May 5, 2017

addMissionEventHandler ["EachFrame", {
    diag_log [diag_frameNo, allPlayers, [] call CBA_fnc_players, allPlayers isEqualTo ([] call CBA_fnc_players)];
}];
 0:39:07 [11821,[B CSCustom0:1 (Gefr. commy2)],[B CSCustom0:1 (Gefr. commy2),B CSCustom0:2 (Gefr. commy2 (2)) REMOTE],false]

@commy2
Copy link
Contributor

commy2 commented May 5, 2017

But why does it use allDead and not allDeadMen?

allDead
Return a list of all dead units including agents and destroyed vehicles. Dead units may be in vehicles.

@kymckay
Copy link
Contributor Author

kymckay commented May 6, 2017

Is it confirmed that the old way truly does return all players under the same circumstances in which allPlayers doesn't?

@commy2
Copy link
Contributor

commy2 commented May 6, 2017

See my test. Was local hosted.

@kymckay
Copy link
Contributor Author

kymckay commented May 6, 2017

Ah yeah, missed that 👍 Can change this to simply switch to allDeadMen then

@commy2 commy2 changed the title Optimize fnc_players Fix CBA_fnc_players May 7, 2017
@commy2 commy2 added the Bug Fix label May 7, 2017
@commy2 commy2 added this to the 3.4 milestone May 7, 2017
@commy2 commy2 changed the title Fix CBA_fnc_players Optimize CBA_fnc_players May 7, 2017
@commy2
Copy link
Contributor

commy2 commented May 7, 2017

It's still an optimization, because isPlayer filters out the wrecks atm. But this makes it slightly faster by not listing them in the first place.

@commy2 commy2 added Enhancement and removed Bug Fix labels May 7, 2017
@commy2 commy2 merged commit 3dcde46 into CBATeam:master May 7, 2017
@kymckay kymckay deleted the players branch May 7, 2017 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants