AS the problem here relates directly to the ai being able to build things, and thus make the world more rich and full, i will attempt to keep this framework as robust as possible. and while discussing the properties of a management ai is outside the scope of this discussion, it does have some bearing here. with that said i will give you an example of a revised framework:
(~ denotes a comment, and is not part of the framework)
C:fort seedling
R:room2;brew1;crops9;carpenty1;masonry1
Q1
.
..d.d.ddddd.ddddd
..d.d.ddddd.ddddd
..d.d.ddddd.ddddd
..d.d.dd.....dd
.<dddddddddddddddddddddddd" ~step 1
.<dddddddddddddddddddddddd"
..dd..dd..dd...dd
..ddd.ddd.ddd.dddd
..ddd.ddd.ddd.dddd
..ddd.ddd.ddd.dddd
_______________
W1
.
........ppp
........ppp ~step 2
........ppp
_____
W1
.
............====
............==== ~step 3
............====
____
W1
.
.
.
.
. ~step 4
.
..............====
..............====
..............====
____________
W1
. ~step 5
..............$[pile:food]
_______
W1
.
.
.
.
.
.
................$[pile:wood]
__________
W1
.
.
.
.
.
.
.
.
.
....$[workshop:masonry]
_________
W1
.
.
.
.
.
.
.
.
.
.......$[workshop:carpenter]
__________
W1
.
.
.
.
.
.
.
.
.
...........$[workshop:brewery]
______________
Q0
.
..d.d.d.d
..d.d.d.d
..d.d.d.d
..d.d.d.d
.>ddddddd
.>ddddddd
..d.d.d.d
..d.d.d.d
..d.d.d.d
..d.d.d.d
_________
Q0
.
..B.B.B.B
.
.
.
.
.
.
.
.
..B.B.B.B
____________
Q1
.
..B.B
_______________
Q1
.
.
.
..D.D.DD.....DD
..........................D
..........................D
..DD..DD..DD...DD
___________
Q1
.
..$[define:bedroom]
_______
Q1
.
....$[define:bedroom]
_____
E
Ok, this one has a lot going on, but it defined a lot of things that the ai will need to know in order to be able to build a building in real time. i will go over he elements one at a time and discuss them, and their relation to the management ai.
first off, the title
"C:" is just the friendly, descriptive name. displayed to the player in game
"R:" tells the computer what it can expect from this building. in this case, 2 bedrooms (the other 8 are not defined, more on this later), a brewery, 9 farm plots, a carpenters shop and a masonry
this will be important for the ai as it will allow it to provide for the needs of the growing settlement intelligently. as it finds that it has units that are homeless it can build more rooms, if units are hungry it can build farms etc.
ok, so in step 1 we have:
"d" for dig
"." for keeping track of the grid
""" for defining a path-able point
that last one is important. it lets the ai know that this point in the building needs to be assessable, both before *and after* the building is complete. that is the tricky part right there. the way i figure it, each ai settlement will need to have a central point that must maintain connectivity to all other points in order for the settlement to function properly. i have no idea how to keep the ai from blocking existing building entrances, but this should at least keep the ai from placing a new building in an inaccessible place. if the central point is placed on a road that cannot be built on, it should also keep the ai from blocking itself off from the rest of the world. this may be the hardest part to code for the entire framework, as it will have to use the pathing code extensively (not necessarily A*, but a fill at least). i will leave further discussion of this to more intelligent minds.
in the second step we started it with a "W" instead of a "Q"
this indicates to the ai (or the players template) that this step does not have to be waited on. place the designation and move on to the next step without waiting for completion.
in this step we place a 9 tile farm and move immediately to the next step. the creature job ai will complete this at its own convenience.
in steps 3 and 4 we place 2 blank stockpiles.
in step 5 we designate the top pile as a food stockpile. i am using the "$" to denote a function, not a placement.
the function acts on the item or designation that is at that cursor location. this will be important for the ai because we can use it to tell the ai where things like bedrooms and food stockpiles are, as well as where to build workshops. it is the last part of the framework that i am going to explore in this post, but it allows you to set up a nice, complete building that either you or the ai can use, and allows the "job manager" or ai to do it in real time.
for those of you who think this may be overkill, think of what it would be like to stumble across a group of dwarfs on a road, and watch them start to dig in and start a new little fort right in front of you. or watch a human settlement start a new pub, and then com back in a month to find the pub there, complete with chairs, tables and a booze stockpile. or how about just being able to tell the ai what to build in world gen, like tall narrow apartment towers for the humies, instead of whatever they build now.
that and giving the player a very powerful building templet tool, to be used and abused in new and interesting ways. . . but that is only a secondary concern.