I spent the last day or two working on a entirely new AI feature for Nicowar. The new, revision 3 Nicowar possesses the intelligence to detect when its enemies have become enclosed entirely in ressources, blockading its access in. But, not only does it detect this, it has the smarts to *dig them out again*!! This is more of an AI vs AI thing, but the same code will cause Nicowar to dig itself out in the event that all of its buildings are locked inside ressources.
I have yet to work out the kinks, but you can see the code in action by doing modifying FourSquares so that all of the enemies bases are locked in with ressources. After building up its army, you will see Nicowar place a clearing flags from the outside inward to the building that it wants to attack. Unfortenetly, development of this has come to a halt after I realized the unit allocation system is just plain broken: Even though there are numerous units rolling arround with swim level 1 and nothing to do, none of them go to the clearing flag. They just roll arround and consume food for no reason. This bug has been talked about, and a fix had been started in another branch. But its since been forgotten about. So, I'm going to rewrite the unit allocation system myself. The new system works like this: 1) The focus is on the building, the building chooses the unit 2) Every tick (or so), buildings are prioritized, and higher priority buildings (eg Inn) get first pick 3) The chain is worked down untill every building is satisfied. 4) The unit remains working at the building untill it can no longer work there or the building lays the unit off the job This fairly simple set of rules has the advantage that every unit will be used if it can be used. No playing arround. No bugs. Just pure, simple allocation. It can have some surprisingly intelligent results. Prioritizing the buildings doesn't have to be simple. Building priorities can be based on 1) The type of building (eg Inn has higher priority) 2) User settings (the low-medium-high buttons that have already been discussed) 3) The number of units already working at the building How a building picks a unit doen't have to be complex. Units with the ressource that the building needs comes first (unless the task at hand isn't collecting ressources), and after that the closest unit is picked. Minimizing the complex rules is meant to minimize bugs and maximize the result. The only complexity in this system should be how buildings are prioritised, but even that is simple, clear, concise code. -- Really. I'm not lieing. Bradley Arsenault. _______________________________________________ glob2-devel mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/glob2-devel
