Quote: "try a while / endwhile it might be a bit quicker but not much."
Nah, the for loop is faster in DBPRO;
why? because the for loop does not perform as many internal checks as the while, do and repeat loops.
Quote: "but if I replace the .dbo item with say the "Make object box" command, It still lags."
Use instance or clone object instead; loading and creating is always slower than not loading or creating anything; reuse what is already loaded or created. Use clone object if you do not want the object to depend on the existence and properties of its source.
As for loading, get most, if not all of what you need loaded during loading time; before the game begins.
Quote: "Or should I just try working out my own AI system? (Or any alternative to DarkAI?)"
Ditching DarkAI is up to you, but for me, reinventing the wheel while Ferrari drivers are roaring past, isn't my idea of a good way to spend life. Consider the thousands of lines of code to get your own system up to DarkAI standards, then the other code that actually creates the RTS.
To speed up DarkAI, you have to control how many AI entities are thinking at the same time. Right now you have 500 units trying to figure out if any enemies are nearby and whether they are colliding into an obstacle, and who they can or cannot see, and if they are enemies or friends, all at once. As standard the system is suitable for FPS with 9 or 10 AI in a number of rooms seperated into containers.
You need to organize your units into groups and containers to work best with an RTS; and disable containers when the AI inside them do not really need to be thinking about anything.
All in all, the RTS is a difficult genre to build on your own; and DarkAI needs tweaking to work with teams, unit types, formations and strategies. But with practice and research you can do it.