After having loaded all the necessary assets, when my game starts, the screen is black (sometimes showing the hud), and stays that way for a while…the engine is doing something but what ?? the more I add thing in the scenegraph, the longer it takes to process “something”
also if I turn the camera to some objects, the game freezes for one or two seconds, then it goes to normal, it does that only once,so no big deal, but not a great user experience
I guess it has something to do with octree/bsp/data caching somethign… ???
I cant find what is going wrong as there is no profiler in jmonkey ide like in netbeans
does’nt make any sens, I load my assets before it happens and after all assets are loaded, the game freezes (also I log everything, so it happens once the whole game is setup/loaded)
so unless the engine doesn’t really load the object and postpone it until the object gets in the frustum…and I dont want that to happen, no commercial game do that
We can only guess the problem if you don’t post any code. And even make a guess is quite hard since you didn’t even say which type of game you are developing (voxel based maybe?) nor if you are using any shader, control, physics engine, lod […]
When you face those type of problem the first thing to do is try to isolate them, so it would be a good idea write a simple test case that you can share here with only the part that doesn’t work, so people can help you.
Maybe you are just doing something wrong but without seeing the code it’s quite hard to understand what.
It’s a little funny how random the answers are with only one actually helpful one.
When you load an object, the textures are in system memory… in whatever format they were loaded. When the object is displayed for the first time, it has to transfer those textures to GPU memory and potentially generate mipmaps. This can take a while if your textures are large or there are a lot of them.
Some formats are already in a GPU friendly format or already have mipmaps generated… in that case it’s only the cost of the memory copy.
There is a way to preload these things into the GPU at the time you choose instead of at random runtime… but if you have a lot of these really large textures then ultimately it may not help as they could get shifted in and out I guess based on how much GPU memory is actually available.
Edit: note that some of the answers are partially right about triangles since those buffers have to be transferred also… but usually that’s not a cause of lag unless there are a lot of them. (which is why the good paging systems only add one mesh at a time per frame and stuff to keep from breaking frame as you walk around… but they also share a common set of textures)