-
-
Notifications
You must be signed in to change notification settings - Fork 491
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
Wind and swimming updates #2793
base: master
Are you sure you want to change the base?
Conversation
Previously players were slowed down when moving in the same direction as wind when its velocity was particularly low. `add_wind_velocity` was ported from `Badguy` to the `Player` class to fix this.
* Darts, kamikaze snowballs and owls stop moving vertically after exiting wind * Zeeklings abort a dive if they are stopped by strong enough wind. For Flying Snowballs: * Velocity is now calculated based on the previous target height to avoid snapping when pushed away from their start position * They can be pushed upwards or downwards * When pushed sideways, damping keeps them from floating away forever
A issue that does still persist is that when the wind is set to values (I believe) below Tux max. walk/run speed, Tux will not be moved by the wind when standing still, stuck in his run animation. Also, I feel that wind should always affect things when they are in their zone. Right now if you don't jump it will not affect you at all, even though you are clearly inside the wind zone. wind.mp4 |
- "Current" variant of wind that blows bubbles and does not affect Dive Mines. - Players now have an `m_wind_velocity` variable that is applied only after calculating other player physics. This fixes several unwanted behaviors related to Tux and wind.
I have made several changes to the wind physics process that seem to have fixed these behaviors. I've also added a prototype "current" that does not affect dive mines. I would like some clarification about what you mean in #2592:
By this, do you mean faster acceleration/deceleration? |
So the thought behind the current was that (since it is underwater) it can be used to suck/push Tux into an area. However, Tux should be able to swim against the current if it is not too strong. Now that should probably apply to both the current and wind. Main difference is that the current type would have different particles (i.e. bubbles) to better fit the aquatic theme. |
Somethig I noticed with the "Current". It is very hard to fight it. Especially with an acceleration of 100. You would expect setting the speed of wind lower than Tux's swim/boost speed, he'd still be able to slowly go against the current. However, I seemingly get force-halted by the current even thought techincally Tux should still be able to swim through (obviously slower). It lets me swim for a short moment before halting all my progress, even when oosting which is moves very fast! Even with an acceleration of 10. current_wip_issue.mp4Also, make sure to have the "Current" particles fade out rather than suddenly disappearing in an instant. |
I would not be suprised if something similar applies to the normal wind as well |
I'm admittedly a bit stuck on this issue. While the normal wind seems to be working correctly, it seems that in water, the acceleration from current is still vastly overpowering that from swimming. Unfortunately I'm not really sure how to fix that without also altering how swimming works- any ideas would be appreciated. |
Altering swimming in what way? Swimming is still a fairly "unpolished" mechanic so alterations are still legitimate as long as they improve it. So depending on how would have to alter it, you might be able to go through with it. |
Swimming now works on velocity rather than acceleration, which previously caused odd behavior with regard to swimming through wind. Further tweaking may be needed but should hopefully be easier to do.
Alright, I've tried tweaking swimming to actually work with wind. Let me know what you think. Boosting in particular seems to sometimes create large radii on turns which might need to be fixed. Also, how can I make the water bubbles fade out? |
Found a couple bugs:
inconsistent_wind_push.mp4
swim_bug.mp4
wind_current_jitter.mp4It also seems that the wind affect Tux statically, i.e. instead of his speed accelerating or decelerating "smoothly" it changes instantly. Atleast that's how it felt to me. It should ease into the new faster/slower speed to make the transition more smooth. This seems to apply to both wind and current, if that is truly what is happening, maybe I'm mistaken here. |
I can confirm the first and third bugs but I'm not able to recreate the second one. Can you upload the setup that is shown in the video? Another bug: Pressing the down arrow rapidly while moving into fast wind somehow allows you to go through easier. This is caused by some stuff around line 1586 of |
This is the level I tested and discovered that bug: |
The `apply_friction` function previously caused tux to swim constantly to one direction due to it adding acceleration under the assumption that tux was walking. Swimming-specific friction logic has also been moved to the function.
Wind now has a configurable variable that allows for feathering of the strength of wind. This is intended to make the transition into wind smoother. Fixed a logic error where all enemies would only be affected by current, not normal wind.
More bugs I found:
|
I also noticed that when you swim in the Current and you move in the direction it goes, you kinda seem to break the speed at which it is pushing you, like you get a bit slower than when you just get pushed without moving yourself. This might also apply to normal wind. Not sure on that. I usually notice it best while swimming. |
Okay I keep finding many more bugs - sry 'bout that :D So apparently, Dive Mine is still affected by currents but also when they leave the current/wind area they keep on going, never stopping. Also getting pushed underwater is still somewhat jittery. Feathering help a little bit but overall needs a much higher value than normal wind to be smoothed out fully, for the most part. Speaking of feathering, so idk if I fully get what it does specifically but the best values I've seen with it seems to be around 350? Can shed some more light on what it does exactly because with default value of 16 it looks horribly jittery |
Previously, acceleration was calculated completely incorrectly which resulted in excessively high accelerations within wind areas. Dive mines also no longer are pushed by wind.
Don't worry; that's what open-source is all about. I haven't done a particularly good job testing each change, to be honest. Also, the way feathering works is that it calculates how far the center of your hitbox is from the edge of the wind area (in pixels), then divides it by the feathering distance and clamps it between 0 and 1. It wasn't introduced to fix the jittering (that is caused by friction) but rather the fact that tux would keep "bouncing" off the edge of strong wind instead of pushing up against it like you might expect. My main problem with how it works right now is that if you put wind in a tunnel, like in the test level you showed previously, the top and bottom edges of the wind will have feathering, even though this makes no sense inside a tunnel. Also, I found out that I was calculating
I will keep attacking these issues and hopefully we can get this to work soon! |
Any further progress on this? Just checking :) |
Not really as I have again been busy with other things. It seems like the cause of the weird jittering bug is that wind only collides with tux every few game ticks and adds velocity, in between which, friction causes tux to suddenly slow down. That is what I have been stuck on currently. |
* `CollisionObject` now keeps track of colliding wind areas each frame * Wind now interpolates its applied velocity 50:50 each frame to prevent Tux from jittering * Tux will not skid constantly in wind * Tux has higher turning acceleration in wind to give him a bit more control
Alright I think I got the jittering issue fixed finally... Sorry that took awhile. Let me know what you think and of any bugs you find. |
* Wind acceleration is now integrated with `dt_sec` * Wind acceleration to the player is now smoother and is more consistent with established accelerations such as gravity. * Snappier movement when swimming in current at the cost of some physical consistency * Friction modified slightly * Tux can skid in wind again but will not make the noise because it was annoying. * Most badguys now should be pushed around by wind like expected.
* All badguys for which it makes sense can interact and be pushed by wind * Wind interaction logic put in seperate functions * Fixed many member variable names in `src/object/rock.hpp` to conform to the style guide
I've been procrastinating on this a lot but I have finally gotten around to letting the vast majority of badguys interact with wind. I have not done this for ice crushers and ghouls because I'm not sure if that is desired. |
Sounds fine. Ghoul is a ghost so makes sense they are not affected really and Crushers don't really need it. At best have them fall slower wind etc but its not too essential.
Totally fine. Levelshave been fully remade from scratch for the next update thus will take this changes into account. I will do further and more proper testing as soon as possible! Thank you for all this effort btw. :) |
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.
- While I do like the swimming changes, please clarify them more verbosely next time (such as in the title or description of PR) because this changes Tux's swimming in a pretty big way.
- The wind/current seems to not really work. Okay, well, to be exact, it barely works. I literally have to set the acceleration to 100,000 in order for it to replicate what a previous value of 100 would do. I understand why it was made this way but it breaks a bunch of current levels, so it would be appreciated if something could be done to more closely align with the current design so that fewer levels break.
* Tux's acceleration is not as aggressive. * Tux will not plow through wind when swimming regardless of its power. * Tux experiences more friction when he is not pointing where he is going.
cd28c3e
to
32ac6d6
Compare
Swimming feels now quite heavy. Not the worst thing in the world, I definitely don't hate the idea. Anyway, back to wind: There still persists the issue that when getting pushed by wind and Tux standing on the ground he is getting pushed much weaker than when you are mid-air which feels rather off. I also agree with Daniel that the acceleration is quite weird as well. To get a descend upwards wind I had to set it to 2000, for example. Downward facing wind meanwhile doesn't seem to have any effect on you at all, even at 2000 acceleration. |
Wind was integrated into the `Physic` class, meaning it can be accessed in the same manner as object velocity and acceleration. Signed-off-by: biggeryetbetter <[email protected]>
56084a4
to
5d1bc5d
Compare
I've made a change that was suggested by @MatusGuy in Discord a month or so back which was to put wind logic with the
To be honest, I'm not really sure how to fix this. I would say just keep it as a sidenote for now.
I can understand this, however it aligns much better with how physical values like speed and acceleration are handled within the code. Nonetheless we do already multiply sector gravity by 100 in the |
Could you please resolve the merge conflicts on the PR so we can get builds for testing? |
Swimming has gotten rather worse here, or rather swim boosting. It is very sluggish now, you can't build up speed anymore properly for swim jumping. I like how it eases into faster speeds but the execution isn't so great. The max speed should be reached much faster but still ease into it, turning also needs to be made just a bit tighter. I'm also unable to push against currents of weaker strength when swim boosting even though technically Tux should be able to swim through. This might be linked to how slow you build up speed when boosting right now. |
Slightly higher acceleration for normal swimming and much higher acceleration for boost swimming. Turning is a bit more sharp.
Have you taken a look at the ground movement manager? It could possibly be related |
Swimming feels much better again. Still the issue of being unable to swim against a weaker currents is present but the rest seems great 👍 |
Hold up, is Tux swim boost faster? I'm testing out some levels and he zoomin'. Maybe a bit too fast. It's like he keeps gaining speed underwater. I keep ramming into stuff :D |
I haven't tested this PR, nor do i like it's description, because I have a question regarding the swim updates. Is it directional? Meaning, does the turn still happen instantly or is there a bit of slowdown now when turning in the water? I think an issue i've noticed with the old swimming is that turning is too easy, it's much like the frog suit in the mario games. I always wished there was some turnaround 'lag', where the player's turning is clamped to where they want to go (up, down, left, right). This creates an immersion of realistic swimming and also makes swimming feel more challenging (not just flying in midair sort-of) Not to mention, I would really like if swimming wasn't as fast as it is now. |
With this PR turning has gotten a bit looser now, though Tux is rather fast which causes some issues. Especially while boosting.
I wouldn't be against fine tuning a couple values here (as long as swim boosting remains on the faster side for swim jumping mostly) though not sure if required for this PR specically as the main focus is wind. |
Can you show a video of you turning? |
Here you go: 2024-10-30.19-52-14.mp4 |
One thing i wish would be added back to this pr's swimming is the ability to jump out of the water with a lot of speed after dropping into the water with a lot of speed. as.mp4it let to a lot of cool and fun speed-running opportunities. currently when you drop into water from a high place you just loose all your momentum. I dont feel like something like this is required for this PR, but it would be really nice if this got added to this Pr, because it would be a shame to see this go. |
This PR includes an overhaul of wind and swimming physics.
Included changes:
Physic
class for convenience.Most levels should be unaffected by these changes, however levels that rely on certain swimming quirks may break.