-
Notifications
You must be signed in to change notification settings - Fork 229
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
Improve memory management of treads #4640
Conversation
Note that the system doesn't actually work properly: try moving 200 tanks at once and you'll see what I mean. There appears to he a maximum to the number of splats being rendered, and that maximum is relatively low in comparison to the number of splats generated. |
I think that's the same reason why building tarmacs etc. disappear sometimes when tilting the camera. The render limit kicks in. I guess they implemented it to not stress the hardware too much, but today it shouldn't be an issue anymore. Probably needs an engine patch to increase it though. Do I see this correctly that different tread textures per terrain type are possible? |
Yes, any effect for any terrain type can be changed, see https://github.com/FAForever/fa/blob/deploy/fafdevelop/lua/TerrainTypes.lua |
Tarmacs are decals, they work different. I'm not entirely sure what the exact difference is. |
Yes, but it didn't quite work like that. At the moment terrain would only disable treads (no need for treads on rocks or metal, for example). As a result the majority of generated maps have no treads. I'm wondering whether that is why generated maps always felt faster than regular maps. With this pull request we change that - treads always work, even when the terrain type tells you not to. |
generated maps have no tread marks because no terrain type is set. The fix for that should be to set an appropriate terrain type on generation, because there are more effects that also depend on the terrain type, not enforcing tread marks on all terrain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look like this will work. Adding back the missing function is trivial, but letting treads underwater, on snow, and on tarmacs looks very unnatural. Since threads are very lightweight, I'm interested in the performance gains. You might be able to get more by consolidating all treads for the unit into one thread, instead of one for each. The Fatboy treads also looks very noisy since it always overlaps both full treads, so I'm not sure that's better.
lua/defaultcomponents.lua
Outdated
SuspendCurrentThread() | ||
self.TreadSuspend = nil | ||
WaitTicks(interval) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This delays tread creation by one interval any time the unit moves again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Visually that is fine - during the first interval the unit barely moves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can notice it--it's logically an error, just remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adjusted it to waiting just a single tick
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you think you need it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having an infinite loop with no wait statement is asking for trouble.
@Hdt80bro I partially understand.
I agree with the water, but treads have always shown on tarmacs. See also: Testing on
I like the idea, but that would be something for a second iteration. This first iteration is already a good improvement memory wise on the current implementation. |
Ah, my bad, these are left over from vanilla |
Maybe on destruction of the building, when the tarmac is set for removal with a waiting time period. It's not perfect, as treads would show up as soon as the building is destroyed, but while the building is still alive it would work. |
d0a77bd
to
4c8aca6
Compare
@BlackYps it wasn't so much about when to change it, more about what to change it (back) to? |
I'll be merging these changes in as they are a good improvement over the old implementation, without changing the old behavior. |
An interesting one, every time a unit would:
A unit with treads would:
TreadThreads
table multiple timesAnd then something like this happens, that constantly triggers the transition events:
bumping.mp4
On top of that, this pull request decreases the time that a splat (a tread mark) exists by tech while increasing the LOD by tech. See also: