EnglishGermanFrenchRussianPolishItalianSpanish
Log inRegister
 
[Script] AStar Pathfinder v1.3 (Mar 3)
Post new topic Reply to topic Goto page 1, 2, 3, 4, 5  Next
View previous topic :: View next topic
Author Message
AalaarDB





Joined: 29 Jan 2004
Posts: 2279 on topic

Thank you for registering your game
modified
PostPosted: Tue, 22. Nov 05, 03:32    Post subject: [Script] AStar Pathfinder v1.3 (Mar 3) Reply with quote Print

AStar Sector Pathfinder Commands
This stand-alone script pack has the ability to drastically alter your game, hopefully for the better! Your ships will no longer fly through Enemy sectors, as long as there is a decent alternative!
Quick, someone tell me what is the default path from Bad Debt to Hativah's Faith? If you said through the Paranid sectors, then through Pirate sectors you'd be correct. This isn't a very safe path, and even worse if the Paranid's hate you!
The AStar path from Bad Debt to Hatikvah's Faith goes through the Boron and Argon sectors. It's much safer, and a mere 30k (7%) longer!

This script pack overrides the default commands Dock At and Move To Sector - and replaces them with my AStar commands.
Even better, you control how things work! (see FAQ)

FAQ:
What is AStar?
It is a fast pathfinder that is guaranteed to find the 'best' path. Best here is subjective, because by defualt I've made it a blend of length and safety. The default Egosoft paths are only length and no safety.

What do you mean by 'decent' alternative?
If there is a safe path that is 3 times longer than the unsafe path, this is not decent. The ratio is 1.55 times longer.

I want to edit the variables, what should I do?
Open up your script editor, and open the file ADB.AStar.GetPlayerCosts. You may edit the 4 numbers at the top, but it is recommended you only edit the FOE number. YOU MAY NOT EDIT ANY OTHER SCRIPT!

I want to have different costs for different races of the same type, because Xenon and Khaak are more dangerous than Pirate, what should I do?
V1.1 has added this ability. Simply edit the races one by one in the middle of the script inbetween where it says to edit. Follow the example and you should be fine, but there is a backup included.

What if I've killed the Argon and Boron so they are hostile to me, but the Paranids are neutral?
In the example, the path would be different. Paths are calculated based on your current relations with races.

Will this slow down my computer?
A very tiny bit. I highly doubt it would be noticable, even under heavy load.

I want my transports to avoid enemy sectors, and my combat ships to enter enemy sectors, can I do this?
Unfortunately no. Enabling this would make things just too complex.

In what other ways will this affect my game?
Your ships will use the AStar paths even when not issued the order. This can happen when using other scripts, for example any that use the command START Ship Command_Dock_At Station....

Can the NPC ships use this?
By default no. Each path takes cpu cycles to calculate, and it isn't necessary for the NPC races to basically 'waste' that. However, you can enable this by editing the setup script and replacing the TRUE with FALSE.

Can I edit other files?
Only if you know what you're doing, or don't know and want to learn. Pathfinding is a touchy subject and minor editing can break it.

I'm a scripter, can I include this in one of my scripts?
Yes, just say the pathfinding was written by me. You can look at a custom implementation in the Station Manager by Burianek and myself.


Old Post:
AalaarDB wrote:
For AStar's first debut it has gone through some minor changes.
AStar now includes a Request Path function, making it easier to use the algorithm. Please call Request Path instead of the algorithm. There is also the Get Default Race Costs so you can ..... The returned path no longer includes gates. There is a Fly to Station command that uses AStar, but no Fly to Sector - I got lazy. I removed the caching part; I didn't like it. It was too complex and didn't save enough cpu cycles. You can still calculate a path in 1/20 of a second, and even long paths are computed smoothly.

*Distance Calculator is now included in the AStar zip.*
The distance calculator takes 2 objects or 1 object and a sector and finds the distance between them in meters, even across sectors!

AStar Pathfinder:
Sometimes the pathfinding can be annoying. True it is fast, but that's because it's precalculated. The game only shows the shortest route, and all too often this is through some enemy sector where your unarmed traders have no chance. The A* algorithm, however, is different. It is guarenteed to find the "best" path. Please note that best is subjective. It could be the shortest, or the safest, or somewhere inbetween. But the beauty is that that is controlled by you, the script writer. If you are writing a script for a universal trader, then you can set it up to avoid Xenon sectors. Or a pirate script might be willing to take some chances for increased profit.

