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

fnc_onDrawScope2D using more than 50ms frametime > using any ACE PIP optic drops the framerate to <10fps #6811

Closed
Auge103 opened this issue Feb 12, 2019 · 18 comments · Fixed by #7273
Assignees
Milestone

Comments

@Auge103
Copy link

Auge103 commented Feb 12, 2019

Arma 3 Version: stable 1.88.145302
CBA Version: stable 3.9.1
ACE3 Version: stable 3.12.5

Mods:
see list in attached .rpt

Description:

  • When attaching a ACE PIP scope/optic to a weapon, using it causes the framerate to drop from >60 to <10fps for me.
    I've checked this with a profiler, the z\ace\addons\optics\functions\fnc_onDrawScope2D.sqf.19 is using up to 60ms of frametime when one of those scopes is attached:
    Picture
  • Strange enough, when pressing ESC (multiplayer - not paused), the framerate goes back to normal while it is still rendering the same scene as before. This also happens when having a scope attached in the ace arsenal loadout screen.
  • This happens everywhere, but has more impact the larger the map / the richer the environment is.
    The ace arsenal showroom increases the frametimes slightly, but using one of the scopes on Altis for example drops the framerate below 20.

Steps to reproduce:

  1. Load empty Altis in Eden editor. (optional: have a script profiler running)
  2. Place any unit with a rifle.
  3. Edit its loadout in ACE Arsenal
  4. Place a ace_optic_arco_pip on the rifle and apply
  5. Start the scenario. Watch the framerate drop.
    (optional: script profiler will show the drawscope2D function using most of the frametime)

Where did the issue occur?

  • Everywhere, doesn't matter if editor/SP/MP. Mostly visible in object rich environments on large maps

Additional information:

  • affected scopes: Everything ACE PIP

RPT log file:
https://pastebin.com/jMwbqsfC
ACE debug paste:
https://pastebin.com/eArS011c

@Auge103 Auge103 changed the title fnc_onDrawScope2D using more than 50ms frametime > using any ACE optic drops the framerate to <10fps fnc_onDrawScope2D using more than 50ms frametime > using any ACE PIP optic drops the framerate to <10fps Feb 12, 2019
@dedmen
Copy link
Contributor

dedmen commented Feb 12, 2019

https://i.imgur.com/It6JbFr.jpg

To embed images
![](<link>)
Also your link is wrong when you click on it

https://github.com/acemod/ACE3/blob/master/addons/optics/functions/fnc_onDrawScope2D.sqf#L30 This is problematic, should only be called on first frame though.

https://github.com/acemod/ACE3/blob/master/addons/optics/functions/fnc_onDrawScope2D.sqf#L82
That might be expensive? Though it doesn't show up on the profiler (assuming the profiler is not bugging out..)
Doesn't matter perf wise, and doesn't show up in profiler because it exits early. Read TLDR below.

https://github.com/acemod/ACE3/blob/master/addons/optics/functions/fnc_onDrawScope2D.sqf#L98-L103
This does seem bad. It's a PFH. If the control is already shown we shouldn't re-show it. Though I don't know the perf impact of that.
Would need instruction level prof. I'll do that gimme a min.

@dedmen
Copy link
Contributor

dedmen commented Feb 12, 2019

TLDR at bottom.

When attaching a ACE PIP scope/optic to a weapon, using it causes the framerate to drop from >60 to <10fps for me.

Can't reproduce. Not looking through scope 200us, looking through scope 400us.
Does the problem take some time to appear?

This happens everywhere, but has more impact the larger the map / the richer the environment is.

Speaks for ambient brightness script. actually really weird that it's missing in your capture....
Maybe something is deleting the GVAR(camera)
Can you make a capture with -profilerEnableInstruction Arma start parameter, and attach the capture here in a zip file? doesn't have to be long, all that matters is that the function is on there.

I stay on smooth 60fps while looking through a pip scope ace_optic_arco_pip
I assume the camera is nullobj, instruction profiling will confirm it if it's the case.

Can't see any mod in your RPT that might cause that. Well unless bwmod.... @commy2 you got any idea? Same kind of allMissionObjects "camera" that BW was doing.

