-
Notifications
You must be signed in to change notification settings - Fork 637
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
NPCs change yaw more slowly when game is running at higher FPS #2458
Comments
This might affect speedrunners but the big upside is the ability to play the game at a proper framerate without ruining the experience. It would also make the experience the same for everyone. |
Speedrunners aren't using Steam Version for speedrunning. They're either using old version or Steam ported WON version of the game |
And this fix will be much appricated! |
Note that not all NPCs use this method to change yaw since it's virtual, and pitch may need to be changed as well. A more general solution would be to track the last think time and then use a method that gets the delta time. Then all code that needs to use it can just call that. In addition not all NPCs use the same AI think method so those NPCs will need to update the last think time variable on their own. |
Quoting some complaints that have been raised about fixing this:
Maybe make this an option controlled by cvar so the old behavior can be restored if people want it. |
This shouldn't be an complaint at all. This issue is really frustrating. Because of this people can't play Half-Life in higher fresh rates. This issue needs to be sorted. Like i said this won't effect pros or speedrunning community. |
If anything, just slow the turn rate a bit. At most they feel a bit too fast in the video. It's perfect with that small adjustment. |
Not just NPCs.. It seems we have other issues with high fps levels like jumping slowdown and surfing becoming impossible: |
What the hell? Who wants to play like that? YES, IT'S A BUG and the person who write that complaint it's a bit crazy. Really a bug: https://youtu.be/4yTzozi7Wrs?t=22
Well, yes. I'm agree with that. |
The person who wrote that wasn't aware of how severe the issue is, he agrees that it should be fixed. In order for yaw speed to work correctly we need to figure out which FPS the game was meant to be running at when it was released, when people would be experiencing it as the developers made it work. I've been told that |
Thanks @SamVanheer, I'll have this in the next beta update. In lieu of adding this field to the save/restore data and likely breaking older saved games (and breaking newer saved games with older client versions) I'm just going to default the initial yaw delta to the frame time. I don't think it will be terribly noticeable if just that one frame is slightly off in speed but let me know if anything doesn't look right. |
Thanks, i'll try to get as many people together to test this as i can and report back what they find.
That's not really relevant to this situation since this issue is preventing people from playing the game as intended. If a glitch were found that inserts changelevel commands with arbitrary maps names determined by moving in a particular way, speedrunners would exploit it to get extremely low run times, but it would still be fixed on account of being a bug. |
Looks to be indeed fixed. https://youtu.be/bcziOHhAfQo |
I would suggest lowering the value of the number after the delta from 10 to 2 or 2.5. |
@SamVanheer The speed seems to be fast apparently. Perhaps it can be tuned a bit to not break? Linked his videos here: https://files.facepunch.com/forum/upload/109778/578e8b09-9dc7-44d1-b975-2239bffcec6f/hl1_turnspeed.webm <- How they are doing it now. As seen, it is too fast. I just want to say I very much appreciate that this fps problem is being looked into and I think just some adjustments is needed and it will be perfect. |
Yes they're insanely fast. Reducing their speed a little bit and voila! And what's more about this fix is it's only applied to Half-Life. Other mods still suffering this issue. Is it possible to apply this fix to the engine itself? |
No. |
I see. I believe Goldsrc cannot overwrite monster.cpp in other mods .dll's and apply this fix for every mod. Such a shame really. |
Fix NPCs change yaw more slowly when game is running at higher FPS by SamVanheer
@SamVanheer Any comments on the notes from @Magic-Nipples and @DrCola? I presume you've probably tested a fair amount with the current scaling factor, so I'm inclined to go with that for now since turning a bit too quickly is better than turning slowly but I can run a few more changes through beta before releasing this if there's consensus that it should be tuned more. |
Yeah it should be slowed down more to match the original. Do you need me to figure out a good setting? |
That would definitely be helpful. I'll check 2/2.5 to see how that looks but if you find a better setting let me know and I'll switch over to it. |
I'll make a test mod with a cvar to try out various settings and let some people play with it to see what the general consensus is. |
@mikela-valve @SamVanheer do you know if Half Life was designed with 30 or 60 fps in mind? I figure you can try adjusting the value until it's closer to the way NPCs turn at 30/60fps rate. |
@DrCola Just try to have the turn speed as similar as possible to this: https://www.youtube.com/watch?v=a0vPeVWdLcw |
The |
I played around with a number of scaling factors yesterday and ended up thinking that multiplying by 2 felt the closest to the WON build. Part of the problem of matching it exactly is that it looks like either handling of animations or just turning altogether is a bit different and that results in the scientist not turning smoothly, so I tried to match the average speed of the original turn. @SamVanheer Let me know if you find anything different in your testing. |
I've updated the coefficient to 2 in the latest beta. Let me know if it still seems too far off from the WON build. |
@mikela-valve I tested, it is very close to the WON version now. I think it can be closed. Though maybe we need @SamVanheer to test it too. Also, I assume you will be shipping the beta to the public build after this issue and #2581 gets closed? Really appreciate the work you did on the GoldSrc games, and I think the community does too. Wish we had a Valve dev working on the Source games like you do on the GoldSrc games. |
Great, thanks @agrastiOs! I do plan to update the public build soon, once I finish following up on a few more issues. Closing this one as fixed. |
I did some testing to see what multipliers different FPS values would have when converting from the frametime formula to the new framerate independent one. Using this code:
The value of
So a value of 2 is roughly 49.5 FPS. Beyond that i tried to compare it to videos from the early 2000's but i didn't find any that were useful. It seems there are no trailers showing the finished gameplay for Half-Life itself, and the Opposing Force and Blue Shift trailers are low resolution, make quick cuts and don't really show this exact behavior. That said the current speed seems to be good, and i haven't heard any complaints about the current beta. If more information is needed i can set up WON Half-Life on my old Windows XP machine and run it there. I'll check the average FPS value and see how that works out to a multiplier value. Given that the original FPS maximum was 72 according to reverse engineered WON code and the average machine capabilities of the era i think a multiplier of 2 should be a good compromise. |
This new member (m_flLastYawTime) breaks addons's plugins compatibility... for all the bunch of derived classes from "CBaseMonster". |
@StevenKal I don't know if i get it right. This fix broke few AMXX plugins? If so can you post few plugins became broken. |
This fix (more the way it is in fact, due to the addition of a new member in "CBaseMonster"), broke all the plugins dealing with members offsets. All the members of all the child/derived/sub classes from "CBaseMonster" are concerned. Like "CBasePlayer", "CBaseTurret", "CEnvExplosion", "CGrenade", all the monsters, etc., etc., etc. I'm surprised the "SamVanheer GoldSrc dictionnary" didn't think about that knowing he is frequently defending things that may be broken in engine/game behavior, from other people suggestions. I guess he forget the addons's plugins! I'm the developer of AMX, not AMXX one, so I don't care about how many "AMXX plugins" are broken, but that I can told you is that a lot of them dealing with CBasePlayer's members for such games are broken. |
AMX? Lol, i haven't heard that in a long time. I'm pretty sure you're saying this for Counter-Strike, but Counter-Strike will not receive this fix, infact Counter-Strike doesn't need this. It doesn't have any activity regarding to AI. Hostages are kinda exception because they just follow player. |
AMX & AMXX are addons that are basically some kind of API, by providing tools to coders, etc. |
@Arkshine does AMXX have problems with this change? I see AMXX already has a solution for this problem: https://www.amxmodx.org/api/fakemeta/get_ent_data_float So i think only legacy plugins should be affected by this. @StevenKal your AMX fork is compromised and has a backdoor that you use to issue server commands to servers running your build. You even admitted to it here: https://forums.alliedmods.net/showpost.php?p=2371325&postcount=14 Nobody should be using your version of AMX, so there is no reason to consider any problems with it. |
This doesn't concern AMXX since 1.8.3 at all. Gamedata API was introduced exactly because of this. If adding a new member to a class higher up in hierarchy is a good solution, then it should be done. |
I've just tested the beta. I think a coefficient of 1.6/1.7 would work better in my opinion @mikela-valve . The turning speed is a bit too fast at the moment. Testing is needed though. |
@sam: Boost your "addons knownledge", AMXX is a fork of AMX, not the reverse thing. It's amazing the number of ignorants I see about that, who just think AMX is born from AMXX, because you start with AMXX. Look like people has more "respect" to the forked things than the original things forgotten a little too much. You really need some correction regarding that info. About the breaking part: New member is recent, but you'll see when people will start having more frequent server crashes "due to HLDS updates", or claim their plugins "no longer work"... |
There is no point in keeping broken server behavior broken to keep compatibility with server plugins. One of these is very much easier to update and fix than the other. This was a one time opportunity to fix a glaring issue that would only get worse as computers advance in speed, and I'm glad it has gone though. |
@StevenKal backdoors are never acceptable to have, and yours gives you unrestricted access to the server, and even has commands to query and change the RCON password. Until you update your AMXMod fork to have no backdoor access of any kind, i must assume you're acting in bad faith. Note that this also includes providing up-to-date source code, as required by the AMXMod license. The source code on your website omits the backdoor code which is in violation of the license. I have independently verified the contents of the AMXMod binaries on your website and i can confirm what the AMXModX team has reported, i am not taking their word for it. In response to your problems:
I've informed people not to use your AMXMod fork due to security issues and outdated/missing functionality, as well as best practices for beta usage and keeping servers updated: https://knockout.chat/thread/7/18#post-89649 And i've requested that the AMXModX API documentation be updated to discourage the use of the old pdata API: https://forums.alliedmods.net/showthread.php?p=2663943#post2663943 I know you'll take offense at my statements regarding your AMXMod fork but as i stated earlier in this post your continued use of a backdoor into servers forces me to assume you're acting in bad faith. You've been well aware of this problem for nearly 4 years now, so i suggest you remove the backdoor. But if you are insistent on continuing development of AMXMod it may be better to retire your fork and contribute to AMXModX instead, since it's the more popular and more active fork. That way we know we're all on the same page as far as features and compatibility goes. |
Stop writing "AMX Mod fork", that's fucking non-sense ("fork" term), I confirm, you're ignorant about what is AMX Mod compared to AMX Mod X, choose your terms with more precision next time. On the website where you spread your things, you write: You can still dream about seeing me working on AMXX, this is a bit that arkshine tried to do (with various methods sometimes, irrespectful & unscrupulous), but this will never happen. AMXX is just not "how an addon should be" for my opinion/conception (the same way the Angelscript you promoted is not), due to how it is and the politic behind, and a lot of things which are just horrible and make global poor content split everywhere, even if there are various good things, plugins, devoted people, bunch of coders, etc., the global content is just not how I want it for AMX, but I'll explain everything later. |
Hello @StevenKal, from my perspective, @SamVanheer is directing feedback at your project, not you personally, and you're questioning his character before responding to the feedback. Please keep in mind that insulting or demeaning anyone on this issue tracker is against the Code of Conduct, and if this discussion continues in that direction I'll need to step in as a moderator. |
Yeah but continue spreading such infos to the people while this has already been done and seen by a ton of people, is kind of abusing, and kind of irrespectful regarding this last fact, the other fact it's a free project, and the other fact it's a lot of hours of work behind. Short morality is: |
This comment has been minimized.
This comment has been minimized.
Regardless of intent, this issue report has derailed from the original issue, which has been resolved. |
When the game is running at a higher FPS NPC yaw speed is slower. This happens because yaw speed is multiplied by the engine's frametime, but the AI think logic only runs 10 times a second at most. As a result NPCs turn slower the higher the FPS is, and faster the lower it is.
To fix this the yaw change logic needs to track how much time has passed since the last yaw change time:
halflife/dlls/monsters.cpp
Lines 2529 to 2581 in c76dd53
This should be modified to work like this:
m_flLastYawTime
is afloat
member ofCBaseMonster
and should be save/restored as aFIELD_TIME
. This might break old save games however.I've recorded 2 videos showing the broken and fixed behavior:
Broken: https://youtu.be/4yTzozi7Wrs
Fixed: https://youtu.be/WMiVSmMo3MI
You can see the FPS in the upper left corner.
The text was updated successfully, but these errors were encountered: