Snayff / nqp3

1 stars 2 forks source link

Improve actions targeting and actors flickering #43

Closed eh-jogos closed 1 year ago

eh-jogos commented 1 year ago

Here are videos from before:

https://github.com/Snayff/nqp3/assets/13070158/778a8c9d-8a22-4635-b910-88aaf5352b39

and after:

https://github.com/Snayff/nqp3/assets/13070158/8699febf-3a49-4b2f-8f58-4979e62ffe66

Some of the improvements:

Turns out what was making ALLY (Heal) and SELF targeting actions to target enemies wasn't anything on the actions logic itself, but on allowing a target to be defined without an action selected.

Sometimes an action would be decided with a proper target, but that target would become invalid and instead of returning the actor to idle, the code would just refresh the target with default values, which was always targeting enemies.

Now an target can never be searched unless it's in the context of an action and if a target becomes invalid, the actor goes back to idle and decides both action and target again.

The flickering was solved by tweaking NavigationAgent's values, and refactoring code to use godot's built in avoidance.

~### Important~ ~The code show here contains the changes from PR #41 as well. I think it's probably better to merge that one first, and then I can rebase this branch to it and this PR will be easier to analyze as it will contain only the relevant commits. I'm posting it as a Draft for now until we can sort that out, unless you prefer to do it in a different way.~

eh-jogos commented 1 year ago

PR rebased to and updated!