How A* works is beyond explaining inside of a readme. Visit here: http://www.gamedev.net/reference/articles/article2003.asp for a beginner's tutorial. You don't have to read this to use the script, although it helps.

I've done my best to make it easy for you, so you don't have to know how it works. But the script won't run as is. To run, it needs customization from you; actually there are only 2 scripts you need to customize, which are GetSectorCost and CalcH. But then to distribute these and not have one A* customization clash with another you must rename these customizations - and every script that calls them.

After you've read the above link maybe you're still confused, and that's ok. It's really simple. All you have to do is determine how much it costs to move inside of a certain type of sector and pack this into an array. Don't forget to pack into the array what race the ship is so that you can tell which sectors are friendly, and any other variable you need! For example, it costs 1 unit to move 1 km through a friendly sector, and 5 units to move 1 km through an enemy sector. The smaller the number, the better this sector is. Then, alter the GetSectorCost script to your data. When you do this, you are setting the "G" value(s). You also need to set a cost for sectors whose type you don't know in advance. This will be the "H" value, although it is called the DEFAULTCOST in the script. Go ahead and make your own and delete that one. The H value should be near the minimum cost of a sector. For example, if we are using the above G values, then H should be the cost to travel through the shortest, most friendliest sector. For tips on setting the "H" value see: http://theory.stanford.edu/%7Eamitp/GameProgramming/Heuristics.html

Experiment with different values until you understand it and get the best results. The A* algorithm is one of the fastest "best path" pathfinders, and the fast binary heap should help, but since it's a script it's still slow. Don't run this too often, and try to cache results. It's probably not as slow as I make it out to be, but still.

Binary Heap Sort (already included)



_________________
My Scripts


Last edited by AalaarDB on Sat, 4. Mar 06, 08:55; edited 27 times in total
Back to top
View user's profile Send private message Send e-mail
Sandalpocalypse





Joined: 02 Dec 2003
Posts: 3935 on topic

Thank you for registering your game
PostPosted: Mon, 28. Nov 05, 11:21    Post subject: Reply with quote Print

Was looking for some other stuff, thought this might be worth a bump!

Back to top
View user's profile Send private message
AalaarDB





Joined: 29 Jan 2004
Posts: 2279 on topic

Thank you for registering your game
PostPosted: Mon, 28. Nov 05, 11:37    Post subject: Reply with quote Print

Yeah, only 3 people have downloaded this, maybe it's too early...

Back to top
View user's profile Send private message Send e-mail
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)



Joined: 15 Nov 2004
Posts: 20417 on topic
Location: London
Thank you for registering your game
PostPosted: Mon, 28. Nov 05, 12:36    Post subject: Reply with quote Print

u'll just have to wait until ppl start making scripts that will actaully utilise this

i sugguest you put a link in the tutorials section or something, coz it will definatly be handy in the future


_________________
My Scripts | MY X3TC Scripts | X3 Plugin Manager | Custom Gui
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
AalaarDB





Joined: 29 Jan 2004
Posts: 2279 on topic

Thank you for registering your game
PostPosted: Thu, 19. Jan 06, 11:00    Post subject: Reply with quote Print

Bump for release.


_________________
My Scripts
Back to top
View user's profile Send private message Send e-mail
Dgn Master





Joined: 27 Feb 2004
Posts: 1228 on topic
Location: Kelowna, B.C. Canada
Thank you for registering your game
PostPosted: Thu, 19. Jan 06, 14:07    Post subject: Reply with quote Print

Well i'll be the 4th then Smile .. always interested in seeing what can be done to increase the life expectancy of freighters that i order from the split. I'll let you know in a few days how it's working out for me.


_________________
Could the parents of the little Argon girl, Suzie, please claim her sealed jar of remains?
She didn't mind the gap and ended up vapourized!
Back to top
View user's profile Send private message
Sutore





Joined: 02 Nov 2005
Posts: 95 on topic
Location: Deepest Wiltshire
Thank you for registering your game
PostPosted: Tue, 24. Jan 06, 16:08    Post subject: Reply with quote Print

Just one small bug - since installing the scripts, I can no longer dock at stations (yep, including friendly ones . . . )

Now in process of reinstalling X3 Sad


_________________
Always keep an open mind - there are things far more wondrous than you can dream of.
Back to top
View user's profile Send private message
arcana75





