Page 1 of 1

Factory entrances

Posted: 03 Apr 2007, 17:05
by AF
How would I determine programmatically what edges of a footprint are factory exits?

Posted: 03 Apr 2007, 21:00
by Tobi
Guess you should use a mini pathfinder over the YardMap (Dijkstra's algorithm over this small kind of area can be implemented in very little code I think). Just find a path / the paths from the middle to "the outside" for open YardMap state.

Though I don't think factories really *have* to create their units in their center, I dont recall seeing any factories in any mods which didn't, plus it's impossible to access the model data / COB stuff through the AI anyway, AFAIK. So starting at the center seems a good approximation.

Posted: 03 Apr 2007, 21:06
by FLOZi
Just as a matter of setting you straight; few S44 factories have the units created in the middle.

Posted: 03 Apr 2007, 22:19
by Tobi
Just realised a true mini pathfinder isn't even needed, a smart scan of the edge of the YardMap plus some silly heuristics should be able to get you your answer (to check that it isn't e.g. an open corner not connected to the middle / wherever the units are produced).