Need some "best practice" advice

Hallo monkeys,



I’m currently working on a jme3 based game and need some advice, before i go deeper into it. The game will be set in space, and the user will control a space ship in third person view through it.



What i have done yet:

I have implemented loading / saving of maps. A map is a solar system with planets/suns station to dock on etc. Players will be able to switch between those systems via “jump gate” or “jump hole” i might as well implement some very expensive ships that can jump between systems themselfes.



I have also implemented a simple control, so you can already fly, although it is a little bit bumby right now and needs to be better tweaked.



The third thing i have implementes is mouse picking - you can already pick stations / other ships and via mouse and info about that entity will be dumped to console (this will be shown in the GUI shortly).



So you have an overview an how far i am, or better, on what is not done yet. befor i go deeper into it, i am currently thinking of the correct way to continue. So here are some questions:



Would it be sensible to use physics in s space setting? Using physics for the ship movement seems to be a good idea. But i have some concerns about gameplay. In space, the ship would accelerate infinitely and would not slow down if the engine is off, since there is no friction. For gameplay reasons i would have to cap the movement speed, as well as slow the ship down when the engine is off. I would have to create some artificial friction or force that is directed against the mivement direction - i guess, that can be done with the physics engine?

The other point why i wan’t physics in is because i wan’t to allow the user to turn off his engine, and turn around - he would drift in the old direction, but the front of the ship would point to were he came, aloowing him to shoot behind em or simply reactivat his engine in order to brake hardy.

I think such things were much easier to implement using physics, instead of using “standard” movement mechanics. at least, for human players.

Creating an AI using those physics to fly seems to be extremly complicated, so i would maybe not use the physics system in order to make the AI move.



But this leds my to another question. as i understand, 1wu is considered 1 meter. If i were to create really great scenes, i might have to uses scenes in the size of 100.000 x 1.000 x 100.000 wu, myabe two or three times bigger. Can jME correctly handle scenes that big, or would it be better to scale down, consider 1 wu = 10m (100m) ? I know i can not really have correct sizes - while my ship might be 10x3x5 wu, my plantes might have a radius of 1.000 wu. This does not reflect reality, but it doesn’t have to. This game is not be be realistic at all cost, but make fun to play, and that also means that the way from planet to planet will be far shorter than in reality (who would really like to fly 90 mins yust to get to mars?).



I realise i wrote a lot, but here is the short (tl;dr) version:

It is sensible to use physics for movement in space?

Should I use 1 wu = 1m or should i use another scaling?



Any suggestions or tipps would be appreciated.



Best regards,

Tr3kk3r



PS: I’m not a native english speaker. Feel free to correct me if i made mistakes.

Generally you should think about if you want physics at all if you work more with “unrealistic” physics. Its probably more work getting unwanted movement out of the ships using physics than if you simulate the physical movement. In real physics, ships can accelerate faster and faster and yeah, can turn while continuing going in one direction etc etc.



Since you generally cannot encompass a whole galaxy into one coordinate system due to the accuracy of 32bit numbers on the computer you will have to partition your space somehow anyway. In reality, even with “only” solar system scale… Anytime you would see two planets of our system on the screen any “spaceships” in between would be so tiny, zooming into them using the mouse wheel or anything just would not work. I’d say using max coordinates of about 50.000 to 100.000 should be the best idea (also considering physics issues that might rise if you use any kind of physics calculations).

Since I’m also doing a space game, I might chime in a bit here.



As far as size go, pretty much the max you can go in number of floats before you can see weird stuff happening, eg: camera shaking, two things at different internal location but physically at different places, is below 500 000 units. It’s should be safe below that, but experiment and try to keep is as low as “possible”.



There are actually several threads on that subject and how to you could implement such a system. The best way to achieve a “realistic” scaling, even real coordinate system if you want, is to have the player’s stuck at the origin and have everything move toward/away from that point. As things get “closer” or “farther”, you simply scale things up/down until they get to the point where, depending on the object, they can be drawn “full size”. That’s one way to hack at this problem. And honestly, there are many ways to tackle that.



