Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2]

Author Topic: Construction Hauling  (Read 1583 times)

Norseman

  • Bay Watcher
    • View Profile
Re: Construction Hauling
« Reply #15 on: December 13, 2010, 06:20:05 am »

I like this idea, but if you want to do it like that, Toady will need to make a system to decide where those items are going to be hauled. One obvious possibility is to haul things to the tile where they will be built. This wouldn't work for floors, but for walls, stairs, bridges and mechanical things it would be fairly effective.

Hauling for things you'll build in the air is a bit more difficult, but still feasible. For floors which are going to be built in places where you can't put anything, you'd need some algorithm to decide where to put stones. I think the best bet would be to automatically create an invisible stockpile which is the same size as the floor you're making + 5 tiles in each direction, and make the stockpile on the same Z-level as the floor, as well as at Z-level +1, and Z-level -1. The upper stockpile should only be made if there is a set of stairs or a ramp to go up within the stockpile area of the Z-level that the floor was built on. Likewise, the lower stockpile should be made only if there are stairs or ramps to get to the lower level within the area of the stockpile in the middle floor. Set the stockpiles to accept the building materials for any construction in their areas, as well as for their related stockpiles. Anything that would require objects to be moved out of the way, e.g. a wall designated for construction, would cancel that space for the stockpile.

For example, if you build a set of stairs on open ground, a stockpile would be created on the ground for the construction materials for those stairs. Once the stairs are built, if you wanted to build some floors on the next z-level up, and connect them to the stairs, a stockpile would be created on the ground below the floor, and on the stairs at the next level. As the floor gets built, the stockpile would expand to make use of the newly available space. If you also decided to build some walls on the ground level while you make the floors above, then the stockpile would expand to encompass the additional construction. As the construction is finished, it would correspondingly make the stockpile smaller and smaller.

When all of the materials have been moved to the construction site, or all of the structures have finally been built, the stockpiles would be deleted.

I'm sure there are some problems with this though. What should be done if the masons want to start building but the haulers have moved their construction materials? What if two different construction areas have overlapping stockpiles?

Edit: One other thing we'd need to watch out for is that the stockpile should be a contiguous area. You might be building on top of a wall, and you'd want the stockpile on the ground to be on one side (the safe side!) of the wall, and not the other. If the stockpile simply goes everywhere around the construction site, you'll have workers carrying your building materials to the wrong side of the wall, outside of your fortress, thus forcing your masons to walk out of the fortress, around your wall and back again to get the building materials. If the area is not contiguous, the stockpile should avoid using any squares that cannot be reached by staying inside the stockpile rectangle and walking from the things you're building.

This might use up a bit of CPU power, but, since the game pauses when you're doing construction anyway, I don't think it matters.
« Last Edit: December 13, 2010, 09:45:01 am by Norseman »
Logged

Norseman

  • Bay Watcher
    • View Profile
Re: Construction Hauling
« Reply #16 on: December 13, 2010, 10:27:00 am »

I realize the above post is probably a bit difficult to read, so I'll illustrate what's involved here.

Suppose we have a wall at ground level, like follows:


.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'
.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'

=======================================
=======================================

.`'.`'.`'.`'.`'.`'.`'.`'.`^^^.`'.`'.`'.`'`'.`'.`'.`'.`'.`
.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'


Grass = .`'
Wall = ===
Upstairs = ^

Now, on top of that wall, at Z-level +1, let's say we're building some fortifications for our marksdwarves to shoot from, like follows:

                               FFFFFF
+++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++
                                vvv


Fortifications under construction = F
Top of the walls = +
Downstairs = v

In this case, we'd start by making the stockpile on top of the wall, so, now the following areas would be made into a stockpile.
                               FFFFFF
+++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++
                                vvv

Naturally, areas that aren't walkable would not be included in the stockpile. Now, we can't go up, so we skip making a stockpile on a higher level. However, we can go down, so we make a stockpile on the ground. Obviously, we can't put a stockpile inside the wall, so we'll skip that.

.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'
.`'.`'.`'.`'.`'.
`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'
.`'.`'.`'.`'.`'.
`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'
.`'.`'.`'.`'.`'.
`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'
.`'.`'.`'.`'.`'.
`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'
.`'.`'.`'.`'.`'.
`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'
.`'.`'.`'.`'.`'.
`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'

=======================================
=======================================

.`'.`'.`'.`'.`'.`'.`'.`'.`^^^.`'.`'.`'.`'`'.`'.`'.`'.`'.`
.`'.`'.`'.`'.`'.
`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'
.`'.`'.`'.`'.`'.
`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'
.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'


Now, if we try to path from the fortifications to that area in front of our wall, and if we try to stay inside the stockpile we designated, we'll find that there is no path. We simply can't get there. So, we eliminate that section from our stockpile, like so:

.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'
.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'
.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'
.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'
.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'
.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'
.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'

=======================================
=======================================

.`'.`'.`'.`'.`'.`'.`'.`'.`^^^.`'.`'.`'.`'`'.`'.`'.`'.`'.`
.`'.`'.`'.`'.`'.
`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'
.`'.`'.`'.`'.`'.
`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'
.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'.`'


That would be the finished hauling area, including that section up on the top.

Our haulers will now bring stones to either of the black areas on the ground level and on the floor where we designated the construction of fortifications. As the fortifications get built, we'll make the area smaller. If any new constructions are placed in the stockpile's area, the stockpile will be made larger to accommodate them.

Now, there is a danger that the construction area is made too large, or that the player adds more construction to the left and right, and makes one huge stockpile instead of two small ones. To deal with this, if any auto-stockpile is longer than 20 squares in any  direction, it should be split into two stockpiles.

Two neighboring stockpiles should spread towards each other up to their maximum of 5 squares. If they overlap, then they should take turns going one square back until they no longer overlap. If they overlap, but don't actually need any of the same squares (for example, if there's two construction projects on the opposite sides of a wall), then they should simply permit the overlap until they need to decide who gets to use a square they both want, by taking turns going back.
Logged
Pages: 1 [2]