Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-13-2009, 03:25 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
A*

Personally I don't really care whether or not anyone does anything around here anymore with respects to it being beneficial to me, but I figure some proper use and documentation of this search algorithm when it comes to GScript would be highly beneficial for playerworlds to implement to create smarter AI.

Perhaps the GDT can get together for something like this? Chances are no one will bother, but the game is already tile-based so it wouldn't be very difficult to create a grid system and work your way from there. I don't believe much of any documentation exists when it comes to search algorithms and things that are AI-based which is probably why just about all servers lack smart AI.

Feel free to discuss, as stated, I wouldn't use it since I don't log on the game anymore, but when it comes to things that can help push the game forward, this is definitely one of them.
Reply With Quote
  #2  
Old 09-13-2009, 03:34 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
I've done pathfinding on Graal before with my Sterence Project. It's certainly feasible but my effort had perfect pathfinding with a fairly high load. There was a noticeable hiccup on the server when I did longer a->b finds.

It'd be interesting for a team to provide different solutions. The different heuristics that can be used as well as different methods (such as using a* to find the nearest preset node point to get on a prescripted track)

I'd be interested in getting mine working again (I lost it all via raid failure) but I'll yield to hell Raven being the master of A* on graal if he still reads here.
Reply With Quote
  #3  
Old 09-13-2009, 03:41 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Both HellRaven and Chompy has had a somewhat completed A* system. I was working on one as well, but abandoned it for reasons I can't remember.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #4  
Old 09-13-2009, 05:57 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
There have been quite a few scripts made a while ago as everyone jumped to be the first to write up a full working [and efficient] A*... but that was back in GS1. Surprised this wasn't revisited, as back then Graal didn't handle arrays very well at all, and the better support for arrays in GS2 would mean much better A*.

Sadly, that's a lot of processing to be done and real-time A* would probably be too much for Graal to handle. It was quickly determined the best route of pathfinding would be setting up nodes at major intersections of obstacles and letting the NPC pathfind that way. This view may have changed, as, like I said, no one has really brought this up since GS2's arrival. Graal could very well handle it... but I dunno about having multiple baddies on screen trying to pathfind to the player whenever they get out of their line of sight.
Reply With Quote
  #5  
Old 09-13-2009, 06:09 PM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
I made a pretty decent A* system when I was working on my RTS-based server...I guess I could take another look at it and post it in the code gallery when I have the time.

I wasn't able to finish everything I wanted to do with it, but there's a few things in place to help speed up the pathfinding. It really only started to lag whenever I selected 15 + npcs and told them to move at the same time.
Reply With Quote
  #6  
Old 09-13-2009, 06:11 PM
firefighter firefighter is offline
Registered User
Join Date: Jan 2009
Location: Germany
Posts: 70
firefighter is on a distinguished road
Our server Zenox uses only a simple pathfinding algorithm with weighting because "real" pathfinding algorithms would lagg the npc server down. Also the algorithm is only used in baddies, when they need to find the way (else they use simple onwall2/onwater2 checks) ;-)
Reply With Quote
  #7  
Old 09-13-2009, 06:38 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Well I'm sure the best route we could take with this is to develop a solid scripted version and have Stefan implement it efficiently into the NPC-Server & Client.
__________________
Quote:
Reply With Quote
  #8  
Old 09-13-2009, 06:41 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
There is already the findpathinarray function, lol.
Reply With Quote
  #9  
Old 09-13-2009, 06:48 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by DustyPorViva View Post
There is already the findpathinarray function, lol.
It's quite basic though, and certainly not the advanced solution we want.
__________________
Quote:
Reply With Quote
  #10  
Old 09-13-2009, 07:32 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
I made a tactics game using A* pathfinding. It works pretty fast as well. I modified the concept though a little, to find paths in heavy terrain easier.

http://forums.graalonline.com/forums...0&postcount=74 - Screenshots
http://forums.graalonline.com/forums...0&postcount=68 - Video

