Jump to content
Sign in to follow this  
DualJoe

Any tips on optimizing a large building?

Recommended Posts

Because I found the choice of large buildings with working interiors in the editor a bit limited, I've decided to try my hand at modeling some buildings of my own. Now I've had some experience with 3d-modeling in the past, but this is my first try at modeling for the arma-engine, so bear with me if I ask/say something stupid.

For my first model I let my army-buddies convince me to make the castle of the Dutch Royal Military Academy. The building is rather large en complex (compared to the standard ones in arma) and I'm a bit stuck in planning a way to prevent bogging down the engine. I don't know enough about the internal workings of the arma-engine and I can't seem to find the info on the biki or this forum. I'm talking specifically about geometry culling and the LOD-system and if it works inside a single p3d-model.

There are a couple of methods I've come up with that might do the trick.

Ideally I'd like one p3b-file so that I can create one single path-LOD and memory-LOD for the AI. Which isn't a problem if the arma-engine supports some kind of geometry culling inside of the model/p3d itself, or does it only support geometry-culling between seperate objects.

I reckon that cutting up the model will allow the engine to render different parts of the model at different resolutions, or not render them at all, but I'm not sure how to do it. I'm trying to work out if sections and/or proxies would do the trick. Searching the forums sofar seem to suggest that sections would only hurt performance.

The last method I can come up with is to cut up the model and export it as separate p3d files and align the separate parts in the editor. From what I've read sofar this would certainly allow arma to use occlusion-culling and even different LODs for the separate parts. However, will it still be possible to have the AI move from one part of the building to the other? Is there a way to connect AI-paths between separate objects?

Any insights or tips on the matter would be greatly appreciated.

Screenshot of the building in its WIP-state

kma13.th.jpg

Share this post


Link to post
Share on other sites
I'm talking specifically about geometry culling and the LOD-system and if it works inside a single p3d-model.

There is no culling inside a single model, if the model is shown, that lod is what is shown in its entirety (also the geometries are calculated in their entirety too)

Ideally I'd like one p3b-file so that I can create one single path-LOD and memory-LOD for the AI. Which isn't a problem if the arma-engine supports some kind of geometry culling inside of the model/p3d itself, or does it only support geometry-culling between seperate objects.

