Cycle detecting isn't so much hard as just annoying. Particularly when you have to work with data structures that are already fixed, and in a memory model that only really allows for static allocation if you want it to work with the saved game infrastructure. The real question though is what do you do when you detect a cycle? A cycle might be a real impossibility, in which case abondon the goal, and perhaps persue a backup goal, if any. It might be a temporary impossibility, and conditions will change that make it possible, such as through level triggers, or waiting enough time for collect some resource (ore, wreckage). Unless you're clear about what prerequisites are being checked, it's not obvious what constitutes a cycle, and whether or not it's a temporary or complete impossibility.
Also keep in mind how complex the rules of Outpost 2 can be. You'll probably want to deal with just a subset of possible cases to keep things simple.
Consider this: To build a structure, you need a convec loaded with a kit at the build site. This requires a convec with the kit that can path find to that proper location. To get a convec loaded with a kit you need an empty convec docked at an operational structure factory containing the kit so it can be loaded. This might require an empty convec that can path find to the desired structure factory. To make the structure factory operational you need enough power, workers, and a CC connection. To build the kit you need an empty cargo bay and enough ore, and the required tech to build the kit. If you don't have the right tech, then it needs to be researched. You may need to research multiple techs to get the desired tech. You might also need to build an appropriate lab to research the tech. You might need to train workers into scientists to have someone available to do the research. If there is no CC connection you might need to build a tube. If there is no deployed CC (land rush), you might need to deploy a CC stored in a convec. If there are no workers, you might need to idle another structure, or wait until you have enough workers. If you can't idle structures and need to wait for more population, then for your population to grow you need a nursery and university operational, and your morale needs to be half decent (or have lots of med centers). If you have no empty convec then you either need to empty one (build it's kit, unload it's kit, discard it's kit), or build a new convec. Now, to build anything you need ore. This requires having either an active storage facility containing ore, or a non-idled (but possibly disabled) smelter storing the ore. If insufficient ore is stored, then you might need to unload smelted metal in cargo trucks (land rush), or you need an active smelter, and cargo trucks containing ore. For this you probably need an active mine to fill trucks with ore (unless they are pre-filled, perhaps for a land rush using ore instead of metal). This might require building cargo trucks or robo miners at a vehicle factory (which requires ore). It might require simply deploying a pre-existing robo miner. You have a beacon surveyed, right? Or perhaps you need a robo surveyor to be built or to survery a beacon. This requires reachable beacons on the map. They exist, right? Ok, which one is the best to go for? Maybe there were cargo trucks occupied some other way. Perhaps their cargo can be dumped (rare, or rubble) and they can be repurposed. If the smelter isn't active then you may need people, or power, or a CC connection. Do you have enough tokamaks, or other power sources?
Now... suppose that original structure you wanted to deploy was the smelter. Or maybe it was the structure factory, or the vechicle factory, or the command center, or a tokamak. That makes things a little more cyclic. Do you have enough resources to complete the task in any given case above? Are you sure?
Did you notice some of the above required choices? If no empty convec is available, do you wait for one to become available, or do you build a new one?
Ok, now what order should you complete the tasks in? The wrong order can cause delays and might appear obviously dumb to a human opponent.
What algorithm do you use to place needed structures? Does it account for explosive buildings like advanced labs and spaceports? What about EMP from tokamaks. Does it place a command center or structure factory in a good defensive position? Does any of that really matter? I suppose it might be more fun if the computer built an advanced lab right next to a CC or SF.
Ok, what about other goals, such as launching a starship. You have 200 colonists right? What are the preconditions to getting 200 colonists? How does time factor into this, and what needs to be built? Is this goal set explicitly by the level designer, or is the AI more generic and figured this out using the victory conditions for the level?
At any rate, you're probably realizing by now why I never got anything done.
I've got quite a few written notes that suggest analysis paralysis may have been a factor. :blush: