Complete.Org:
Mailing Lists:
Archives:
freeciv-ai:
November 2002: [freeciv-ai] massive ai5 |
[freeciv-ai] massive ai5[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
I've spent a lot of time now cutting this beast down in size. I've removed some stuff that I wasn't altogether happy with and committed some parts of it that could stand on their own feet. The flying AI part is already committed. Version 4 was 185k in size, this one is in total about 100k. The rest I want to commit as a whole. It gets increasingly hard to disentangle stuff and hours required to do so per patch goes up. So Greg, can you look at it all and give thumbs up? :-) The important things to ok are: - The coupling of roles and goto data. - The ai_unit_goto() and ai_unit_gothere() API. - The use of (-1, -1) as invalid goto destination. ...since these important API changes. - Per Changes from previous version denoted by +, old changes by - This is a diff of my AI development tree. It contains the following: - A final cleanup of the bodyguard code, by myself - Active AI diplomats, by myself and Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx> - AI hitpoints recovery patch, by Jordi Negrevernis i Font <jorneg@xxxxxxxxxxx> It also contains a number of other cleanups throughout the code: - Don't bribe units that aren't a threat unless we have lots and lots gold, and even then don't bribe settlers - Removed inconsistent pcity->ai.ai_role which wasn't even used - Started rewriting the activity goto handling, hiding it behind sane wrappers. The problem with that is that some of the use of this code isn't sane... Changes restricted to aitools. + Wrapped the use of goto. Now goto destination should be set only when you set a role for a unit, and you know that a unit has a valid goto by looking at its role. The latter is not completed entirely since it requires more changes to code I want to dump. These changes are a lead up to my rewriting of the ferry code. - ACTIVITY_GOTO will be removed, do not use. Instead, check for valid_goto(punit) + A unit should *never* have a valid goto unless it is on its way somewhere by goto AND it has a role which requires it. Such roles will always have valid gotos. Do not use the valid_goto() hack. - Never call do_unit_goto() directly; this function will be rewritten later when we have new path finding - ai_unit_goto(punit, x, y) will *preserve* previous goto coordinates; use this only for one-turn-horizon gotos (only air units and diplomats use different gotos ATM) - Use ai_unit_gothere(punit) for long-distance gotos; this will be used for ferrying, and eventually should replace both ai_military_gothere() and the settler gothere. Always set destination with ai_unit_new_role() first! - Note that you can use ai_unit_goto() while on a ai_unit_gothere() mission, and the gothere() destination will be preserved. + Savegames now has new_goto_x|y for the new (-1, -1)-is-invalid- coordinate goto, keeping such coordinates out of the old goto field, enabling older servers to load our savegames. + Better target checking by settlers so that we avoid flip-flopping
aidiplomat.c
aidiplomat.h
massiveai5.diff.gz
|