Joined: 02 Dec 2003
Posts: 2158 on topic

Thank you for registering your game
PostPosted: Tue, 24. Jan 06, 16:43    Post subject: Reply with quote Print

Am I correct to say the script auto-checks your current race relations (and maybe FF settings) and calculates the "best" path?

If so, maybe it would be a good idea to add a command like
"Safely Dock At ...",
"Safely Move to Sector ...",
etc... maybe replace "Safely" with "AStar", like "AStar: Dock At ..."

That way players would install this script and be able to choose between the default ones and the new AStar ones. I'm not sure a battle fleet needs to avoid a hostile sector Very Happy


_________________
Nanite Hull Repair, Resource-Free Factory, Collect Wares Mk 2, Remove Products from Docks, Hack Station
Back to top
View user's profile Send private message Visit poster's website
AalaarDB





Joined: 29 Jan 2004
Posts: 2279 on topic

Thank you for registering your game
PostPosted: Wed, 25. Jan 06, 01:19    Post subject: Reply with quote Print

Bump for update.
Fixed not able to dock at stations in the same sector (stations in different sectors ok)
Changed to use XScript Installer


_________________
My Scripts
Back to top
View user's profile Send private message Send e-mail
Fachtna





Joined: 03 Feb 2004
Posts: 717 on topic
Location: Edinburgh, U.K.
Thank you for registering your game
PostPosted: Wed, 25. Jan 06, 21:28    Post subject: Reply with quote Print

i am scared to download this Smile

I have a few scripts installed, a coupel of LV's and all Cycrows. They work seamlessly together (as far as i can see) and dont wanna chance upsetting it.

i remember the torture i had in x2 with people using duplicate entries in the wares list etc, and really cannae be bothered going through that again.

If your scripts will integrate seamlessly, I am all for it

Back to top
View user's profile Send private message MSN Messenger
AalaarDB





Joined: 29 Jan 2004
Posts: 2279 on topic

Thank you for registering your game
PostPosted: Thu, 26. Jan 06, 00:52    Post subject: Reply with quote Print

Seamlessly


_________________
My Scripts
Back to top
View user's profile Send private message Send e-mail
Malakie





Joined: 13 Apr 2004
Posts: 637 on topic
Location: USA
Thank you for registering your game
PostPosted: Thu, 26. Jan 06, 02:25    Post subject: ;) Reply with quote Print

FIrst time I have seen this.. adding it to me list! Now maybe I will not loose so many ships...

Malakie

Back to top
View user's profile Send private message
AalaarDB





Joined: 29 Jan 2004
Posts: 2279 on topic

Thank you for registering your game
PostPosted: Fri, 27. Jan 06, 03:47    Post subject: Reply with quote Print

Bump for v1.1
It converts to use the XScript Installer.
Fixed a problem with docking at stations.
You now have greater control over editing the costs for each race.


_________________
My Scripts
Back to top
View user's profile Send private message Send e-mail
Stevio





Joined: 04 Jun 2005
Posts: 1983 on topic
Location: Kent, England
Thank you for registering your game
PostPosted: Fri, 27. Jan 06, 14:50    Post subject: Reply with quote Print


this is what gets extracted after download???

What kind of file is this meant to be. is this correct???


_________________
My Scripts

So say we all!
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
xeon_1





Joined: 04 Dec 2003
Posts: 1424 on topic
Location: Belgium
Thank you for registering your game
PostPosted: Fri, 27. Jan 06, 14:58    Post subject: Reply with quote Print

it say in the file name wath you need to do just remame it with this at the end .zip


_________________
Intel I7 920 D0 12GB DDR3
Radeon 4870x2 Creative audigy 2 zs
EVGA X58 SLI Classified E759 limited edition
3x WD Velociraptor 300gig in raid0
Areca 1222 with 8 F4EG 2TB in raid6
All watercooled.
http://kerbalspaceprogram.com/ getting to the mun
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic Reply to topic Goto page 1, 2, 3, 4, 5  Next
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum
Control Panel
Login Data
The time now is Fri, 20. Jan 17, 09:52

All times are GMT + 2 Hours


Board Security

Copyright © EGOSOFT 1989-2009
Powered by phpBB © 2001, 2005 phpBB Group
Template created by Avatar & BurnIt!
Debug: page generation = 0.42272 seconds, sql queries = 30