I'd rather have simulations and real combat use the same model. It'll make less code if anything.
I found another thing which causes slowdowns: Some plans looks for the nearest unit, and these scan all the task forces every time. This means if the ai has 12 TFs and you have 10, it will compute distances between its own TFs 12*11 times, and between his and yours 12*10 times, for a total of 12 * 21 computations. Considering it doesn't see all of the player's units, it shouldn't do all the computations. Considering some units are in the same squares, it shouldn't compute paths to the same square several times. And it shouldn't compute path A-B once and then repeat with B-A. I'm not sure exactly how I'll fix that, but it looks like I can get rid of the quadratic, or at least most of it, if I can handle things correctly. This should hopefully speed the ai enough for me to work on something else.


Reply With Quote

) but at least it's purely strategic. If I can express the value of a unit as its ability to take a square, and the value of a square as its ability to allow taking of another square (typically a square is worth what its neighbours are worth + map ai value for chokepoints etc. so it has an "influence"), I'd have the same unit of measure, which would help me a lot. By default 1 square is worth 1 strategically, and 1 unit is worth something only in comparison with other units, so it's probably a ratio: 1 unit stronger than another is worth 1, the weaker is worth 0. Since the winner will suffer losses and can win with only a given probability, its value is probably only 0.8 so the loser is worth 0.2. This value depends on the opponent, so it's very interesting to attack a weak enemy because my military value won't fall, while attacking a strong one is suicide and it's shown by a 0 or almost 0 strategic value... (needs refining)
Bookmarks