Solid Buildings

Talk about your new mod or map here

Moderators: bert_the_turtle, jelco

brice
level2
level2
Posts: 167
Joined: Fri Feb 23, 2007 6:04 am

Solid Buildings

Postby brice » Sat Mar 17, 2007 4:19 pm

lowell wrote:I had been using the "wall sections" to make the insides "solid" so as the Darwinians wouldn’t get stuck inside, plus virii can slip under walls.


The solidity of models is affected by the smoothness of the ground on which they are placed. I have one model which is solid when placed on a flat area, but permeable when placed on rough ground.

My test model is the Cylinder02 fragment from fuelstation.shp with the tank fragment lowered to ground level. The tank was never intended to be "solid" since it was up in the air, but it is perfectly solid on flat ground. It works best when the vertical panels are pushed into the ground a ways.

I am convinced that squads detect collisions only at their feet. If there is a small local gap between the bottom of a model and the ground, then squads can "enter" the building there. Once inside they can exit anywhere. The direction of the normals may be important too -- i.e. is the model sloping in or out at the ground contact.

Squads normally pay attention to the slope of the ground, and the slopes of ground triangles are the same "sign" everywhere. If your model has the reverse slope at ground level, then the squads my not respond properly. I think the building models probably get treated like they are terrain triangles for the purposes of collision detection. A single mode of interaction, so the code is simple. So make sure your model doesn't do things that terrain never does... at least not at the base where it must touch the ground triangles.

I haven't played with this much yet, but I'd be willing to bet that your models would become solid if you extend them down into the ground a bit more and fix any underhangs. Position the sceneroot origin above the base of the model. Most Darwinia models appear to do this, esp. the anthills since they are often placed on uneven terrain.

The render mode used in the shape files has nothing to do with building solidity. The anthills use triangles lists, while the Cylinder02 fragment above uses triangle strips. Both act solid when they contact the ground properly.
Last edited by brice on Sun Mar 18, 2007 12:34 am, edited 1 time in total.
brice
level2
level2
Posts: 167
Joined: Fri Feb 23, 2007 6:04 am

Re: Solid Buildings

Postby brice » Sun Mar 18, 2007 12:30 am

lowell wrote:I had been using the "wall sections" to make the insides "solid" so as the Darwinians wouldn’t get stuck inside, plus virii can slip under walls.

Uh, yeah my reading comprehension... so what I said above applies mostly to squads. I have been spending a little time with walls today and I don't understand them. They appear flaky.

The standard wall building works for DGs if one wall is placed by itself. But if two are placed near each other, suddenly neither one is solid for the DGs. If you pull out one box fragment from the wall shape, the same behavior occurs. One staticShape by itself will repel all DGs in a circular area. But bring two staticShapes together and suddenly the DGs can't see them.

If you pull out just one of the wall's post fragments, it sometimes repels DGs, but sometimes not. Once the DGs would walk around the post when approaching from one direction, but walk through it from the other. The post was alone, so it must have something to do with the geometry or the fragment coordinates... or Darwinia is just buggy.

When a group of walls is placed parallel (not end to end) with distance between each one, usually one wall will work, but the rest don't. Which wall works seems random.

lowell, did you have luck with multiple walls? Or were you placing a single wall inside your staticShape for the ring effect? I wonder why that worked for you, but for me two staticShapes cancel each other in the eyes of the DGs. I'm on linux 1.4.0b9 which is probably buggier than the others.
brice
level2
level2
Posts: 167
Joined: Fri Feb 23, 2007 6:04 am

Postby brice » Fri Mar 23, 2007 12:39 am

lowell, the reason your buildings are not solid is probably because you scale them from within Darwinia. I have discovered that scaled static shapes are usually permeable, while the 1:1 originals are solid. If you look closely at the way Squads run through your scaled buildings you will see they avoid the areas that would have been taken up by the 1:1 version.

I don't think you need to add strips to your buildings in order for them to be solid. Check out the base of the solarpanel shape. The core cylinder is solid even though it uses a simple triangle list. Interestingly, the ring of 5 control stations are permeable to squads but not to DGs. The squads see only the central cylinder.

