Emulating Ken's Labyrinth enemy movement?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Zero X. Diamond
Posts: 676
Joined: Tue Dec 22, 2009 12:46 am
Contact:

Emulating Ken's Labyrinth enemy movement?

Post by Zero X. Diamond »

Okay, yes, this is admittedly a bizarre request, but one that I must make nonetheless. What I'm looking to do is, by some method, limit the output of A_Chase so that enemies can only move in the four cardinal directions and only by 64 units at a time in any given one. Basically grid-based movement. It doesn't necessarily have to be A_Chase either; I just figured that would be the easiest way to make the enemies target the player. So yeah, uh, anyone have any ideas?
User avatar
Rachael
Posts: 13960
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Emulating Ken's Labyrinth enemy movement?

Post by Rachael »

If I were to do it, I would actually develop a function for this. Which pretty much means WFZS.

But - I do believe it can be done - you will have to reinvent the AI code a bit, but that's not a big deal since Doom's AI is pretty simplistic anyway - basically, wander around, try to get closer to the player, do occasional LOS checks to target, and if it can see the target do an attack. It can be done even in the existing DECORATE engine but it may require the help of ACS.
User avatar
Zero X. Diamond
Posts: 676
Joined: Tue Dec 22, 2009 12:46 am
Contact:

Re: Emulating Ken's Labyrinth enemy movement?

Post by Zero X. Diamond »

Kinsie: i have an idea, but one third of it might not be completely feasible, because i have not done it myself
Kinsie: for each tile movement, do a_facetarget, round off angle to the nearest 90 degrees, then use thrustthing to push them forward for the movement (bonus if you use a_stop to make them stop on a dime)
Me: i'll have to give that a go when i get home from work
Me: that sounds plausible
Me: how do i go about rounding off the angle?
Kinsie: that's the bit i'm not sure about :V
...
Me: had a thought on the KL movement conundrum
Me: if the angle was controlled by ACS scripting, couldn't i just get the actor's current angle and do a bunch of like
Me: if(angle<90)&&(angle>180)
Me: kind of stuff?
Kinsie: can't you do that in decorate as well, with anonymous functions?
Me: i have no idea!
Had a conversation with Kinsie about it. This sounds plausible but it's still got some holes in it, as in how do I actually do the angle rounding and what have you?
User avatar
Popsoap10
Posts: 60
Joined: Thu May 26, 2016 6:47 pm

Re: Emulating Ken's Labyrinth enemy movement?

Post by Popsoap10 »

Zero X. Diamond wrote:Had a conversation with Kinsie about it. This sounds plausible but it's still got some holes in it, as in how do I actually do the angle rounding and what have you?
To get only 90 degree angles, you would need something like

Code: Select all

function int cardinalAngle(int angle) {
	float floatAngle = (angle / 90) % 4;
	int roundAngle = (floatAngle + 0.5) >> 16;
	return roundAngle * 90;
}
User avatar
Zero X. Diamond
Posts: 676
Joined: Tue Dec 22, 2009 12:46 am
Contact:

Re: Emulating Ken's Labyrinth enemy movement?

Post by Zero X. Diamond »

Now we're getting somewhere! Just gotta ask because I am not the best scripter: is this ACS or one of those anonymous DECORATE functions Kinsie mentioned?
User avatar
Mikk-
Posts: 2274
Joined: Tue Jun 30, 2009 1:31 pm

Re: Emulating Ken's Labyrinth enemy movement?

Post by Mikk- »

That's an ACS function
Locked

Return to “Editing (Archive)”