Ok i need a bit of design advice.
I'm currently working on the ai code to my game. I've split the logic up it into various stages. I've done the tactical and capturing stages and i'm currently working on the recruiting stage.
Basically you get money for capturing towns. Your commander unit is the only one which can recruit new units, and must be on a keep tile to do so. New units when bought are spawned on connecting castle tiles. It's a copy of the Battle for Wesnoth system which i prefer over other tbs games.
Right now i simply have a routine to work out which units to recruit based on the enemy units on the board.
I loop through all the enemy units, record their weakest stats in a list, loop through the ai units, for each one that can beat an enemy unit in battle i delete it from the list (as they will move and attack them in the tactical stage). What's left in the list are all the enemy units the ai needs to recruit against as it currently has no units on the board that can beat them in combat. I then prioritise their creation by finding the enemy units, that are the biggest threat, that the enemy has the most of, and recruit a unit that can beat it in combat first.
My problem is i have a number of variables the ai needs to take into account to decide - when to move to a keep, which keep to move to, and what units to recruit.
Heres how my system works. It's a work in progress so other variables can be added later to improve it, but for now i use the following-
Check to see if ai has any money, if not then skip recruiting.
Check to see if any empty keeps with empty castles are in move range, if not then skip recruiting.
For all those keeps within move range, that are empty and have empty castles, generate the following scores.
The distance of keep to Commander.
The number of empty castles keep has.
The number of enemy units in attack range of the keep and the combined damage score it could inflict on commander if it moved there.
The units the commander needs to recruit to oppose each of those enemy units, and the combined cost.
Whats the best method to use and combine the information i have to pick the best keep to move to and which units are a priority to recruit?
For example, the commander obviously wants to move to the safest keep, but that might only have 1 castle connected to it, where as it might have enough money to recruit lots of units.
I guess i'm wanting to figure out a way to somehow combine all these values into one general score or something.
Any suggestions or advice?