Page 1 of 1

Box Vs Mesh

Posted: Wed May 03, 2017 2:08 pm
by TeamVSS_IsBack

Is that the Mesh are more efficient than the Box on rendering or can cause less Lag for players ?

If its true, if i use a ton of Mesh, What is the maximum size of a bzw file a server can handle ?

yours faithfully


Re: Box Vs Mesh

Posted: Sun May 07, 2017 4:28 pm
by Bullet Catcher
I don't know about mesh vs. box for lag, but there is no arbitrary size limit for bzw files. The biggest bzw files I have seen are under 2 megabytes.

Re: Box Vs Mesh

Posted: Sun May 07, 2017 5:33 pm
by ahs3
In my belief mesh is much more efficient, less faces to do the same job, however boxes are more reliable. When it comes to teleporters, they work much better over boxes.

Re: Box Vs Mesh

Posted: Thu May 11, 2017 7:31 am
by TeamVSS_IsBack
I do not think this causes lag but "small blockage" when you move.
In my example, I have a map with ton of box, I Open it with the tool of JeffM in the Unity3D editor (Here : viewtopic.php?f=24&t=19309), and I export all the map to an ".OBJ" File.

Then I run the modeltool.exe to export the ".OBJ" file to an ".BZW" file with Mesh, (result is 10 megabytes !).
When I test it (bzfs), I have no more "small blockage".

The question is now, is it a problem to host a 10 megabytes files :mrgreen: ?

Re: Box Vs Mesh

Posted: Thu May 11, 2017 3:54 pm
by JeffM
yes, meshes require more lines in the map file than a box. boxes and meshboxes are parametric, raw meshes are not. That is not a valid comparison.

On the client everything gets expanded out to the same number of faces for the graphics card (a box and a meshbox use the same number of faces when a shots are not near them).

You are just looking at file format sizes, that has nothing to do with graphical latency.

Everything you guys are saying here is total speculation and not based on any form of reality ;)

Re: Box Vs Mesh

Posted: Sat Jun 03, 2017 12:53 am
by optic delusion
In experiments I did in 2009.... I had seven variations of starship enterprise models with face counts from 1,000 to 100,000.
My mac's BZFlag frames-per-second dropped pretty significantly as the total number of mesh faces neared 30,000.
I ran public servers with these models and almost all of the players agreed with that assessment. Some people had lower quality machines.
Further tests confirmed that 30,000 faces was too many for almost all players in a playable game environment.
Conclusion: It gets pretty choppy for most players above 25,000 faces.

And BZFlag displays only triangles. Every face is triangulated before they are rendered, including mesh faces. A box is not rendered as six square faces, but as twelve triangular ones. (This does not apply to drawinfo.)

I had another model that seemed to cause problems. It was Frank Lloyd Wright's "Fallingwater" building and some surrounding landscape. It was composed of numerous large flat planes two units high, piled one on top of another. Every landscape plane went all the way to the edge of world boundaries. Even though this map had less than 10,000 faces, we got FPS numbers comparable to the 100,000-face enterprise. I think these large flat planes caused collision detection to slow.

It must be noted that collision detection is done separately on each player's machine, and computing the locations of tanks and shots versus objects consumes a large portion of the processor speed. If you have any objects that are purely decorative, you should convert them to drawinfo, releasing them from collision detection so they render MUCH faster.
On some of my maps i have converted almost every object to drawinfo, and use matching invisible objects (that occupy the same space but have less total faces) for collisions. This provides a little speed boost, i think maybe 10 percent.

Another thing to consider is the worst-case scenario. When you are off in a corner of the map, facing towards center with everything in front of you, FPS will be much slower than when you are in the center looking out, with less than half of the faces in your view.

Re: Box Vs Mesh

Posted: Sat Jun 03, 2017 11:30 am
by blast
Another example of what not to do would be to make a grate platform out of actual geometry. A map once did this, and it caused a significant performance drop due to all the collision checks of each individual piece of the grate. I believe it was replaced with a flat box that used a alpha blended grate texture, so then it was just a visual effect instead of complicating the collision model.

Re: Box Vs Mesh

Posted: Sat Jun 03, 2017 8:58 pm
by Bullet Catcher
Make BZFlag grate again!

Re: Box Vs Mesh

Posted: Sun Jun 04, 2017 9:59 pm
by JeffM
or just make BZFlag again.