Announcement: Be excellent to each other.


Caravel Forum : Caravel Boards : General : Snake AI
New Topic New Poll Post Reply
Poster Message
JayS
Level: Goblin
Rank Points: 16
Registered: 03-20-2004
IP: Logged
icon Snake AI (0)  
Can someone explain the snake AI to me? I know that there have been other posts on this subject, but I read most of those and I still don't understand it. I'm trying to make a snake stage that relies on the 5-move sequence that my friend told about, but i experimented for a while and i cant get it to work. What's all that business about switching movement preferences?
01-21-2005 at 11:18 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
agaricus5
Level: Smitemaster
Rank Points: 1838
Registered: 02-04-2003
IP: Logged
icon Re: Snake AI (+1)  
JayS wrote:
Can someone explain the snake AI to me? I know that there have been other posts on this subject, but I read most of those and I still don't understand it. I'm trying to make a snake stage that relies on the 5-move sequence that my friend told about, but i experimented for a while and i cant get it to work. What's all that business about switching movement preferences?
The snake behaviour is roughly switching from horizontal motion to vertical motion every time the spawn counter reaches a multiple of 5. This is nullified by being in or nearly in the serpent's line of sight, although if you are at an angle from 0-45 degrees to its head, this may become important in determining exactly how it decides to line up with you.

The best place to see this behaviour is if you are standing diagonally away from the serpent, with a distance of at least 5 squares from you to it. Making a room requiring such movement is pretty difficult, since it is only really applicable/noticeable if you are on a diagonal from the snake's head, it is in an open area, and you cannot reach it (being able to do so implies you can lead it personally to do what you require of it). One example you might want to have a look at, however, could be Bavato's Dungeon L6 1S 1E, in which the solution with all 6 potions makes use of such an idea.

____________________________
Resident Medic/Mycologist
01-21-2005 at 11:33 PM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
Rabscuttle
Level: Smitemaster
Avatar
Rank Points: 2460
Registered: 09-10-2004
IP: Logged
icon Re: Snake AI (+1)  
There's a useful description here (if you haven't already seen it)

http://www.drod.net/forum/viewtopic.php?TopicID=2587&page=0#23943

I will try to paraphrase.

* If the serpent is on the same row/column and heading away from you, it tries to keep heading away from you
* If the serpent is on the same row/column as you (and not heading away from you) it tries to move towards you
* If the serpent is not on the same row/column, then it tries to move towards you, either vertically or horizontally (depending on its current preference).


* If the square the serpent wants to move to is blocked, then it tries to move N, E, S, W in order.

To check which direction the serpent prefers, look at the spawn counter.
If the spawn counter ends in 1,0,9,8,7 then the serpent will want to move horizontally.
If the spawn counter ends in 6,5,4,3,2 then the serpent will want to move vertically.

(This means that a room starts with a set of 4 horizontal moves, then alternates with 5V, 5H, 5V, etc)


[Edited by Rabscuttle at Local Time:01-22-2005 at 02:05 AM]
01-22-2005 at 12:04 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
eytanz
Level: Smitemaster
Avatar
Rank Points: 2708
Registered: 02-05-2003
IP: Logged
icon Re: Snake AI (+1)  
Rabscuttle wrote:
There's a useful description here (if you haven't already seen it)

http://www.drod.net/forum/viewtopic.php?TopicID=2587&page=0#23943

I will try to paraphrase.

* If the serpent is heading away from you, it tries to keep heading away from you
* If the serpent is on the same row/column as you (and not heading away from you) it tries to move towards you


You probably want to switch those two around (in the sense that a serpent will only keep heading away from you if it's in the same line as you).

____________________________
I got my avatar back! Yay!
01-22-2005 at 01:58 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Rabscuttle
Level: Smitemaster
Avatar
Rank Points: 2460
Registered: 09-10-2004
IP: Logged
icon Re: Snake AI (0)  
Changed
01-22-2005 at 02:06 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
stigant
Level: Smitemaster
Avatar
Rank Points: 1182
Registered: 08-19-2004
IP: Logged
icon Re: Snake AI (0)  
Another thing I've noticed. If you move to a square diagonally behind the snake, it will turn left, even if you are on the right.

____________________________
Progress Quest Progress
01-23-2005 at 05:30 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
Rabscuttle
Level: Smitemaster
Avatar
Rank Points: 2460
Registered: 09-10-2004
IP: Logged
icon Re: Snake AI (+1)  
That isn't always true. If a snake is heading W and you are to the NE of its head, the snake will always move N (unless that square is blocked)

If you move from in line with its head to behind its head, in 4 out of 5 cases it will want to move backwards (which is obviously blocked) and so will try each of the squares N,E,S,W in order.

In the fifth case, it's just changed its direction preference and will always turn towards you.

[Edited by Rabscuttle at Local Time:01-23-2005 at 07:51 AM]
01-23-2005 at 07:51 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : Caravel Boards : General : Snake AI
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.