Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


carterza

Member Since 31 Jan 2013
Offline Last Active Apr 02 2013 05:59 PM

Topics I've Started

Simulating flight dynamics in two dimensions

01 February 2013 - 12:27 PM

Hello all,

 

I have decided that in order to improve my math skills and game programming skills I am going to work on a two-dimensional space simulator. The view of the player or camera will be from inside the cockpit of a spaceship. This presents quite a few challenges which I am looking to the gd.net community for help with. I'm not asking for any code or any specific answers, just suggestions on what subjects to research.

 

My first challenge is going to be related to perspective correction. Since I'm only working with two-dimensions I need to fake flight dynamics. If you imagine that you are sitting in a cockpit of a spaceship, when you move the flight stick to the right or left the ship would yaw in either direction. Simulating this in two dimensions is much more difficult than in three dimensions, as you have to apply some sort of perspective correction.

 

The same is true if you were to pitch the nose of the spacecraft up or down. Simply moving the camera along the x / y axes won't be enough. I need to correct the perspective of my camera so that it appears that the aircraft is actually yawing / pitching in the desired direction and not just panning upwards / to the side.

 

What is the basic mathematical formula for applying this kind of perspective correction? If a formula is too much to ask for, where can I read about examples of this being done / read about the basic concepts I need to understand to accomplish this?

 

Thanks!


Representing points projected onto a sphere in two dimensions

31 January 2013 - 03:58 PM

Hi and thank you for reading. Hopefully I'm posting this in the right forum.

 

I am working on a 2d space simulator and I'm trying to figure out the best way to create a realistic starscape.

 

The POV for the player will be from a spaceship's cockpit, very similar to the old Wing Commander games (Privateer is the one which I'm drawing most of my inspiration from).

 

I'm just getting started and one of the first tasks I'd like to complete is creating a realistic starfield. My plan initially was to procedurally generate stars on different layers to represent the distance of the player to the stars. This would give a field of depth but I quickly realized a flaw in my plans.

 

If the player pans the camera view I need the starfield to be representative of an actual celestial sphere. If the player pans left and then pans back to the right they should see the same starfield they were looking at previously. Same if they begin to move forwards and then move backwards.

 

I'm thinking that the best way to do this is to create an imaginary sphere if you will, and then to project points onto this sphere. At these coordinate projects I would render my sprites representing the stars.

 

Am I on the right track here in terms of how to accomplish this or am I way off. Could someone perhaps provide me with some reading material I could check out on any kind of formulas I could play around with to accomplish this? I'm admittedly pretty bad at math - coming from a server side web development background - so I would gladly accept any help I can get.

 

Thanks!


PARTNERS