In my game I do other things depending on what kind of scene the player finds himself in. In the galaxy scene, things are shrunk down by a wide margin and even though the ship has a size that would be impossible to build, player do understand that kind of detail. Of course, I might decide later on that I want to use the above system, but for now I’ll use that system only for solar systems.



As for physics, well… That’s up to you I guess. I haven’t checked that out yet, but I might only use that for collisions, weapons and that sort of things. I do not intend to use physics for propulsion or anything along that line because I have a plan. :wink:

Hello normen, thanks for your reply!

normen said:
Since you generally cannot encompass a whole galaxy into *one* coordinate system due to the accuracy of 32bit numbers on the computer you will have to partition your space somehow anyway.

It wasn't my intention of getting the whole galaxy into one coordinate system. I already dived it into the solar systems.
In reality, even with "only" solar system scale.. Anytime you would see two planets of our system on the screen any "spaceships" in between would be so tiny, zooming into them using the mouse wheel or anything just would not work. I'd say using max coordinates of about 50.000 to 100.000 should be the best idea (also considering physics issues that might rise if you use any kind of physics calculations).

I don't really wan't to stick to realistic sizes. For the kind of gameplay i wan't to achieve, that would be far to much open space. My current idea is that a typical solar system would have roughly 100.000 x 1.000 x 100.000 wu. the system will have a virtual "horizon", so every object is placed roughly at the same y-coordinate (some higher, some deeper, but in general not to far from the virtual horizon plane away, since i wan't players to be able to navigate easily and even use 2-dimensional minimap). And the camery will not be able to get that far away from the ship anyway. lets say the ship is 10x10x10, then the camera would be allowed to get 100wu, maybe 200wu away, not more. It's not a strategic game, it's a role playing game.
using physics seemed to be attractive to me, since i could also do my collisions (e.g. player shooting at asteroid or other player) using physical objects, maybe even make the asteroid explode with correct physics. But then again, from the gameplay point of viel the debris should not fly away unlimited, but be slowed down, so i would have to add some artificial friction there again.
Well, i guess i will have to play around with the physics engine a while and see, if i can achieve the desired effects. Maybe i'll post a resumee on wether using physics in space is a good idea or not later.


/edit:
Thanks to you too, madjack ;)
The best way to achieve a “realistic” scaling,

I don't really wan't or need realistic scaling. Did someone of you ever play Microsofts Freelancer? My solar system should be in terms of size and scaling more then the systems were in that game, then in actual reality.
heres a good screenshots:
http://www.deafgamers.com/freelancer5.jpg
As you can see, the station is not really scaled realistic, and given the size of the space ship, the planet is much to small...
here is another good screenshots:
http://the-starport.net/uploads/wfdownloads/images/screenshots/screen525.jpg

Well anyway, the numbers you are suggesting that can be used safely (speaking of size of the scene) are great enough for me to create everything at a scale of 1wu = 1m for the ships.
Tr3kk3r said:
My solar system should be in terms of size and scaling more then the systems were in that game, then in actual reality.
heres a good screenshots:
http://www.deafgamers.com/freelancer5.jpg
As you can see, the station is not really scaled realistic, and given the size of the space ship, the planet is much to small...
here is another good screenshots:
http://the-starport.net/uploads/wfdownloads/images/screenshots/screen525.jpg

Well anyway, the numbers you are suggesting that can be used safely (speaking of size of the scene) are great enough for me to create everything at a scale of 1wu = 1m for the ships.


Size is always relative. If there is no hints of distance in the game's hud, you simply can't tell if you're at 10 000 KM or 1 000 KM. Same with 2 different planets taking the same around of space on the screen when you're at a different distance...

All I'm saying is that your game might tell players the planet is X km radius, and all the other infos but have the same size on the screen and they most likely won't see the difference. So in the end you'll do things the way you want because you like it that way. :) It's always easy to justify a decision.

I very well aware that size is always relative :wink: That was more in order to point out the scaling of ships, stations and planets. In reality, a planet would have to be much bigger, compared to the ship, than i intend to make it.



I think it’s safe to use 1wu = 1m, in terms of the scaling of the ship. Stations, planets and the distances between the plantes won’t be that big, that i will significantly get over 100.000 wu sizes for a solar system. Well, maybe i will, but scaling everything down by the factor 2 or 3 should not be problematic.