Impose triangular position restriction on enemies

Discuss coding questions, pull requests, and implementation details.
Post Reply
User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

Impose triangular position restriction on enemies

Post by MeteoricDragon »

When i was testing underwater fog, a grizzly bear and slaughterfish were attacking from beneath me and I literally couldn't see them. I was thinking of giving the enemy motor a triangular restriction so that the angle below them and above them to the player has a limit to the angle.

Flying enemies would be restricted to approaching the player along the hypotenuse of the triangle if they reach the hypotenuse. If they are below it, they would move straight up until reaching it. Ground enemies would wait until they are within the triangle. This isn't exactly the easiest thing to describe but I can picture what I'm talking about pretty well.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Impose triangular position restriction on enemies

Post by Interkarma »

I think I get what you mean. It's a good idea to make things fair for the player since they can't easily strike enemies directly above or below them.

Just one thing to keep in mind is Daggerfall's general solution for this (remembering in classic you couldn't look up/down very far at all) was "area around caster" spells. The idea is you can nuke things within a certain radius that are otherwise very hard to hit.

As long as we don't diminish the motivation for player to use all their tricks, I'm all for things feeling fair to play. :)

Does anyone else have feedback related to this suggestion?

User avatar
Jay_H
Posts: 4061
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Impose triangular position restriction on enemies

Post by Jay_H »

As long as both sides are equal any solution would probably be well accepted. One way is for enemies directly below (or for fliers, above as well) to act as blind and path around until they get a clear view of the PC.

R.D.
Posts: 379
Joined: Fri Oct 07, 2016 10:41 am

Re: Impose triangular position restriction on enemies

Post by R.D. »

What seems to me like an easy solution for now is to just change enemies to use 2D distance to the player instead of 3D distance when deciding whether to stop moving at them. For flying/swimming enemies they could keep moving, but only straight up/down, when they reach the 2d distance limit.
Last edited by R.D. on Sat Sep 08, 2018 3:46 pm, edited 1 time in total.

R.D.
Posts: 379
Joined: Fri Oct 07, 2016 10:41 am

Re: Impose triangular position restriction on enemies

Post by R.D. »

Having them only go as far as the hypotenuse might look more realistic, though, especially for grounded enemies, like they were watching you and waiting for you to descend.

User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

Re: Impose triangular position restriction on enemies

Post by MeteoricDragon »

I finished coding this. I'd humbly appreciate anyone to test it and let me know what they think. I submitted a PR. I tested ground enemies and they work, I can't find a good situation with swimming or flying enemies to test it. I can't cast levitate on guards to test it either.

Post Reply