

For those who are interested in knowing the details...
FlightGear
So for those who are interested in knowing how this works - continue reading. Like I said FlightGear gives the user a lot of control in the simulation. You can read the simulation parameters from a browser, write to serial ports, send TCP or UDP packets and whole suite of other protocols. UDP packets are easy to deal with, just reading and writing to the UDP port - just like a file. Using an XML document you can tell FlightGear which values you are interested in. In my case these were the accelerations in all six dimensions - x,y,z, roll, pitch and yaw (look those up to know what axis they are). Now what is left is to write a little UDP listener that will listen to the port you specify and read the packets as they arrive. Because it will arrive as a string of numbers, the easiest way to read each parameter is through defining the format yourself in the XML file. I used a '*' to separate them and broke the string that way when it arrived.
DIVERSE - Device Independent Virtual Environments - Reconfigurable, Scalable, Extendable (DTK)
The next step involves this library which can be found here. DTK is the 'glue' that 'glues' everything together. A whole collection of C++ client, server and utility programs that manage the shared memory and allow other applications on other computers on the network to read and write from it. Since the graphics will be running on its own on one machine and another machine will run the physics engine for FlightGear this makes communication easy. After reading the UDP packet it can be written to the shared memory using DTK and then these values can be read by any remote computer that is connected to this shared memory. All you have to learn is how to read and write from it, and that is covered by the beginner's tutorial on the website. You might be asking yourself why can't we just run everything on one computer like any other game? The answer is simply quality. One machine might start lagging if it has to take care of user input from the joystick, filtering it and then passing it to the FlightGear engine and produce graphics on the screen. Having one high-end computer do the graphics can make the simulation much smoother and more realistic which is really the whole point of having a simulator.
No comments:
Post a Comment