Solidity also works with shapes that have "interior" open spaces. For instance, take the fuelpump shape and place it so a squad can walk between the legs. The legs are still solid. (You may have to adjust the vertical offset -- I was playing with an already hacked up shape file.)

-brice
brice
level2
level2
Posts: 167
Joined: Fri Feb 23, 2007 6:04 am

Postby brice » Sat Mar 24, 2007 11:11 pm

Related to building solidity is the DG exclusion zone. Squads, engineers, and officers deal directly with the shape itself, but DGs see only the exclusion zone. Wouldn't it be nice if DGs could walk between the tracklink posts? It is actually possible to control the size of the circular no-enter zone around static shapes. The size of the zone seems to be derived from two aspects of the shape itself.

First there is the aspect ratio as viewed from the sky. If you take one of the box fragments from the wall.shp and adjust the coords to give you a long long wall of the same height, then the exclusion zone will expand to encompass the entire length. This means there will be huge hemicircular no-entry zones on either side. Not good. Darwinia deals best with cylindrical shapes.

Second there is the extent underground. This is the interesting one, and it allows you to adjust the size of the exclusion zone around posts and columns. Extract the Cylinder01b fragment from the solarpanel.shp and adjust the vertical placement with respect to ground level. This can be done either by the position vector, or by adjusting vertex coordinates. It's the net render position that counts.

Code: Select all

Fragment: Cylinder01b
   ParentName: sceneroot
   up:     0.00  1.00  0.00
   front:  0.00  0.00  1.00
   pos: -0.77 22.50 -0.03
   Positions: 44
   ...


The distance the shape extends underground determines the size of the exclusion zone relative to the shape's cross section. Change the 22.5 to 0.00, -5.00, or -40.00 and you will see the DGs walk right up to the post, a small exclusion zone and a larger zone, repectively. The adjustment is non-linear. It scales the basic exclusion zone which is based on the shape's perimeter. When an Officer bounces off a shape, they will bounce out to the edge of the exclusion zone. DGs *can* be led inside the zone, but they will not stay without an officer.

This is great for single post shapes, but what about two posts, like the tracklinks? If you look at DG behaviour around the powerstation shape you will notice they can walk right up to individual sub-shapes -- it's not a big exclusion zone encircling the entire powerstation. Why is this? Because the shape file is broken up into several fragments. DGs avoid fragments that touch the ground. The two-legged tracklink is created from a single fragment, so the exclusion zone has to encircle the whole thing in one go.

If you remake the tracklink as two separate post fragments, then you can use the above tricks to make it so the DGs can wander between the posts, but not through them. For things larger than posts, the overall height factors into the basic exclusion zone, but the exact rules seem a bit murky. And any time you "sink" a shape to lower it, you will run into this exclusion zone scaling effect. Look at the rockhead.shp vs the rockheadd3.shp (or d4) from Reprisal. The angled rockheads have a greater exclusion zone, but this can't be helped without truncating the shape at ground level.

The zones for shapes that are bulkier than posts, like the fuelgenerator, don't scale as much when sunk. The scaling is most effective for post-like shapes. There seems to be some scaling of the scaling going on. Also strange is that a large spherical shape sunk to it's middle will have an exclusino zone equal to it's circumference. Aparently no scaling. But that's cool for dome buildings. Remember that exclusion zones *don't* scale with the StaticShape scale factor. Big shapes must be 1:1 to be solid.

Unfortunately none of these tricks can be used to make a better fence / wall shape. The exclusion zones around individual fragments still interact to form "holes" when fragments from the same shape or another one get close together. This problem may be unavoidable because the DG collision engine uses circles to represent buildings.. the vector "away" from a group of buildings will always become tangential (= hole) at some point if the engine simply "sums" their overlapping circles instead of trying to figure out the net outline.

Return to “Mod Projects”

Who is online

Users browsing this forum: No registered users and 11 guests