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
The game freezes because it’s loading assets,probably it’s the same reason because moving the camera to an object that you haven’t watch yet freezes too.
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)
In the case the OP describes it is extremely unlikely to be GC. For one, it is view dependent and clears up after. GC issues would be the exact opposite… they would get worse over time and not better.
OP exactly 100% describes what exactly precisely happens when a large object with a big mip-mapped texture enters the field of view for the first time. So my bet is on that.
tell me about it, actually I was hoping you come in an give me some hint ha ha ha
I also think it is the textures since the problem grew as I used better resolution textures
how do you preload textures in gpu ? mine are 1024x1024x32 , how do I create/setup mipmaps ?
You mean the Java profiler? It’s weird because when I wanted it, I just ticked the box and got the plugin installed without issue. What version of the SDK are you running?