Question; is the math.random responsible for the utter slowness of placement? AceBot (not the real name) won't use complete random placement like the current AI does, but will use a very limited random placement, and I'm looking for a much faster way to get all units on the board.
Edit: I've worked out how to place all units in about *2 seconds, but for the life of me can't work out how to use SetState(), not sure how to obtain specific unitID's and/or the proper format to use.
*Instead of looking for a random place among the entire globe, narrow it down to specific regions, depending on the territory (and eventually depending on opponent/s territories).
I'd like to have a Bot up and running by next week and I should have most of Thursday to work on it (probably some tomorrow too) assuming I can get past this snag. Remember, I have absolutely no idea what I'm doing.
For example; instead of:
Code: Select all
while GetRemainingUnits("AirBase") > 0 do
SendChat("Deploying forces")
while true do
local x = math.random()*360-180
local y = math.random()*360-180
if (IsValidPlacementLocation (x, y, "AirBase")) then
PlaceStructure (x, y, "AirBase")This: (the basic location of the whole African land territory, will be more specific, but you get the idea)
Code: Select all
while GetRemainingUnits("AirBase") > 0 do
while true do
local x = math.random(-16.1,50.1)
local y = math.random(-34.5,37)
if (IsValidPlacementLocation (x, y, "AirBase")) then
PlaceStructure (x, y, "AirBase")
Of course, as I said above, eventually I only want the first ground unit (Silo) to be a pseudo random position and everything after that around it,based on all the players territories. There's only 30 possible 1v1 combinations, so it shouldn't be that hard.
