AnonymousUser68 Posted October 3, 2010 Report Posted October 3, 2010 Here is a note from austina note on the internal structure of X-Plane 10:As X-Plane grows in scope to be a world simulator, not just a flight simulator,with many process to fly airplanes by air traffic control, drive cars along theroads and highways, and build forests and cities according to Interesting littlealgorithms, all at the same time, it becomes clear that the organization of thecode is becoming absolutely critical to handle all of these many processes atonce without introducing extreme complications and bugs from countlessinterdependencies. Weather controls absolutely everything that is going on fromthe deer and birds to the hot air balloons to the rain and snow and ice to thetype of instructions you get from air traffic control. Forests are actuallyplanted in front of you on secondary CPUs's as you fly, and cloud puffs, radarimages, and even the flight models of other airplanes are running on secondaryCPUs at the same time. There are countless processes all running at once todrive this virtual world, and if each process is not well-designed and insulatedfrom the others, then crashes, bugs, and chaos will ensue.So, how do we deal with this? The answer is object oriented programming. Here ishow it works: each entity in X-Plane (say, for example, the deer that run acrossthe runways from Time to time) is it's own little object of code. This object isit's own little bit of instructions and memory, and this object is not allowed (and in fact does not know how) to access the functions or memory of any of theother objects in the X-Plane world. Each object contains it's own logic andinstructions, and I can safely forget how each object works when I am donecoding it, because it is an insulated unit that cannot effect anything else. Forexample, the deer object will look at where you are so they can run and boundabout at whatever airport you are near, using their own little primitive brainsto decide where to run based on the size of the airport, weather, time of day,and your location, but the deer object does not know how to change the locationof your airplane... Because your airplane is, of course, a totally differentobject. Since the brains, memory, commands and accessors for each object livewithin that object, they are not easily messed up by any other object. (acommand for an object might be: "deer object! Run out onto the runway! I commandyou!", and an accessory for an object might be "deer? Where are you? I need toknow your location to plot you!") you will notice that neither the command noraccessor is actually allowed to get inside the logic or memory of the deerobject... That would be dangerous because it kith mess the deer object up.Instead, there is a firewall around every single object in X-Plane that keepsone object from messing up another, and only allowing commands (which the objectcan follow if it deems fit) and accessors (which the object can providesafely)...other object cannot go through this firewall to mess with the internallogic of each object. This object-oriented programming is what makes somethingas complex as X-Plane 10 possible. In the movie "the matrix", it was clear thatthe virtual world was complete, and made of countless computer programs allrunning at once... And this is where we are going with X-Plane 10: a virtualworld, not just flight sim, where countless things are all happening at the sametime. Now, one obvious fallout of this is that you will want your commuter tohave processors. Lots of them. With my 8-CPU, 16-core Macintosh, I saw over 100frames per second (with no scenery) with 20 planes all flying at on e yesterday.Try setting the number of planes to 20 in X-Plane 9 and see how fast it runs.The difference is that X-Plane 10 has each airplane as it's own object, and eachobject running on a different CPU, all at the same time. Multiply this by theever-growing forest (the trees have to be planted in front of you as you fly...You do not have the ram to memorize them all) animals, cars, air trafficcontroller, boats, ever-changing weather, and you start to see why it will takea lot of CPUs to run this whole world. But, an interesting thing is that with noscenery, I am seeing X-Plane 10 run much faster, and use less ram, than X-Plane9... This is because the objects are all packed so efficiently with minimum ramuse, and run many at the same time to give more speed. (note: this ram check waxdone before I finished installing the new weather system. The new weathersystem, when complete, may cause the total ram use to be slightly greater in thewon-scenery-case... We will see when the weather system is done. Interestingly,the system that determines what the weather is in X-Plane 10 uses almost zeromemory!!! This is because the weather is stored as a fiendishly-clever littlealgorithm that tells X-Plane what the weather is at any given location and thenpromptly forgets what it just said. This gives all the variation in the weatherwe could want, but without using any ram at all! It does use memory, however, tomemorize where to draw the clouds. The drawing part must be memorized for speed,because the video card can only do it's work fast if you hand it the whole worldof clouds to draw at one time... Not one little cloud-puff at a time. So, forspeed, we must use memory to store the location of every cloud-puff in the sky,but not the weather tat caused those cloud-puffs to exist: that part was done bythe weather making object and it's own internal algorithm.Another nice thing about this object-oriented system is that it makes it mucheasier to track down and solve bugs without causing new bugs to appear bysolving old ones. Because each object has it's own logic and memory, any bugshould, in theory, be traceable back to the object that is malfunctioning, whereit can be fixed without affecting any other objects.So, while X-Plane has been gradually broken down into objects for some yearsnow, with version 10 we are really making it all object-oriented internally, andcombined with the multiple-threading, the results are really quite impressive.austin Quote
MatthewS Posted October 3, 2010 Report Posted October 3, 2010 Nice find... can you post an url? Quote
Cameron Posted October 3, 2010 Report Posted October 3, 2010 Nice find... can you post an url?http://games.groups.yahoo.com/group/xplane-news/message/1656 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.