05/28/24, 01:41 PM | #1 | |
Join Date: Mar 2022
Posts: 3
|
Updating multiple controls (textures) at once
Hello developers! I wonder if it possible to "Set3DRenderSpace(Forward/Right/Up)" for a, lets say, all child textures with one command or with some workaround? A little bit of context: I have parent control
Lua Code:
and bunch of child controls Lua Code:
My first assumption was to change parent 3D render space, but it doesn`t help, so I believe, properties of children do not inherited from parents. I have to iterate through all child controls and set one by one. I want to set 3D render space to make all "markers" be parallel to camera's RightUp plane and rotate with camera. I update it every frame. The problem is I want to create really massive amount of "markers" and after I reach 1000 ones I have some FPS decrease (not noticeable by eye, but FPS meter says so). After I profiled it, without any surprise, I have discovered what the most expensive operation - "Set3DRenderSpace(Forward/Right/Up)" ~1.5ms peak and ~1ms in average, so I do need somehow decrease it to keep FPS stable. It is more research question, how far can I push limits of ESO API, but I also have some thoughts about addon where I can apply this. Please let me know if there is any elegant way to solve this problem Also I would like to notice, that entire execution of my update function takes 2.415ms in average according to profiler, so it is not such an heavy operation to my mind and ESO is capable to execute it every frame. Strange thing (for me) is that most of time on a timeline view is empty: 2.4ms my function, 0.6ms other functions, 4.5ms of empty space between frames, so FPS is 1000/7.5 ~ 133 which is perfectly corresponds to what I see. So why they are there? Is there a way to decrease them? P.S. I know about OSI, and it performs worse (144 -> 80-90 FPS drop vs 144 -> 120-130 with my addon), mostly because I believe it was not architectured to handle so much icons and moreover I optimized my addon as much as I can at this point (I was starting from huge FPS drop, but then optimized step by step researching profile). |
|
05/29/24, 02:50 AM | #2 |
Edit:
As Sirinsidiator mentioned below you should switch to use ZO_ObjectPool (control pool): https://wiki.esoui.com/How_to_use_ZO_ObjectPool As far as I know only SetHidden on a parent will change the relating child controls automatically. All other attributes need to be set manually (maybe there are others, like SetMouseEnabled and such, but no "visual" ones I know off). So looping the childs will be one thing to do it. Another would be to add all controls to a sub-table, key = child's index and value = childControl. Main table would hold the parent controls then. Loop the tables then and apply your needed methods/functions/attributes. Lua Code:
But that's bascially the same as the control's already do now, so maybe only extra loss of performance. You'd have to profile that again I guess if looping pre-filled tables with only the control as value you need is more performant than using something like this Lua Code:
Btw: Please keep in mind that addons must not draw 3d markers in dungeons! https://www.esoui.com/forums/showthread.php?t=9865 ZOs explicitly did not want their API to do that and they once said it is nothing they officially support, nor like. So it's a gray zone again, but we fear loosing API or get others restricted the more addons will be created which draw 3d markers inside dungeons! So please: Don't or at least get the official OK from ZOs DanBatson and/or ZOsSethl here: https://app.gitter.im/#/room/#esoui_esoui:gitter.im Last edited by Baertram : 05/29/24 at 04:44 AM. |
|
05/29/24, 04:18 AM | #3 | ||
At 60 fps one single frame can at most take 16.6ms. The majority of that time is taken up by the game for things like graphics, physics and other calculations. So addons have somewhere around 5ms (guestimated) they can use without making the framerate drop. Meaning your addon is taking up almost 50% of the available time budget for addons at 60 fps and (apparently) more than 100% at 144 fps. |
|||
05/30/24, 01:03 AM | #4 | |||
Join Date: Mar 2022
Posts: 3
|
It is just because of my curiosity. Btw, I had not enough time to properly dive into ObjectPool, from the first glance it is not proper instrument I need, but neither I heard about it before, so maybe searching around it will succeeded. |
|||
05/30/24, 01:20 AM | #5 | ||
Join Date: Mar 2022
Posts: 3
|
No, I'm using separate table to keep all created markers and add new on demand, don't delete so far, by I will need to delete them, so 'Pool' will be very handy for it if I get its description right. As I mentioned above, had not enough time to study it properly -_-
SO I am limited only by ~1ms ATM based on my experience (and if we take into consideration other addons - even less than 1ms), I need to do some sneaky business to optimize this. Last edited by imPDA : 05/30/24 at 01:24 AM. |
||
05/30/24, 09:23 AM | #6 | ||
Changed the description.
They did not like to add those themselves and they explicitly disabled 3d controls inside dungeons -> Which should be indicator enough what they dislike... Basically all those addons providing hacks for dungeons, to help with positioning etc. by showing textures are just tolerated atm by ZOs, afai understand it. For now ... To be fair some dungeons are really ahrd to play because of all the effects and even buggy fights, and addons helping thre "must be tolerated for now, imo". But not all are. As I said, seems to be a gray zone. Last edited by Baertram : 05/30/24 at 09:27 AM. |
|||
ESOUI » Developer Discussions » Lua/XML Help » Updating multiple controls (textures) at once |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|