Author Topic: Where to start with AI?  (Read 943 times)

I'd like to know how to program a path-finding(nevermind i just want AI in general) AI and the different algorithms to do so.

Where do I start?
« Last Edit: December 03, 2012, 03:36:08 PM by Aide33 »

This really isn't a TorqueScript subject (Coding Help - "Got a TorqueScript problem? Ask here").
Read up on general AI elsewhere, then look for ways to implement different algorithms in TorqueScript.

This really isn't a TorqueScript subject (Coding Help - "Got a TorqueScript problem? Ask here").
Read up on general AI elsewhere, then look for ways to implement different algorithms in TorqueScript.
Any good tutorials or things I can read?

Look up A* pathfinding or Dijkstra's pathfinding. I personally prefer Dijkstra's but it's harder to implement in Blockland due to the limitations of Torque.

you can look at minecraft's path finding
.. that might help

Look up A* pathfinding or Dijkstra's pathfinding. I personally prefer Dijkstra's but it's harder to implement in Blockland due to the limitations of Torque.
though A* is terribly complicated.

though A* is terribly complicated.
and only works if you have pre-placed nodes.

and only works if you have pre-placed nodes.
i once made a maze finding bot with it
just not in blockland.
brb trying to port python to TS
brb

A* is pretty simple. Dijkstra's takes way more resources to calculate, A* just requires a lot of listed variables. But, you're right, the biggest limitation is A* is the requirement of preplaced nodes while Dijkstra's will allow you to navigate around anything. I have a pretty lame implementation of Dijkstra's, you can see it here for reference:

https://dl.dropbox.com/u/52257595/Script_Zombies/path.cs

A* is pretty simple. Dijkstra's takes way more resources to calculate, A* just requires a lot of listed variables. But, you're right, the biggest limitation is A* is the requirement of preplaced nodes while Dijkstra's will allow you to navigate around anything. I have a pretty lame implementation of Dijkstra's, you can see it here for reference:

https://dl.dropbox.com/u/52257595/Script_Zombies/path.cs

When you provide an example, you should probably make sure it works.

path.cs:81
if(%player.getState() !$= "Move" || vectorDist(%this.getPosition(),%player.getPosition()) > 64))

Superfluous closing parenthesis.

path.cs:122
m(%pos);

The function m does not exist.

path.cs:90
%this.attack(%player);

The function AIPlayer::attack does not exist.



This actually looks pretty interesting so I'd love to try to experiment with it, but m seems like a pretty major function whose intended function I don't know of, so I can't do anything with this.

after testing it, it sort of chases you but does nothing similar to intelligent pathing
is this the intended behavior?
« Last Edit: December 09, 2012, 03:59:37 AM by Port »

When you provide an example, you should probably make sure it works.
It worked for me in the past, and I haven't edited it since when it worked, so really I have no idea why there's an extra closing parenthesis. M was shorthand for "marker", it was a debug function that marked the end-point of all raycasts so I could make sure the search angle was correct and I thought I removed all references to it. AIPlayer::attack was defined in another file, so that's why that's not there. As I said, "you can see it here for reference."

after testing it, it sort of chases you but does nothing similar to intelligent pathing
is this the intended behavior?
Huh? It navigates around walls, it will even navigate through most mazes without issue. Try raising $Pref::Bot::Intelligence to 500-1000.

Regardless, I solved most errors. You'll have to manually mount an item to the bot, though. I just kind of half-assed the attack function, since the one in the other file relied on too many other things to be scrapped down.
« Last Edit: December 09, 2012, 04:23:51 AM by Trinick. »