(The video is old though, I've optimized it more by now)

I've been thinking of adding support for Z-valued tiles to allow jumping etc. (Final Fantasy Tactics anyone?)
__________________
Reply With Quote
  #11  
Old 09-13-2009, 07:47 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
the pathfinding in the video looks a bit awkward (mostly turning twice instead of once to go diagonal)
Reply With Quote
  #12  
Old 09-13-2009, 08:08 PM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Quote:
Originally Posted by Chompy View Post
I made a tactics game using A* pathfinding. It works pretty fast as well. I modified the concept though a little, to find paths in heavy terrain easier.

http://forums.graalonline.com/forums...0&postcount=74 - Screenshots
http://forums.graalonline.com/forums...0&postcount=68 - Video

(The video is old though, I've optimized it more by now)

I've been thinking of adding support for Z-valued tiles to allow jumping etc. (Final Fantasy Tactics anyone?)
I remember this. It would be a great thing to release for public use.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #13  
Old 09-13-2009, 08:27 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Mark Sir Link View Post
the pathfinding in the video looks a bit awkward (mostly turning twice instead of once to go diagonal)
I added an option (bool) to enable diagonal movement if wanted
__________________
Reply With Quote
  #14  
Old 10-03-2009, 06:57 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
You may be able to get this working at short, single level, distances, maybe even with several AI's using it. But you're never gonna get enough speed from GS2 to run it more realistic environment. I mean, unless you wanna restrict your baddies to that.
Reply With Quote
  #15  
Old 10-04-2009, 01:17 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by coreys View Post
You may be able to get this working at short, single level, distances, maybe even with several AI's using it. But you're never gonna get enough speed from GS2 to run it more realistic environment. I mean, unless you wanna restrict your baddies to that.
My A* algorithm ran pretty fast for me, but for others, nope. In the end, it depends on your computer specs. GS2 is fast enough, it really depends on your own computer, as the algorithm is done clientside.
__________________
Reply With Quote
  #16  
Old 10-04-2009, 01:19 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by Chompy View Post
My A* algorithm ran pretty fast for me, but for others, nope. In the end, it depends on your computer specs. GS2 is fast enough, it really depends on your own computer, as the algorithm is done clientside.
I think the point is, is that many low level languages have a hard time handling path-finding, and something interpretive like Graal is going to have an even harder.
Reply With Quote
  #17  
Old 10-04-2009, 05:38 AM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
This is why you need to utilize every possible method to help speed up the process (predefining impossible locations, overflow queue, binary heap for sorting, etc)

My A* was pretty damn fast as handling several NPCs searching at the same time, but then again my computer is a beast
Reply With Quote
  #18  
Old 10-04-2009, 06:00 AM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Looks like everybody has A*. But nobody's sharing. Hm.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #19  
Old 10-04-2009, 07:05 AM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
Quote:
Originally Posted by LoneAngelIbesu View Post
Looks like everybody has A*. But nobody's sharing. Hm.
I would, but after going back and taking a look at it recently, it's not very code-gallery-friendly, and between school and Era, I just don't have the time.
Reply With Quote
  #20  
Old 10-04-2009, 11:10 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by salesman View Post
I would, but after going back and taking a look at it recently, it's not very code-gallery-friendly, and between school and Era, I just don't have the time.
Same here, my A* algorithm is not code gallery friendly atm as it was highly integrated with Crystia's main systems, but I'll probably fix it later making it more code gallery friendly. Basicly the A* is also just a part of a bigger system, a tactics engine (:

And, my A* algorithm never lagged/slowed down for me, not even on long distances with a lot of terrain, but as salesman said, I have a beast of a computer as well x)
__________________
Reply With Quote
  #21  
Old 10-04-2009, 04:46 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Quote:
Originally Posted by DustyPorViva View Post
I think the point is, is that many low level languages have a hard time handling path-finding, and something interpretive like Graal is going to have an even harder.
Depends on your definition of low level lol
Generally, people consider Assembly low level and I don't think anyone is even going to try creating that algorithm in Assembly.

C++ and some of the faster interpretive languages like Lua and Python handle it just perfectly, however.

The issue is using it smartly. Make sure you're only using it when absolutely necessary. For instance, don't recalculate the path unless the destination has changed a certain amount. If the AI reaches the destination, and the target has changed, then recalculate the path.

Perhaps if you incorporate these (among other) methods you could run it with several in a level on average hardware. It's a longshot, though.
Reply With Quote
  #22  
Old 10-04-2009, 07:11 PM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Quote:
Originally Posted by salesman View Post
I would, but after going back and taking a look at it recently, it's not very code-gallery-friendly, and between school and Era, I just don't have the time.
Quote:
Originally Posted by Chompy View Post
Same here, my A* algorithm is not code gallery friendly atm as it was highly integrated with Crystia's main systems, but I'll probably fix it later making it more code gallery friendly. Basicly the A* is also just a part of a bigger system, a tactics engine (:

And, my A* algorithm never lagged/slowed down for me, not even on long distances with a lot of terrain, but as salesman said, I have a beast of a computer as well x)
So post it here, guys. Those of us that are interested in it aren't going to be clueless. I'd just rather not reinvent the wheel, if A* algorithms are already out there.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #23  
Old 10-04-2009, 08:28 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by LoneAngelIbesu View Post
So post it here, guys. Those of us that are interested in it aren't going to be clueless. I'd just rather not reinvent the wheel, if A* algorithms are already out there.
Yeah, I'm interested now too.
__________________
Quote:
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:09 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.