Matters of (scene) Scale

I’m looking into jMonkeyEngine for a space game idea, and quite happy with it so far, but I’m running into an issue of scale. Most game engines are designed for scenes to fit within certain size constraints and I’m wondering what the optimal size of objects is for jME3. For example, I might want to have a planet off in the distance (if I chose 1 to be 1m scale for example) that would appear to be 300,000 units away… what issues would I run into? My plan is to try to billboard far away large objects just in front of the sky cube, but I’d like to know where I have to start faking things.



Should player sized things be kept with certain ranges (0.01 to 10 for example) due to physics engine optimizations?



I’m watching out for the obvious limitations such as float precision, but I’m wondering if there are other things. I made a large object 1000 units away from the camera and it behaved very weirdly (changing size dramatically depending on camera angle). Any advice to someone new to jME3 on dealing with large sizes/distances?



Thanks!

When you use physics 1unit = 1m, but you are right, you cannot drive up the coordinates infinitely. For “infinite” terrain or a space simulation you will have to “partition” your space so that the locations dont get too big. Simple pseudocode example would be :

if (playerpos>1000) {

setPlayerLocation(0)

moveWorldAroundPlayer(1000);

}

Hello there,

I playing around with the same concept and its now begun to dawn on me that ive got exactly the same problem.



I was always going to define my galaxy into many sectors. Though im starting to wonder if my idea of sectors will still be too large.

My galaxy will be

X -1000 to 1000, Y -1000 to 1000, and Z -160 to 160 sectors

So… 2000x2000x320 sectors



To try and avoid variable overflows i was thinking about something like this …

Player moves from sector 0,0,0 to sector 1,0,0

Reset playerX, playerY, playerZ back to 0 (because we’re now located in that new sector)



Im now thinking i may need to have subsectors in each sector, maybe something like 20x20x20 subsectors, because each of my sectors may hold up to 160 solar systems hehe :wink:



But the problem i think i will have straight away is that my idea will conflict with how the renderer works? There might well be 2 players at the edge of a sector, one player on one side, and the other on the opposite sector, but both unable to see eachother… right?



Thanks for any suggestions, or comments

You could try to render the closest Sector next to the Sector you are in into an image depending on ViewAngle and show that on a billboard: Problem: You could see more than one bordering Sector.



You have to find a solution for that. Bu i think that would be an Idea…

You should have the bordering Sectors in the RAM anyways to avoid laggs aso if you swtich from one sector to another. Algorithms to achieve that arent very hard to code i think… :stuck_out_tongue:





Well. Thats how i would try it. But i dont know if its performant enough or even achievable without much math usw. Maybe there are faster or easier ways. ^^

maybe a player class should also define a block of what is to be visible space, and while that block is centered on the player it can also stretch across sectors…



how to do that is the next problem hehe

I have question about similar things, so let it be here.

I discovered jMonkeyEngine not long ago, so I dont have any experience with it (but know Java well enough). I want to make game with huge world, modelling life on the whole planet. And player should to be able to walk round the world without recognizing where scenes were changing.

Is it possible with jMonkeyEngine to load new locations and add them to the current scene on the background?

Yes.