-
Notifications
You must be signed in to change notification settings - Fork 113
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
Smoother piece attachment visuals (and even physical locations?) #1898
Comments
Do you mean Spring.UnitAttach? Also, if you could provide some explanation about how to replicate that, would be great. Like, if it's something z-k does, what's the fastest way to do it (what units to /give for example). |
Give a hat to the enemy team |
This is going to be complicated to do right. Ideally we want to:
Now since Lua unit scripting is controlled solely by Lua and can generally be executed from many different callins, I just don't see how we can line it all up to match the flow above. What we perhaps can try to do is to run parts of @GoogleFrog send instructions how to reproduce Warrior + Storage attachment, BAR's hats bobbing is harder to track. |
Run this commit on this branch: ZeroK-RTS/Zero-K@0acf0bc Spawn cloakriot. Drag select to select it rather than the storage, then move it around.
Why would we need to run the unit scripts for transportees in their own step? It is highly uncommon for the position of a unit to impact how its script runs, especially when it is being transported rather than moving around by itself. I ask because unit attachment is recursive, and your three steps doesn't take that into account since all the transportees are being assigned a position regardless of their attachment-depth. My current guess is that running all scripts, then recursively updating all positions would work. I could see this going wrong with things like aiming though, I don't know quite how the ordering there works. |
Yeah the concerning parts would be aiming and any code that makes assumptions about the unit position (say precise legs placement) |
The PR above reverts back the interpolation method spring/spring#460 introduced and while it fixes the attached units bobbing, it reintroduces unit jittering caused by inconsistency of future position and speed vector. Such inconsistencies happen during abrupt / artificial changes of unit position. Most prominent case is unit-unit or unit-feature collision avoidance: these will teleport unit to avoid objects clipping into each other. So to avoid that spring/spring#460 introduced (X-1) --> (X) interpolation, while in fact drawing happens post sim frame (X). This causes any unit position to lag behind 1 sim frame the current synced position. In the same time piece positions are not interpolated and thus represent the state at frame (X), therefore you see inconsistency between the attached unit that is (X-1) sim frame based and catching up to frame (X) every draw frame between (X-1) and (X) and pieces position that are taken straight from frame X. This happens even if the transportee alignment happens after animation scripts (that was something I thought to be the root cause initially). Long story short it's not possible to fix currently in a clean way, but moving on (and it's planned):
I think all of this will be done during 2025 |
The units in that gif are carrying structures via Spring.AttachUnit. They visibly lag quite a distance behind the underlying pieces, as the arms of the units move left and right as they walk. It would be a great improvement for modular unit games, or things such as big ship with constructable hardpoints, if units were a bit better at updating their position to the underlying pieces. I'm aware that things like frame interpolation are likely to make the problem not entirely solvable, but perhaps there is something cheap to try that would still be a noticeable improvement.
The text was updated successfully, but these errors were encountered: