Go Back   RunUO - Ultima Online Emulation > RunUO > General Discussion

General Discussion General discussion for the RunUO community, all off-topic posts will be deleted. This forum is NOT FOR SUPPORT!

Reply
 
Thread Tools Display Modes
Old 06-07-2008, 01:37 PM   #1 (permalink)
Forum Novice
 
Join Date: Jan 2004
Posts: 190
Default Long Distance Pathfinding

I was wondering if it was possible to long distance pathfind? I was thinking of making a race style quest where npcs and and players would race given various starting locations and ending locations (vesper to yew distances). I've read through all the tile data stuff but I'm not sure the sizes of the data within the tile matrices being used. Do the matrices hold only the screen data where the mobile is located or the entire map? I also don't see where the map data is actually being read, anyone know where it exists? I tried calling just the plain static Map.AllMaps[] but the list comes back as empty.
Stuby is offline   Reply With Quote
Old 06-07-2008, 07:05 PM   #2 (permalink)
Account Terminated
 
Join Date: Aug 2006
Location: Mexico / California
Age: 100
Posts: 557
Send a message via AIM to Arkad
Default

That would be cool, for guard patrols on roads or something too.
Arkad is offline   Reply With Quote
Old 06-07-2008, 07:37 PM   #3 (permalink)
Forum Expert
 
mordero's Avatar
 
Join Date: Nov 2003
Location: Illinois, USA
Age: 22
Posts: 2,911
Default

You wouldnt have to create true pathfinding, you could always just set up premade paths for NPCs to use.
mordero is offline   Reply With Quote
Old 06-08-2008, 07:00 PM   #4 (permalink)
Forum Novice
 
Join Date: Jan 2004
Posts: 190
Default

I want to make my own A* with it, I just need to know how to read the tiles as being impassable or not. I know how to check this (I think), it just needs and x and y paramter. I am not sure if the x y required is in relation to map block or to tile count. For example if I want to check tile coordinate 3000, 216 do I pass those values or 4,5 where 4,5 would be the example block relation coordinates?
Stuby is offline   Reply With Quote
Old 06-10-2008, 08:36 AM   #5 (permalink)
Forum Novice
 
Join Date: Jan 2004
Posts: 190
Default

No more information out there?
Stuby is offline   Reply With Quote
Old 06-10-2008, 08:55 AM   #6 (permalink)
Master of the Internet
 
Join Date: Mar 2006
Location: Germany
Age: 17
Posts: 14,770
Send a message via AIM to Suil Ban Send a message via MSN to Suil Ban
Default

Look at the A* implementation already present in RunUO...
__________________
go fish
Suil Ban is offline   Reply With Quote
Old 06-10-2008, 09:41 AM   #7 (permalink)
Ray
Forum Novice
 
Join Date: Jul 2004
Location: Switzerland
Age: 25
Posts: 234
Default

LongRange pathfinding is already implemented but limited to reduce serverload as its done in the main/game-thread.
However, you can remove this limt. But that can vastly decrease your servers performance, if you remove it completely.

To check for a tile as being impassable or not, take a look at the Map.CanFit method. There's everything you need. The TileMatrix itself is built out of Blocks, 8x8 tiles).
to get the block of 3000 216 you simply right-shift them by 3.
Code:
GetLandBlock(x >> 3, y >> 3)[((y & 7) << 3) + (x & 7)];
whereas the blue part gets the block and the green part gets the Tile out of the returned array.
However, CanFit() already does that.



For those of you who are up to greater things:
In fact, pathfinding would be a perfect place for multithreading because it could be easily separated to run in a thread -> theres only 1 input (starting position) and only 1 output (path to destination) without any steps between them. By using a multithreaded approach, the path could be as long as you need it, even across the whole map.

Theres only 1 backdraw: blocked positions, like dynamic items or mobiles, can change at any time. Theres currently no real way to get them checked in a threadsafe manner. Map and Statics are not the problem, but dynamic entities are. And blocking both threads with a lock() statement would be gross.

So you can either leave them unnoticed (only check for map and statics)
or
use a 'checkpoint'-approach. (the thread searches the whole map ans statics, but doesnt return a step-by-step path, instead it retuns every 10th step to be processed by the default wayfinding)
or
do some sort of a shadow-bit-map for the pathfinding-thread that updates occasionally (using 'Sector' to spy out when it should be refreshed).

Just some thougths. If i had the time, i'd probably go with the last one.

Good Luck!
Ray is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5