Sadly 50x50x50m is the largest single object which can be supported 100% within the game (you can go larger, but you'll get culling issues - the whole object will be culled - if there is any model parts greater than 25m from the model origin.

The last method I can come up with is to cut up the model and export it as separate p3d files and align the separate parts in the editor. From what I've read sofar this would certainly allow arma to use occlusion-culling and even different LODs for the separate parts. However, will it still be possible to have the AI move from one part of the building to the other? Is there a way to connect AI-paths between separate objects?

This is what you're going to have to do. I'm not an expert on paths, but it is certainly possible to make it work, you just have to get your in and out points set up correctly.

Share this post


Link to post
Share on other sites

Thanks for the info DM.

50 meters maximum, ouch, that's cutting it pretty close, literally.

The largest room is 55 meters long. Ah well, I guess it won't hurt to scale the model down a bit. I doubt anyone will notice that the building is at 90% scale. Actually I kind of suspect the soldier models aren't very tall so that should probably even things out a bit.

This does make process a lot more complex though, what the hell have I gotten myself into.

So overlapping the in-points of separate objects would make the AI cross from one separate part of the building to the next? Even if the in-points aren't on ground-level?

Oh yeah, about the origin. Does that point have any requirements? Does it have to be the on the ground or at the center of the object or anything like that?

Share this post


Link to post
Share on other sites

I dont know about the in/out points, it isnt really my area of expertise.

As for the origin, when you open O2 there is a grid with the 3 main axes marked in red, where these cross is the origin, and should be considered as the center of the model at ground level (or slightly below ground level).

Take a look at the sample buildings from ArmA1 (process hasnt changed there) to see exactly what I mean.

Share this post


Link to post
Share on other sites
50 meters maximum, ouch, that's cutting it pretty close, literally.

The 50m 'rule' about 'chunk' volume should be viewed as a 'maximum' but sometimes with particularly large or complex structures you'll find this 'rule' needs to be adjusted down somewhat and there is no 'calculation' to workout what this should be only 'instinct and experience'. Well, none that anyone that would know has cared to pass on.

Sometimes people have found 'things don't work' on a 'chunk' till it gets down to about 40m.

Actually I kind of suspect the soldier models aren't very tall so that should probably even things out a bit.

1.8m tall for a standard character. Zero on the Y-axis in O2PE should be thought of as 'ground level', yes.

Have fun!

Share this post


Link to post
Share on other sites

Okay here's another idea I came up with after mucking about in O2 and buldozer. I noticed that models can be very large, despite having graphical issues.

Does the culling affect the AI-elements of the model? Is it possible to make one large model just for the AI that does not suffer from the volume limitation? It can be invisible and very simple for all I care, just the bare minimum for AI-pathfinding to work.

The visible parts I can then recreate out of small elements, which can placed and aligned via script/editor.

Would make the modeling part a lot easier for me, because that's pretty much how I've got the model setup in Blender anyway. This would allow me to concentrate on very simple objects to unwrap, texture and make LODs for.

If this is possible, I can imagine it would be very simple to create a partial destructible building this way. Or at least destructible elements.

And there could be tons of uses for this in multiplayer missions. Like having to breach a wall to gain entrance to parts of a building, or closing off a route, stuff like that.

EDIT

Is there some kind of relative resolution limit in the arma-engine?

I've noticed that for a model of about 100 meters 10 centimeters is about the max level of details allowed, before buldozer start giving "too many vertices" warnings. But if I scale the model up or down, that minimum detail-level scales with it.

Edited by DualJoe
noticed something

Share this post


Link to post
Share on other sites

I'm running into a little snag.

I've got a working model for the ai, including paths with the in- and pos-points and all. When I place a unit inside the model and order ai-units to move to that unit, they follow the paths as they should.

However, the pos-points don't seem to work. The option for ordering units to move to a particular position inside a building never appears. Also setPos on a particular buildingpos doesn't work either.

Am I missing a step or config-file for activating pos-points? As I said the path itself is working and so are the in-points. Units will enter the building and climb stairs to walk to a target on the upper floors. But I'd like to be able to order the units to a particular position with the reticule.

Share this post


Link to post
Share on other sites

Is the model binarized or did you pack it for the game as an mlod?

Planck

Share this post


Link to post
Share on other sites

I finally managed to figure it out, it was the editorupdate addon. It seems the editorupdate messes up the configs for buildings. Took me ages to figure this one out.

Things I discovered sofar (in case someone else runs into similar problems):

Don't use the editorupdate addon, use createVehicle or add your addon to objects or another existing editor-category.

For the ai to work you need, as a minimum, the following LODs: geometry, path, roadway. And there are a couple of things you need to watch out for in these LODs.

The geometry-lod seems to serve a couple of uses for the ai. It's the thing that makes the move-to-position-option come up when you point the reticule at it. But it also seems to define the area for the ai to work inside. See path-lod for further explanation.

The roadway-lod is extremely sensitive to height, make sure that ramps/stairs start below groundlevel. Even if it's just a centimeter above ground the roadway won't work and you can walk straight through it.

Path-lod; make sure that your in-points are outside of the circumference of the geometry-lod. I only used a geometry-lod for the roof 15 meters above ground, but when I ordered my ai-units to enter the building they still seemed to run into it while on the ground. Consequently they were unable to reach the in-points I had put in front of the stairs. When I put the in-points outside of geometry-lod the units entered the building and climbed the stairs without any trouble.

I still have a couple of quirks I can't solve. When I order my ai-units to move in the vicinity of the building they seem to follow the paths even without me ordering them. However, when the ai units are inside the building and I order them to move to a position far away, instead of following the paths some of them prefer to walk straight to that point. The result is a nice lemming imitation from units on the upper floors. I admit it's very amusing, but I haven't got a clue on how to prevent it. Even more puzzling, not all units kill themselves, about half of them have no trouble using the stairs.

I'm also having problems getting the ai to respect the geometry LOD. It works fine for my player character, I can't walk through walls and shooting it leaves a nice bullet-mark, but the AI just walks straight through it. This could be a arma-feature however, I've noticed ai walking through objects before. I think the issue can be masked somewhat with the path-lod.

All in all it looks like I found a way around arma's size limitations. I can make an invisible large model for the ai and all the visual stuff I'll make with separate smaller modules. Similar to what BIStudio did with the barracks in Bagango.

Share this post


Link to post
Share on other sites

Interesting thing about the 'invisible' large model. Thx for sharing. :)

So, if i get this right:

- you have modelled a very big but invisible building just to define paths for the AI

- you align several (visible) models as an illusion for the human players

How does the collision lod work? If i shoot your building, do i hit one of the single parts or the big invisible part?

Edited by ])rStrangelove

Share this post


Link to post
Share on other sites

I haven't put my complex model in the game yet, so I haven't tested the final version. However it seems to be working just fine already, eventhough the ai walking and standing on thin air looks a bit silly at the moment.

About shooting, you'll hit the first geometry-lod in the bullets path. So if you've made a geometry-lod for the smaller visible parts it will hit that.

The thing is, I still wanted the building to function as a single building like the hotel. Also nearestBuilding and functions like that still have to work, so I can use it in scripts. From the biki it seems nearestBuilding just needs an object of type house with a path-lod. So if I don't give the smaller-sections path-lods they won't interfere. Mind you, you need a geometry lod to point to, to be able to order the ai with the reticule.

There are a couple of limitations to the large structure however. I've lost the link but while researching lods I read somewhere that very large geom-lods produce collision-detection errors.

In my case that won't be a problem, as long as pointing at it works, the smaller sections will have geometry lods for collisions and such.

Also roadway-lods seem to be size limited as well, sometimes the roadway fails to work at some outer region of my model. Again not a big deal in my case, because I intend to put the roadway in the smaller sections anyway. Haven't found any size limitation on the AI-lod sofar, which is fine by me.

Come to think of it, I noticed another thing. AI is unable to walk through a roadway even though they are able to walk through geom-lods. So if you really want to block AI from running through walls, you could use a very steep roadway-lod to do it. Might cause some ai-pathfinding problems though, which (I suspect) is why bistudio allowed the ai to walk through buildings and walls in the first place. I think they must have figured, that ai getting stuck was more of an immersion killer than them walking through solid objects.

Share this post


Link to post
Share on other sites

That means we could have invisible AI paths outside of a building and so define where the AI can enter / exit it PLUS a path of waypoints following closely to the walls of the building ? I saw lots of buildings where the AI gets stuck at corners or makes a 200m circle just to get to the front door. Makes it look so stupid.

Also: would be cool if you could store additional infos in pathnodes so the AI would know where to take cover, where to lean around a corner, etc. Basically this would enable us to script situationdependant AI like in the COD games. They may be arcadish games, but the way the AI is acting right next to the player is very believable.

Share this post


Link to post
Share on other sites

I was thinking along similar lines when I started this project, although my inspiration comes from games like Rainbow-Six. The most irritating thing about those games for me though was the tunnel-effect. Ideally I'd like to make missions that are very dynamic and allow multiple solutions (like Deus Ex) and I think Arma is capable of this.

I've made a script for hotel that places guarded hostages randomly on predefined positions (they get shot if you're detected and don't rescue them soon enough) and also let units patrol their own floors/collection of points. It's not completely finished (can't do anything with the hostages for example) but it's already very challenging and loads of fun even after a lot of replays. I'd like to extend this mission so that you can choose which hotel you want to liberate from the menu. In theory it already works, but I haven't made the choice-option yet at mission start. Also some locations need to be dressed up a bit, to help set the scene and to provide cover for the approach to the hotel. I've also set up the script so I can extend it in the future for other things, like randomly placing a bomb (on one of the predefined positions).

The only thing missing is more large enterable buildings or urban settings with working ai-positions.

EDIT

I have a question about shadowvolume lods. Do they have a poly-limit and if yes how high/low?

The building I'm making has a huge amount of windows, but they still have to cast shadows.

EDIT

Nevermind found the answer in the O2 manual. 1000 tris and it should not exceed the volume of the view-lod.

Edited by DualJoe

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×