Performance Issue?

Hallo there.



Im with a simple character mechanics on a simple map, and im already having some performance issues. The game is 100% procedural, from models to animations, could that be the cause ?



On my machine, game runs at 60 fps correctly, with 50x50 cubes (the map floor).



At my work, with a onboard graphics driver and 4gb ram, when i look over the floor it drops to 15fps. If i took the floor out to a single box, it runs on 300 fps at my work (WOW, really superfast). If i toggle the 2x, 4x etc on jmonkey launcher i get a lwjgl exception.



I dont know if im having a major performance issue on my code , maybe doing something wrong…



The goal of that tiled floor, is that i will randomly generate static maps (dungeons), so, that would be the ‘basic’ tile.

If you have time to help me, im making my game opensource, so you can check it out @ http://code.google.com/p/the-dungeon/source/checkout if you have time to look what is going on wrongly. This is my first 3d game, and my first time on jmonkey engine and this game is not even a week old, so the code is pretty simple to understand even if its not commented.



Any tips on what to do ? Would really apreciate any help.



Thanx for the attention !

A box world does not consist of box meshes. Search “voxel” in the forum and please read the wiki.

If you are not making a box world, and just tiles, then running your scene through the GeometryBatchFactory can help. Having lots of objects with few polygons is significantly slower than few objects with lots of polygons.



https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:intermediate:optimization

Its not a box world, as i sayd is only a tiled floor, not a minecraft clone lawls.



Im using bulletstateapp, im making the character move this way. the whole map would be a collision point to check where the player can move, would that be a problem ?



I changed the floor boxes to floor quads, this divided by 2 the number of triangles while in the middle tile.



At the dungeon generator, ill try making only 1 quad per room floor so i can low the triangles count really hard.



Will try using GeometryBatchFactory on the whole map node to check what happens next monday, since i dont want to go to work on weekends lol. Would be usefull to use it on the character node as well ? There are 6 low poly spheres there heh.



Thanx for the help, any more tips would be apreciated.

I have a similar “ground” for a board game i’m making. the ground is just a quad, and the material shader is responsible of drawing the “grid” over it.



In memory i just have a grid of colors (i need to color grid cells when you select them). You can check the cell where a character is on with math really as long as you know the position of your floor. This is far less expensive



here is a shot

http://i.imgur.com/K56eE.jpg

1 Like

What, only 1777 FPS??? :slight_smile:

1 Like
@pspeed said:
What, only 1777 FPS??? :)


Give him a break, he's only learning the engine. It's sweet to see him trying so hard :)
1 Like

Hmm how could i make a grid into a single quad like that ?



I think it would be the best performance.



Btw, how to 1777 FPS ? I cant get pass 62.



Thanx for your replies.

The grid rendering is based on the unshaded material.

In this example my grid is 64 x 64 cells, so you just have to write a black pixel when the tex coord are multiple of 1/64.

That’s the theory, but in practice you have to handle it a bit more deferentially to account for the line width.

The texcoord of the quad are assumed to go from 0 to 1 (don’t scale them)



here is a piece of the shader code i added at the end of unshaded.frag (note that it can be done exactly the same way with the lighting material)





/* This where the grid is computed*/

float gridValue = clamp(step(dist0.003,fract(texCoord1.x * float(m_GridSize))) * step(dist0.003,fract(texCoord1.y * float(m_GridSize))),0.4,1.0);



gl_FragColor = color * vec4(gridValue);



I won’t go too much into details, but the gridValue is computed with clamp and step functions to avoid branching.

read it like this



if(factionalPart( texcoord * gridSize) <= (epsilon)){

pixel is black (not completely black, it’s more dark gray, 0.4)

}else

pixel is white

}



where epsilon is dist x 0.003 : the distance from the camera to the grid multiplied by an arbitrary constant.

this makes a grid on a quad.

1 Like

wooot. its too crazy



i meant the texture grid not the actual divisory grid, so i could load a single texture on a single quad and have it repeated all the way.



ty for your attention !