This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-06-11 23:53:06

lestrade3333
Scratcher
Registered: 2008-05-21
Posts: 18

Automatic AI walk path

Is it possible, that you set an unpassible block (or whatever) in the middle and when you click at a destination, a sprite will automatically avoid the block to get to the place you've clicked WITHOUT PLAYER'S MANUAL GUIDANCE? If yes, is it possible to let it move in a way that will avoid the block entirely (not touching it at all, not to hit the border then turn) just to skirt the perimeter in a natural, non-erratic way?

Offline

 

#2 2008-06-12 04:53:23

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Automatic AI walk path

I'm sure it is possible...let's look at the second part first.  You could have hidden sensor sprites that surround the sprite and give it information about obstacles around it.  Archmage has a project that shows how this is done here:

http://scratch.mit.edu/projects/archmage/101212


  As for walking around objects, I don't think that would be hard to do either.  Here is a very crude attempt that I threw together very quickly:

http://scratch.mit.edu/projects/Paddle2SeeFixIt/186501


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#3 2008-06-12 13:45:10

AddZero
Scratcher
Registered: 2007-08-11
Posts: 100+

Re: Automatic AI walk path

Interesting problem.
Paddle2See, your's is perfect for small obstacles- what lestrade3333 is trying to do.

I puzzled over AI navigation for a while, this is a good time to try it out!  It can do some larger obstacles, but it can still give up and do nothing.  It could be improved.
http://scratch.mit.edu/projects/AddZero/186736#

Last edited by AddZero (2008-06-12 21:28:48)


http://scratch.mit.edu/static/icons/buddy/524717_med.png?t=2010-06-15+09%3A48%3A36

Offline

 

#4 2008-06-12 21:23:38

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: Automatic AI walk path

I should make one of these, since they working AI seems to be a popular topic now  smile


All your base are belong to us

Offline

 

#5 2008-06-13 00:20:26

lestrade3333
Scratcher
Registered: 2008-05-21
Posts: 18

Re: Automatic AI walk path

It's really nice, folks, thanks a lot.  smile

Offline

 

#6 2008-06-13 04:58:54

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Automatic AI walk path

Yeah, these are fun...thanks for bringing it up lestrade333!  I'm working on a more sophisticated version now that may or may not actually work.  I'll let you know if it leads to anything useful.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#7 2008-06-13 05:45:33

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: Automatic AI walk path

I made one here  smile  http://scratch.mit.edu/projects/deatheater/187379

Offline

 

#8 2008-06-13 06:46:36

lestrade3333
Scratcher
Registered: 2008-05-21
Posts: 18

Re: Automatic AI walk path

you're making me feel like a tinker...

Offline

 

#9 2008-06-13 13:23:21

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Automatic AI walk path

lestrade3333 wrote:

you're making me feel like a tinker...

I'm sorry, I'm not familiar with that saying...how does a tinker feel?


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#10 2008-06-13 17:04:42

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: Automatic AI walk path

Paddle2See wrote:

lestrade3333 wrote:

you're making me feel like a tinker...

I'm sorry, I'm not familiar with that saying...how does a tinker feel?

I think he means "thinker"  big_smile


All your base are belong to us

Offline

 

#11 2008-06-14 02:18:51

lestrade3333
Scratcher
Registered: 2008-05-21
Posts: 18

Re: Automatic AI walk path

no, I think it's a reference from Paganini (or someone of the sort) when he heard Brahm's third symphony, in other words, you make me feel stupid.

Offline

 

#12 2008-06-14 05:43:23

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Automatic AI walk path

lestrade3333 wrote:

no, I think it's a reference from Paganini (or someone of the sort) when he heard Brahm's third symphony, in other words, you make me feel stupid.

No need to feel stupid!  You've raised up one of the more challenging and interesting problems that you can attempt to solve with Scratch.  Problems of this caliber tend to attract the more advanced programmers.  You can use as much or as little of what they produce as you wish.  If you have questions on a particular technique, I'm sure the author would be happy to answer them.  Thanks for keeping Scratch interesting!


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#13 2008-06-14 11:39:12

dbal
Scratcher
Registered: 2007-07-19
Posts: 100+

Re: Automatic AI walk path

deatheater wrote:

I made one here  smile  http://scratch.mit.edu/projects/deatheater/187379

Great programs are made to be broken ):

Click inside the elbow very close to the black material and the cat will go into an endless loop trying to find a way to solve the problem.


Dick Baldwin - Don't get stuck scratching. When you master Scratch, move on up to more serious programming languages. Free online programming tutorials:
Scratch - Alice - Java - C# - C++ - JavaScript - XML - Python - DSP

Offline

 

#14 2008-06-14 12:26:33

AddZero
Scratcher
Registered: 2007-08-11
Posts: 100+

Re: Automatic AI walk path

dbal wrote:

deatheater wrote:

I made one here  smile  http://scratch.mit.edu/projects/deatheater/187379

Great programs are made to be broken ):

Click inside the elbow very close to the black material and the cat will go into an endless loop trying to find a way to solve the problem.

I applaud the AI's persistence.   smile
What if a door opened to the solution, or the obstacle moved.
The lazy AI would not get it.
Now if the AI would hurt himself or others by continuing forever- and not find food for example... then that's a bad thing.  It's just being obedient.

Last edited by AddZero (2008-06-14 12:30:15)


http://scratch.mit.edu/static/icons/buddy/524717_med.png?t=2010-06-15+09%3A48%3A36

Offline

 

#15 2008-06-14 13:00:30

dbal
Scratcher
Registered: 2007-07-19
Posts: 100+

Re: Automatic AI walk path

AddZero wrote:

dbal wrote:

deatheater wrote:

I made one here  smile  http://scratch.mit.edu/projects/deatheater/187379