TLDR; nvm all that I wrote.
https://github.com/acemod/ACE3/blob/master/addons/optics/functions/fnc_onDrawScope2D.sqf#L31
It loops here, into the exitWith. Same bug as BWMod had.
The _x != GVAR(camera) check doesn't make any sense if camera is null. Also findIf.
Didn't we get a new feature camera thing in CBA?

@Auge103
Copy link
Author

Auge103 commented Feb 12, 2019

tracytrace.zip
Here's a full capture
//Edit: regarding your question, the problem appears instantly when starting the scenario or when attaching such an optic in the field

@dedmen
Copy link
Contributor

dedmen commented Feb 12, 2019

Did you test in editor preview?
Can you test if it still happens without BWMod? I assume that's the cause. Are you running the latest version of BWMod?

@commy2
Copy link
Contributor

commy2 commented Feb 12, 2019

Strange enough, when pressing ESC (multiplayer - not paused), the framerate goes back to normal while it is still rendering the same scene as before. This also happens when having a scope attached in the ace arsenal loadout screen.

This draw handler is not executed when the esc menu is opened, because the focus is no longer on the mission display, where the draw handler is (indirectly) attached to.

@Auge103
Copy link
Author

Auge103 commented Feb 12, 2019

@dedmen Yes, editor preview.
And you are right, its working again with disabled BWMod. (it is the latest version from Steam, as are all loaded mods)

@dedmen
Copy link
Contributor

dedmen commented Feb 13, 2019

Up to commy then. Dunno what he did inside bwmod.

@commy2
Copy link
Contributor

commy2 commented Feb 13, 2019

@Auge103 You can try disabling the PIP Optics in the settings of BWA3.

@Auge103
Copy link
Author

Auge103 commented Feb 14, 2019

@commy2 I set BWA3_usePipOptics to false, didn't change anything regarding the ACE optics.

@commy2
Copy link
Contributor

commy2 commented Feb 14, 2019

Don't set the variable to false. Change the setting in the menu and maybe restart the mission.

@madpat3
Copy link
Contributor

madpat3 commented Feb 26, 2019

i have this issue, too. but only in the "liberation mission" and only with ace-pip scopes.KillahPotatoes/KP-Liberation#570 (comment)

@dedmen
Copy link
Contributor

dedmen commented Feb 27, 2019

@madpat3 only on liberation? Are you running BWMod? If not then that is the same cause as how I found the same bug in BWMod.

@madpat3
Copy link
Contributor

madpat3 commented Feb 27, 2019

  • yes only on liberation (sprint 10 version).
  • i was running bwmod+ace AND in a second try with ace-only.
    issue ocurred with ace-pip optics only, never with bw-pip optics.

@stale
Copy link

stale bot commented Aug 26, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status/stale label Aug 26, 2019
@commy2 commy2 self-assigned this Aug 26, 2019
@dedmen
Copy link
Contributor

dedmen commented Aug 30, 2019

We now use CBA optics right so should probably be fixed now?

@commy2
Copy link
Contributor

commy2 commented Aug 30, 2019

We don't use CBA optics in master and there is no branch for it. However, if I find time to spare I will implement that.

@stale
Copy link

stale bot commented Feb 27, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status/stale label Feb 27, 2020
@commy2 commy2 added this to the 3.14.0 milestone Feb 28, 2020
@acemod acemod deleted a comment from owmasch Jun 13, 2020
@PabstMirror PabstMirror modified the milestones: 3.15.1, Ongoing May 24, 2022
@Mike-MF
Copy link
Member

Mike-MF commented Sep 19, 2023

Closing due to age, inactivity or already solved. May be re-opened if the issue is still present, even better just open a new up-to-date Issue.

@Mike-MF Mike-MF closed this as not planned Won't fix, can't repro, duplicate, stale Sep 19, 2023
@johnb432 johnb432 modified the milestones: Ongoing, 3.18.0 Jul 26, 2024
@johnb432 johnb432 linked a pull request Jul 26, 2024 that will close this issue
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 a pull request may close this issue.

7 participants