Artificial Intelligence Tools Extension (Beta Release 8)

merrak

  • *
  • Posts: 2265
Thanks for the bug report! I'll take a look at the sample project and put out an updated version when I get it fixed. That block was working fine in my own earlier project, so hopefully I didn't break previously working code with the latest update.

LIBERADO

  • *
  • Posts: 2604
I'll take a look at the sample project and put out an updated version when I get it fixed.
:) OK, thanks.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

merrak

  • *
  • Posts: 2265
I uploaded a revised version that (possibly) corrects NaN error. I'm not certain because it turned out to be a platform-dependent issue. I could not reproduce it on a Linux desktop build, but I did get the NaN on a Flash build. If you still see it, please let me know what platform you found it on.

The other error isn't a problem with the code. You just used the block in the wrong way. "connection exists between" only checks if two nodes are connected by an edge (i.e. they are directly connected)--not if a path exists from one to the other.

I don't think the original documentation made the point clear, so I modified it: "Returns true if there is an edge connecting the two specified nodes. For one-way connections, the source is the first node, and destination the second."

The 'find path' block will return an empty list if a path cannot be found, so you should be able to use the "list is empty" block to check whether or not a path exists.

LIBERADO

  • *
  • Posts: 2604
OK, thanks for the fix and the useful clarification. If I find any bug in this new release, I will let you know.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

Macroplasm

  • Posts: 35
How many formats does it work in? I know it works in flash and HTML5 but does it work on windows or android?

merrak

  • *
  • Posts: 2265
It should work on any platform. It doesn't use any special libraries that are only available on certain devices. If you run into any platform-dependent issues, it's probably a bug. In that case, let me know what the error was and I'll get on it.

Wow!I just meet this extension.I really need pathfinding extension.Thank you. :)

yoplalala

  • *
  • Posts: 1491
downloaded last one

AITools.hx:1014: characters 17-26 : You can't iterate on a Dynamic value, please specify Iterator or Iterable



instead of

// for each node in the bucket
Code: [Select]
            for ( node in bucket[i] )
            {
                node.g = 0;
                node.f = 0;
                node.parent = null;
                node.activeConnection = null;
            }
you can put

Code: [Select]
var thebucket:Array<GraphNode> = bucket[i]; 

        for ( node in thebucket )
        {
                node.g = 0;
                node.f = 0;
                node.parent = null;
                node.activeConnection = null;
            }
        }
like you did in th function destroy()

merrak

  • *
  • Posts: 2265
Oops -- I thought I caught all of those. I suppose a Release 7 will be in order :)

LIBERADO

  • *
  • Posts: 2604
AITools.hx:1014: characters 17-26 : You can't iterate on a Dynamic value, please specify Iterator or Iterable
Same error when using this block:
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

merrak

  • *
  • Posts: 2265
I can't reproduce the two errors, but I updated all the references to
Code: [Select]
buckets[i] that I could find.

LIBERADO

  • *
  • Posts: 2604
Now it works for me. Thanks.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

SirCrocketz

  • *
  • Posts: 18
Any chance someone can give me a quick crash course on how to get this to work? All I want is to make a created actor walk to a specified location. What do I need to implement to make my actor move in the direction of the next node?

merrak

  • *
  • Posts: 2265
You'll need to supply your own behavior that lets your actor walk to a specified coordinate. Make sure you didn't miss this page (http://anorthogonaluniverse.com/public-code/ai-path.php) that instructs how to parse the data returned by the 'best path' block. The first item in the returned list is a smaller list that contains the data for the first step. The first and second entries of the sublist will contain the row,col location of the first step.

If an example implementation would help, here's a modification of the original sample project I made for someone. Click on the field to set the ball in motion. I used the 'follow path' behavior that comes with some of the kits to handle the ball's motion.

1MrPaul1

  • *
  • Posts: 1266
Hi  Merrak!
Great extension
Thank  you very  much for it
Can you advice how to draw the path,
and when you are trying to connect tiles that  can't be connected the game showing null error, but logically if the game will  just  return not connections