Page 1 of 2

centipede movement in zzt++ 0.8.48

Posted: Sun Jun 26, 2005 9:48 pm
by wep
looks easy enough, but it ain't. centipede movement.

when you place a centipede on a board using the editor, you basically add a head and some adjacent segments and zzt turns it into a proper centipede. make a mistake, and the rogue segments turn into heads.

behind this is a rather nifty routine which figures out which segments belong to the head and which don't. zzt does this in its own peculiar way. for instance, adding a head surrounded entirely by segments, causes all segments to be turned into heads.

i've written a routine today which links all segments to a head, much the same way zzt does it. the source code is available on source forge through planetzzt++.com

i'll be adding the routines to move the centipedes (easy enough) and to turn segments into heads if need be.

woops

Posted: Thu Jun 30, 2005 9:22 pm
by wep
easy enough was the understatement of the week...

moving centipedes is a bitch. they don't move like regular creatures at all, which is what i was anticipating. centipedes have their own style, based on intelligence and deviance. but they never back into their segments (if any) and they like moving in straight lines, so they stick to certain direction. they have some sort of memory, is what i figure. regular creatures determine their next move in each game cycle. centipedes have to set a goal and remember it for a couple of cycles, so i've added runtime information to zzt++ which doesn't get saved into the world file and is expendable.

still have to work in intelligence and deviance, but i'm not saying it'll be easy anymore. hopefully i'll get centipedes moving by this weekend.

no wonder megazeux has no centipedes and plastic's centipedes don't move yet. no wonder....it's hard.

Posted: Thu Jun 30, 2005 9:23 pm
by Ando
Good luck you top ranking soldier!!!

Posted: Mon Jul 04, 2005 4:45 pm
by TTTPPP
Centipedes have three possible next moves - straight, cw or ccw. If they can't do any of them then they turn around. I think they go straight by default, with a probability of turning depending on their deviance. The probability might be different if they are aligned, or in contact with the player (?)

This may be complete rubbish as I haven't opened ZZT for months :-(

Posted: Mon Jul 04, 2005 5:23 pm
by Quantum P.
Actually, I think you got most of it right. Deviance refers to the head's deviance from a straight-line path and intelligence refers to its ability to find the player. However, after running some tests, I found that it could go in any of the four directions that weren't blocked. For most heads, this <i>is</i> straight, cw, and ccw, because they are blocked from behind by the segments that follow them. When I allowed a single head to wander around, I found that it could reverse direction even if it was not blocked on all other sides. The deviance of a head probably refers to the probability on any given cycle of it choosing a new direction.

You're right that alignment has an effect on the head. If the player is at the far corner of the board, the centipede won't chase after him, no matter how high the intelligence level is. However, as soon as the player walks past the head of the centipede (or vice versa), the head begins walking in the direction of the player. Intelligence might be the probability of the head changing direction if it is aligned with the player (or possibly the probability of checking to see if it is aligned; I don't know if it would matter which).

Now we just need to find the probabilities, assuming all is correct so far.

Posted: Mon Jul 04, 2005 6:50 pm
by Flimsy
Image

...

Posted: Mon Jul 04, 2005 9:12 pm
by wep
i programmed zzt++ now to only change direction:
a. if the head is aligned with the player
b. the head runs into something
c. the head is "being deviant"
otherwise, it'll just go straight.

then, based on it's intelligence it will move away from or toward the player. i haven't noticed a "sensitivity" factor yet. probably the head only responds to the player if it's close enough.

the only other situations are those where the head runs into a place where it can't move anywhere but back. it will reverse completely.

when you surround a head with segments, it doesn't link to any of them. all segments turn into heads. that's something i have to look into as well.

have you guys ever seen a clone with correct centipede movement? i know plastic doesn't have it....

Posted: Mon Jul 04, 2005 9:24 pm
by Ando
Hey woah I just looked at some archived zzt.org thingies from like 2001 and it seems like you were a big man then. I didn't know that you were an oldbie and whatnot.

In other words GET FIST'D BITCHEZ

yup

Posted: Tue Jul 05, 2005 7:24 am
by wep
i am not new.

i am old.

Posted: Tue Jul 05, 2005 11:52 am
by FSFunky
oh ando you're so random and funny!

Re: ...

Posted: Tue Jul 05, 2005 4:07 pm
by Commodore
wep wrote:i programmed zzt++ now to only change direction:
a. if the head is aligned with the player
b. the head runs into something
c. the head is "being deviant"
otherwise, it'll just go straight.

then, based on it's intelligence it will move away from or toward the player. i haven't noticed a "sensitivity" factor yet. probably the head only responds to the player if it's close enough.
I'm not sure it works that way. I think the slider "deviant" increases the rate at which the head will decide to change direction. When it comes to decide, its intellegence judges how often it takes a seek direction instead of a random one. Although you do seem to be right, a intellegent head will seem to make a sharp turn whenever alligned with the player.

Nanobot should be contacted. :O

Re: ...

Posted: Tue Jul 05, 2005 4:10 pm
by Commodore
wep wrote:i programmed zzt++ now to only change direction:
a. if the head is aligned with the player
b. the head runs into something
c. the head is "being deviant"
otherwise, it'll just go straight.

then, based on it's intelligence it will move away from or toward the player. i haven't noticed a "sensitivity" factor yet. probably the head only responds to the player if it's close enough.
I'm not sure it works that way. I think the slider "deviant" increases the rate at which the head will decide to change direction. When it comes to decide, its intellegence judges how often it takes a seek direction instead of a random one. Although you do seem to be right, a intellegent head will seem to make a sharp turn whenever alligned with the player.

Nanobot should be contacted. :O

Posted: Wed Jul 06, 2005 2:40 am
by Aplsos
no, he shouldn't.

he should never be contacted.

Posted: Wed Jul 06, 2005 2:50 am
by Dr. Dos
boknsos wrote:no, he shouldn't.

he should never be contacted.

Posted: Wed Jul 06, 2005 4:01 am
by Ando
Wouldn't it be great if we could just ask Tim Sweeny how the damn thing works?

Too bad that even he probably wouldn't remember (or care, for that matter).