Thanks for your thoughts all. Dinger, great idea about marking already visited.. And you're right, a breadth first search would be better in this situation - but I can't see how to make it work crosswise instead of downwise without having nightmarishly complex data structures to store partial solutiuons. With depth first it's a simple iteration through all possibles, and only considering one possible structure at a time..
Just a note on (sigh) why simple solutions won't work for me in this case.
1) Sadly, I can't copy a mission that's like mine, because there aren't any ;D (big call, prepared to support it. Will post full mission description docco in Mission Ideas when it's more together and closer to beta.. ie, maybe never). Ok, I take it back, If there are any missions like this out there, let me know, I'd love to gut them for their code.. muhahhah.. *ahem*
2) Short description: It's a MP LAN TEAM-SECTOR-CONTROL mission (kinda) over the whole island, with full squads for each player. Played 5v5v0-5 with different objectives for resistance. East/West squads are: Command, Armoured, 1st Infantry, 2nd Infantry, Special Operations. Features reinforcements, garrisons, support and respawning into 2IC. Communicate with Papa Bear / Big Brother (command control for sides) via radio operators, radio tents. Purchase weapons, soldiers and vehicles for delivery to a controlled port, then automated convoy to towns (or helidrop for Spec Ops). PB / BB will offer airstrikes on confirmed laser designation. Can request airstrikes on enemy *locations* (ie, towns) via radio tent.
Victory is determined by: TIMEOUT = two? hours play
Complete Military Victory (hold all sites at TIMEOUT)
Partial Military Victory (hold all bases at TIMEOUT)
Technical Victory (points comparison)
Points, btw, are allocated for taking towns, but they provide points over time. Resistance achieve points for destroying enemy materiel (tanks, trucks, cars, air) and liberating towns.
These points are what you spend when you buy reinforcements and vehicles. Resistance can't buy vehicles, but they can buy weapons from arms traders. Oh, yes, I'm expecting this to require a dedicated server. *OH REALLY?* ;D
Ok, that's a short description! of the mission I actually have a 50 pg word file detailing all the above, actions, scripts etc for much of it. Working title: For Everon
Most of the above is easy, and simply a case of modifying scripts already in OFPED's database, like halo scripts, Dinger's funky 'catch laser dot anywhere' trigger trick, etc
3) I need to be able to find a path from anywhere to anywhere. Any town can be taken by any side. Convoys need to be ready to dodge. Just like real life.
4) The pathfinder can't modify global variables, can only read them, except for it's return values. That's becoz the basic place[] variable I refer to is the responsibility of several scripts to keep updated: garrison.sqs and advancedcapture.sqs. I don't want it updated to include only links to friendly towns, because I can get that information on each node with a function call (that's why I used getmarkercolor)
I like the backwards search idea too. It's a pity that user def functions are so primitive, and there aren't really any string tools. I have to use a single function to return the answer.
I'm pretty sure (now I've had some sleep) that my solution above will work - with a lot of work, as it's guaranteed to return the *best* route. It shouldn't be called too often - only if a soft target wants a destination.
Ok, I know fudge factors are a way of life due to the limitations of OFP scripting, but I want to use *as few as possible*.
I'm trying to make this as smart as possible, so that when the player pulls a blitzkrieg out of their military issue jockstrap and takes three towns, the AI supports them. If they order reinforcements, they will be delivered in a realistic - or at least consistent - fashion. That's what it's for. Five guys with a squad each do not a war make, and indeed, they only scratch the surface of the strategy that OFP is capable of.
It all needs to be as general as possible becoz the same routines will apply to each side, & I want it to still make some kind of sense when the player does something I never expected.
CE2, for example, is genius, but it's SP only, and what makes you think I want to be in *charge*? Sod that. I want to blow things up. I want to infiltrate past enemy patrols and satchel charge his convoys. I want to hide in the shrubbery and laser designate my brother's command T80, and give him a Maverick surprise. I want to cut supply lines, overrun defenses, steal enemy equipment, deploy snipers on enemy patrol routes, keep them on their toes.. and I want it all to contribute to the overall war. And all in MULTIPLAYER - so they're doing it to me too. Carnage.
Ok. No one is allowed to hassle me about when it's going to be done, or I'll give them some work to do on it
Something fun :p , involving long lists of X & Y co-ords.. *L*
Cheers all, and sorry for making you read so much incomprehensible crud..