Great programs are made to be broken ):

Click inside the elbow very close to the black material and the cat will go into an endless loop trying to find a way to solve the problem.

I applaud the AI's persistence.   smile
What if a door opened to the solution, or the obstacle moved.
The lazy AI would not get it.
Now if the AI would hurt himself or others by continuing forever- and not find food for example... then that's a bad thing.  It's just being obedient.

No quarrel with that.  However another option might be for the cat to loiter in the immediate area ready to pounce when the door opens instead of making another trip around the obstacle.  smile

It is interesting to wonder what a real cat or perhaps a hunting dog would do if confronted with a similar situation.

That's why AI is so much fun.  There are often no right solutions or wrong solutions.  Only (hopefully) good solutions.  smile

Last edited by dbal (2008-06-14 13:40:08)


Dick Baldwin - Don't get stuck scratching. When you master Scratch, move on up to more serious programming languages. Free online programming tutorials:
Scratch - Alice - Java - C# - C++ - JavaScript - XML - Python - DSP

Offline

 

#16 2008-06-14 18:45:48

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: Automatic AI walk path

AddZero wrote:

dbal wrote:

deatheater wrote:

I made one here  smile  http://scratch.mit.edu/projects/deatheater/187379

Great programs are made to be broken ):

Click inside the elbow very close to the black material and the cat will go into an endless loop trying to find a way to solve the problem.

I applaud the AI's persistence.   smile
What if a door opened to the solution, or the obstacle moved.
The lazy AI would not get it.
Now if the AI would hurt himself or others by continuing forever- and not find food for example... then that's a bad thing.  It's just being obedient.

No if a door opened it would choose a path to get in. it tells the cat to choose a path in, because it's so far in the cat can't reach it, if it had an opening the cat would try to get to the target anyway possible without touching the black  smile

Offline

 

#17 2008-06-16 00:22:03

lestrade3333
Scratcher
Registered: 2008-05-21
Posts: 18

Re: Automatic AI walk path

If anyone is interested in an advancement of the matter, here is another question:

(first see the second demonstrative project by Paddle2See)
He shows three black balls which the cat avoids if it hits them.
He does that by a hidden sensor dish, which is also circular.
His programming takes advantage of the fact that when the two circles hit each other, the curve gradient of the two arc should just be able to make the cat look like it skirts at the edge.

But the problems are thus:
1) what if the obstacles are not circular?
2) If two circles are placed near each other, they act like a messed-up gravimetrical field (or a magnetic field, at any rate) and the cat would curve into one of the circles.

I am trying to make multiple blocks in a maze-like (but less complex) arrangement.
Oval obstacles have failed. Blocks don't work. So, maestroes of the Scratchworld, another dilemma to add to your list.

Offline

 

#18 2008-06-16 01:27:16

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: Automatic AI walk path

lestrade3333 wrote:

If anyone is interested in an advancement of the matter, here is another question:

(first see the second demonstrative project by Paddle2See)
He shows three black balls which the cat avoids if it hits them.
He does that by a hidden sensor dish, which is also circular.
His programming takes advantage of the fact that when the two circles hit each other, the curve gradient of the two arc should just be able to make the cat look like it skirts at the edge.

But the problems are thus:
1) what if the obstacles are not circular?
2) If two circles are placed near each other, they act like a messed-up gravimetrical field (or a magnetic field, at any rate) and the cat would curve into one of the circles.

I am trying to make multiple blocks in a maze-like (but less complex) arrangement.
Oval obstacles have failed. Blocks don't work. So, maestroes of the Scratchworld, another dilemma to add to your list.

My remix get's rid of that problem  smile

Offline

 

#19 2008-06-17 03:19:45

Rurigok
Scratcher
Registered: 2008-01-24
Posts: 93

Re: Automatic AI walk path

I remember someone made one like that using 2 probes (one tests direct path to sprite)( another randomly looks for a clear path around)  it works pretty good.


Creator of Imperion Online(a MMO)
ImperionOnline/Cyclone103's forums.

Offline

 

#20 2008-06-17 03:51:46

lestrade3333
Scratcher
Registered: 2008-05-21
Posts: 18

Re: Automatic AI walk path

Rurigok, that's exactly what I need, is there a link?
By the way does the project you refer to chooses the logically shortest path to the target?
If you have the link, I would be really grateful.

Offline

 

#21 2008-06-17 04:10:24

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: Automatic AI walk path

lestrade3333 wrote:

Rurigok, that's exactly what I need, is there a link?
By the way does the project you refer to chooses the logically shortest path to the target?
If you have the link, I would be really grateful.

I've seen the same one, no it doesn't show you the quickest path  sad

Offline

 

#22 2008-06-17 07:07:21

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Automatic AI walk path

Here's the link to AddZero's two probe approach:

http://scratch.mit.edu/projects/AddZero/186736


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#23 2008-06-17 23:19:22

lestrade3333
Scratcher
Registered: 2008-05-21
Posts: 18

Re: Automatic AI walk path

Thanks, it was inspiring, but is there anyway to modify the AddZero program to 1)debug it? 2)let the cat find the quickest route instead of a random route? I read that Paddle2See wrote something about improving it in the comments section of that program, Are you done yet?

Offline

 

#24 2008-06-17 23:48:11

Rurigok
Scratcher
Registered: 2008-01-24
Posts: 93

Re: Automatic AI walk path

i will try improving addzero's project, see what i can do


Creator of Imperion Online(a MMO)
ImperionOnline/Cyclone103's forums.

Offline

 

#25 2008-06-18 01:43:07

lestrade3333
Scratcher
Registered: 2008-05-21
Posts: 18

Re: Automatic AI walk path

Thanks so much.  smile

Offline

 

Board footer