Skip to content
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

Fix Monster Look Direction Behavior #4785

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

NRH-AA
Copy link
Contributor

@NRH-AA NRH-AA commented Sep 15, 2024

Pull Request Prelude

Changes Proposed

Allow monsters to update their look direction even if they cannot attack.
Stop fleeing monsters from updating their look direction.

As of now monsters will not update their look direction if they cannot attack (rl they do)
As of now fleeing monsters will look at the player randomly (rl they do not)

I can't figure out how to record rl so if someone can tell me, otherwise I can't get a video of it.

Issues addressed:
closes #4339

@NRH-AA NRH-AA changed the title Initial Commit Fix Monster Look Direction Behavior Sep 15, 2024
@ranisalt
Copy link
Member

ranisalt commented Sep 15, 2024

Screencast from RL, fleeing sheep will always look in the direction it's fleeing, never looks back at player:

Screencast.from.2024-09-16.01-34-01.webm

However, if the creature is fleeing AND decides to attack player (i.e. Dragon running in low health) with a directioned attack (a wave), it will direct the attack towards the player. It turns to the player for a split second only to wave, and then will continue fleeing.

@EPuncker
Copy link
Contributor

Screencast from RL, fleeing sheep will always look in the direction it's fleeing, never looks back at player:

Screencast.from.2024-09-16.01-34-01.webm
However, if the creature is fleeing AND decides to attack player (i.e. Dragon running in low health) with a directioned attack (a wave), it will direct the attack towards the player. It turns to the player for a split second only to wave, and then will continue fleeing.

perhaps we should make it work only with creatures that have aggressive flag?

@NRH-AA
Copy link
Contributor Author

NRH-AA commented Sep 16, 2024

I have an idea to get it working. Working on it now. It seems rl probably has monsters check if they can attack once they finish their walk. @ranisalt do you know if it is possible for monster on rl to cast without updating their look direction sometimes?

@NRH-AA
Copy link
Contributor Author

NRH-AA commented Sep 16, 2024

@NRH-AA
Copy link
Contributor Author

NRH-AA commented Sep 16, 2024

So after checking RL. The monsters look like they are having spasms with how fast they turn.... I guess I need to make my code look even more messed up lol.

@NRH-AA
Copy link
Contributor Author

NRH-AA commented Sep 16, 2024

Alright I think this looks even better than rl.

https://youtu.be/TLm8ExV40Hg

Ranged monster also behave the same way as fleeing as shown in the video.

@NRH-AA
Copy link
Contributor Author

NRH-AA commented Sep 16, 2024

Alright, LGTM

updateLookDirection();
lookUpdated = true;
lastStep = OTSYS_TIME() - 200;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This made the sheep extremely slow 🐢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong direction of monster with hasFollowPath
4 participants