-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIRROR] Makes AI tracking more snappy, improves API (AI movement cha…
…nge) (#962) * Makes AI tracking more snappy, improves API (AI movement change) (#81401) ## About The Pull Request Ok so tracking (from the datum) worked, but when used to follow someone it had a noticable delay from the datum needing to wait for process to fire to do its work This would be an expensive proc to run constantly, but we don't really have to (there are not that many ai eyes in the world). So rather then only processing to keep step, let's track the target mob by its movement, and then fall back on a process loop to handle rechecking in case of camera memes. This does technically mean you won't "break" the track if the cameras go out until the tracked mob moves, but I think that's a reasonable price to pay for more responsive movement. I think I could make our current system work with it too, though it would be a bit more wasteful. John if you have opinions just lay into me. I've also renamed/pulled apart the helper procs for the trackable datum, with the hope of making how they are used more understandable at a glance Oh and rather then holding a weakref since I needed MOVED anyway I just use QDELETING to free the ref if the mob goes away ### Edit: #### Glide size touchups Implements glide size mirroring so we move at the same speed as our target Also moves the existing signal to send to the trackable datum itself, as appears intended from the doc comment #### AI behavior changes Rewrites ai movement to be less dumb OK so 2 things here. One is a behavior change, the other is a visual QOL thing. The way ai movement works is we move graduated "steps". Either moving 1, 2, or 3 steps per tick. We do this by, so long as input is held down, incrementing a number called "sprint" Currently it'll go from 10 to 50 (formula effectively looks like steps = (sprint / 20) + 1)) Anyway, this is... not fine but ok, but the way we handle deceleration is ass IMO. It's literally just wait 0.5 seconds and sprint resets. I think this feels crummy, so instead I've made it decay depending on how long you go between inputs, at 7x greater rate then it increases. That's the behavior change. Visual change is a lot easier. Ais were not gliding properly. They assumed they had 4 ticks to move a tile, rather then 1. This meant they'd jump around constantly, to catch up to where we expect them to be. I've fixed this by giving them 1 tick instead. Should feel a lot better ## Why It's Good For The Game Snappier response times, cleaner code ## Changelog :cl: add: AI's acceleration now smoothly decays, instead of just falling back down to 0 after 0.5 seconds fix: AI's standard movement (non accelerated) is smooth now, instead of constantly jumping around fix: AIs will now follow their targets more closely, shouldn't have any issues with them lagging behind anymore /:cl: * Makes AI tracking more snappy, improves API (AI movement change) --------- Co-authored-by: LemonInTheDark <[email protected]>
- Loading branch information
1 parent
fcba208
commit d90cbb2
Showing
8 changed files
with
184 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
///Signal sent when a /datum/trackable found a target: (datum/trackable/source, mob/living/target) | ||
///Signal sent when a /datum/trackable found a target: (mob/living/target) | ||
#define COMSIG_TRACKABLE_TRACKING_TARGET "comsig_trackable_tracking_target" | ||
///Signal sent when the mob a /datum/trackable is actively following changes glide size: mob/living/target, new_glide_size) | ||
#define COMSIG_TRACKABLE_GLIDE_CHANGED "comsig_trackable_glide_changed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.