Opened 10 years ago
Last modified 9 years ago
#2913 closed task
[PATCH] Better way to handle visibilities in the simulation — at Version 14
Reported by: | Itms | Owned by: | Itms |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 18 |
Component: | Core engine | Keywords: | |
Cc: | Patch: |
Description (last modified by )
My work on #599 allowed me to work on the visibility systems (fog-of-war, line of sight, etc.), and currently, a large part of the visibility logic is handled by the RangeManager system component, especially in this function.
As a consequence, scripted components can't influence the visibility of an entity. Mods, but also planned features for the main game (like Iberian camouflaged units), would need a way to influence this visibility. Also, the way I plan to tackle #2710 needs it.
I propose to separate this logic into a Visibility component. Several things could benefit from this change.
I think it would be better to do changes in separate patches/commits, to avoid complexity and possible regressions. So I set this ticket as a task, and I will use it to track the changes. Remaining planned changes:
Create the Visibility component- Find a way to remove the hardcoded and duplicated VIS_FOO in the scripted components Fogging, Mirage and Visibility
Move template items GetRetainInFog and AlwaysVisible from Vision to VisibilityUpdate component documentations (RangeManager, Visibility), including code comments- Fix #2710 with the new system
Improve #958 with the new system if possible (see this TODO)- For fun, implement camouflaging for some units
Change History (16)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
Description: | modified (diff) |
---|
comment:5 by , 9 years ago
Keywords: | review patch added |
---|
Here is a patch to use the cached visibility (introduced for mirages) for any entity. This would reduce the number of computations of the visibility, which is currently huge, but no profiling was done yet. I will come up with some data but I post the patch for review in the meantime.
by , 9 years ago
Attachment: | use_cached_visibility.patch added |
---|
comment:7 by , 9 years ago
Here is a patch moving back the computation of visibilities to C++. Now, the scripted component is called only if necessary.
As a use case of the scripted part, I fixed the TODO remaining from #958.
However, a style improvement would be handling properly the empty properties of scripted components in templates. For instance, currently Decay has an <Inactive/>
component, well handled in C++, but I was forced to write <Preview>true</Preview>
in my case to make the code work. This must be fixed before committing.
comment:8 by , 9 years ago
Keywords: | review patch added |
---|---|
Summary: | Better way to handle visibilities in the simulation → [PATCH] Better way to handle visibilities in the simulation |
by , 9 years ago
Attachment: | visibility-performance+958.patch added |
---|
comment:12 by , 9 years ago
Cc: | added |
---|
Hi Ben, could you take a look at the latest patch, which works around a code you wrote? I'd like to commit it asap, probably tomorrow. Thanks in advance :)
comment:14 by , 9 years ago
Description: | modified (diff) |
---|
Attached patch reduces drastically the number of mirages by making fogging conditional: entities will be miraged only if their health/resource amount is reduced, or if they have a non-gaia owner.
It also cleans out the code in some parts, and fixes the invisible animals problem and the missing status bars for mirages.
I'll commit it on Friday evening, so please give feedback :)
In 15925: