Jump to content
Official BF Editor Forums
Sign in to follow this  
&y JOKER

Navmesh Creating Hints (achtung! Images Inside)

Recommended Posts

H! all!

I have some ideas and some questions for bf2 community.

I'm not a BF2 guru, i just like it as game and as some kind of SDK too. :) We play BF2 in coop mode with friends for a long time. Usually 5-7 humans and 80-90 bots. They're stupid, but they're never use cheats and never shoot you while you're climbing in plane cockpit. :) We need them only to make a WAR! :)

Of course, the first thing that i got was Kysterama's 64 bot support levels and his navmeshing tutorial.

Some things did not suit me and then i began to navmesh levels by myself. Most things is from Kysterama's tutorial, of course, but some methods i have not found on BF2 forums. And I have not found some answers till now.

I hate two things: when bots drops their vehicles on halfway to CP and i hate when they use the same pathway again and again.

For example, Operation_road_rage level. Even at first sight it is cleary visible that this map is "hand-made" in non-DICE style. One of the worst things - is some objects have not closed thier collision meshes. So, while generating navmesh you cleary see it in log. It looks something like "Object ..... has broken data.", "Object is self-intersecting!", "Object is not a closed mesh!"

It makes certain problems. For example, "xp2_interchange_02" object on generated navmesh looks like a huge cube. It's not neccessary to wait end of generating navmesh. We need only log-file with these objects.

We'll extract them. We need (this example) xp2_interchange_02.con xp2_interchange_02.tweak from booster_server and xp2_interchange_02.staticmesh from booster_client. We don't need .collision mesh cause it made by curved-hands.

We import it in 3ds. It looks like this.

3be9c.jpg

Next, we draw a shape closed line with the same number of vertices of main object edge.

f080c.jpg

Convert it to editable mesh.

292d2.jpg

Attach it to main object

1fd02.jpg

and move vertices. I just copy the x,y and z coords of main object vertex and past them in the same vertex of new poly.

cb2d2.jpg

c3c3a.jpg

Next, select 2 vertices and choose Weld-Selected

4ae58.jpg

So, we close one of the edges

200cd.jpg

When it will be fully closed, next step is add other small things to main object.

Cause the interchange_02 is complex object, we need to make 2 different collision mesh for infantry and vehicle. For example, there's a couple of stones. It's not a problem for vehicle, but infantry will get stuck in some places.

8340d.jpg

For vehicle collision mesh we could select and delete or detach them.

4d0ab.jpg

Next, we need to merge main object and support poles. It can be done with ProBoolean.

Example, we have a cube and cylinder.

49f44.jpg

With cube selected we choose Create-Compound-ProBoolean, set Operation parameter to "Union", press "Start picking" and select the cylinder.

22c98.jpg

6b2ea.jpg

4f79e.jpg

The same thing we'll apply to our interchange object.

8e48c.jpg

d341e.jpg

e28cd.jpg

After all, when we have fully closed collision mesh, it's time to check it out for errors. So, we 're select object and in modifier stack select "STL Check".

6b73f.jpg

068cf.jpg

If everything allright, we can export it into bf2. If not, the problem polys will be red highlighted.

8fe10.jpg

I forget one thing about polygons. After importing in 3ds, object consists of separated triangles. I have not any idea why. So, i just have select them all and weld.

When all bad objects are fixed, we need to put them back (our fixed object_name.collisionmesh) into booster_server.

Next step, i did the same things as in the Kysterama's tutor, except some moments.

I notice, bots drops thier vehicles when they're too high above or too deep below navmesh. It happens because of wrong tessellation.

93207.jpg

9a876.jpg

To avoid this in the game, we need some handwork to fix it.

A _GOOD_ navmeshed and tested level takes about 1-2 months. You will do it even while sleeping, trust me. Ohhhh, these green triangles... :)

Well, we created all .obj files and we're need a non-tesselated ground mesh. It's simple by using navmesh.exe Something like that:

navmesh.exe -dir work\operationroadrage\gtsdata -cmd gts2obj -in meshes\ground.gts -out output\ground.obj

Sometimes maya can't eat hi-poly mesh, in this case we need to separate it on 2-4 parts in 3ds.

Maya.

I like maya. :) Especially for navmesh editing. In maya you're always see accumulation of triangles by their highlighted centers, which need to be explored.

For comfortable editing i have bind some functions to hotkeys (Window menu-Settings/Preferences-Hotkeys):

"a" for Edit Polygons-MergeVertices

"s" for Edit Polygons-SubdividePolygon (Subdivision Levels: 1, Mode: triangles)

"d" for Edit-DeleteAllHistory

"e" for Edit Polygons-FillHole

"c" for Polygons-Triangulate

"r" for Edit Polygons-Split Polygon Tool

c0423.jpg

Maya didn't like hi-poly meshes, especially on slow PCs. As longer you work with mesh than it's became more slow. Sometimes, Edit-DeleteAllHistory command helps to speed up, so i bind it to hot-key. But the best way is simple close maya and reopen scene. :)

First of all, i delete all unnecessary triangles inside and outside, checking every inch. If bots will not walk here - delete them. I just like beauty navmesh. Less triangles, less size, less bugs. :)

Especially, i hate something like this

96044.jpg

e0144.jpg

and this

daf8e.jpg

80803.jpg

8bb03.jpg

and this one

6ef3c.jpg

The way to reduce num of polys: delete and merge neighbour vertices by selecting and pressing "a".

4d719.jpg

326f6.jpg

Next step, i fix missed navmesh on bridges etc.

Next, i look for incorrect normals. It's easy to find them using Display-Polygon components-short normals.

62454.jpg

Delete them and renavmesh area manually.

Finally, toggling visible terrain, navmesh, zooming out while terrain just start to disappear and trying different angles i search "green" area. From above and below a navmesh. These areas, usually, are wrong.

First time, i searched for them creating matrix of spawnpoints and move it in the editor. :)

5d98d.jpg

Now, i don't need to do thiat. It''s easy to find out problem areas in maya.

20c25.jpg

There's at least two methods to line-up navmesh with ground: fill-subdivide and using Split polygon tool.

Well, we found out problem area.

From above:

d2f96.jpg

and below:

68455.jpg

For example, we need to insert a vertex on "leaf's" center. So, we select

90a9a.jpg

and delete them.

0190d.jpg

Select any edge

3d160.jpg

and press "e" to fill area.

17d90.jpg

Then press "s" to subdivide.

7659a.jpg

In vertex mode we move center point down to ground mesh.

70e9c.jpg

And don't forget to apply ground material to the "leaf".

A some problem can will appear when there is some open area near and leaf has common edges.

04fbe.jpg

Just fill them

f9b18.jpg

delete leaf

ad478.jpg

fill and subdivide.

5ab27.jpg

And delete filling of neighbours.

e9a18.jpg

Other example. We have a gully or our "leaf" is near the edge of navmesh and it's impossible to fill hole.

In this case press "r" to switch Split Polygon Tool and cut. When it's done, click RMB.

968bf.jpg

Select "leaf" and its neighbours

db073.jpg

and press "c" to triangulate. (Coz we need a triangles not a poys).

7b9cc.jpg

And move vertexes again as we need.

56ebb.jpg

Finally, we have all fixed navmeshes in AIPathFinding folder. And it's time to test the map.

I leave only 3 SA on map. Each for every team and one neutral. The "Unabletochangeteam" param is "on" for all.

Set in AIDefault.ai aiSettings.setMaxNBots 80 and higher. So, flying above i can see who, where and how runs. If there's something wrong i take the screenshoot for further fix.

If somebody drops vehicle and runs hiking i inspect this area in maya. In most cases the navmesh is too high above or too deep into the ground. So, again and again: fixnavmesh.bat, update AIpathfinding folder, test.

If it's necessary, i set infantry and vehicle waypoints. And test, test... If everything allright, i save waypoints from strategicareas.ai into textfile and make help pic which SA are tested:

c2579.jpg

0a1d6.jpg

When all combinations of SA's are tested-it's time to test them all together. And only after all of these steps it can be GOOD navmeshing. And it's not a fact, yet. :)

And another one bug fix. When vehicles can't drive through some places (it looks like moving forward and back continuously) check vehicle and infantry navmeshes there. Veh navmesh must be inside infantry navmesh, not out of its "border" on empty space.

So, i have 2 questions:

1) Are waypoints bidirectional?

2) I notice, that light vehicles like FAV have some trouble while they are trying to "climb" on static objects like bridges. They are retreat back and trying again. At the same time, tanks, AA and APCs do the same thing without any problems. It doesn't matter where the vehicle navmesh is. Above or below the static object. Another strange thing, going through the bridge FAV slows down, tanks are going on full speed. I have no idea where's a problem. WTF? Where to dig?

p.s. and another one question. Why boats won't use vehicle waypoints at all? They're just ignore them.

Edited by &y JOKER

Share this post


Link to post
Share on other sites

Thanks for your great efforts in showing 3D navmesh editing !

I'll pin it here :P

1. Waypoints are not per se bidirectional. As they are bound to destination and source areas they'll inherit that setting from SA neighbouring. Bots will use waypoints if the costs are low. If there's a way to reach the next area with less costs they will mostly decide not to use the detour via your waypoint.

Boats follow those same rules and will mostly go straight to the target as water navmeshes are mostly obstacle-free and waypoints will only increase costs.

2. Cars like the FAV use the 'ArmedCar' AI behaviour which sets a relatively low cost for water. ( have a look at the /ai/Aibehaviours.ai file ) . This probably ( and its only a wild guess ) makes them more undecided which way to choose as they take water surfaces into calculation of way costs.

Btw, if you not already found it have a look at this thread over at BFSP:

http://www.battlefieldsingleplayer.com/for...showtopic=14263

XWW2 has incorporated these changes to the AIbehaviours.ai file and so far the feedback from the users has been very positive.

Edited by mschoeldgen[Xww2]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×