On Mon, Jan 31, 2011 at 7:19 AM, tobias.froesc...@t-online.de < tobias.froesc...@t-online.de> wrote:
> > Dave, > you asked for it, so see comments below: > > Am Montag, den 31.01.2011, 04:49 -0600 schrieb Plastic: > > So, I have started on my ATC project. > > > 1. I'll be keeping the aircraft, their altitude, speed, direction, > intended > > alt, speed and direction, etc, in a large DIMmed array that can hold 10 > > aircraft. Landed or departed aircraft will be removed from the array and > any > > newer aircraft will be scrolled up one spot. > > If you coding for speed, shuffling around large amounts of data through > array indices is probably a bad idea - Maintain a pointer variable > instead that holds the "starting index". the one before that is the > last. Instead of moving around all the planes through the arrays, you > then just increase the pointer by one and the data in the arraysstays > where it is (e.g if your pointer variable is 5, your first plane sits in > planes(5), the last one in planes(4). to handle the wrap-around, use > MOD. > I decided to do it this way for two reasons: The first being that t is quite lightweight to code. If the fourth plane in the stack lands, I simply need to call a FuNction to move slots 5-9 up one. This makes a lot of other things simpler. For example, there will never be a plane after the empty slot. Planes would then be self-ordering, and it makes display issues a lot easier. The second reason is that I'd like to process the plane movements together, then process the screen handling, then invoke the ticker to detect the next time I need to process the panes. The only time workload becomes a problem is if the work cannot be done in one tick. At that time, I might need to look at what I have done and re-write it a more efficient, yet obtuse way. I have Lightning on microdrive here, but it's frustrating that I cannot get it onto the mac emulator easily - also, I can't count on everyone else having Lightning. The screen handling is by far the slowest part of this. > > Like in real life, the oldest > > aircraft is always at the top of the stack. There will be inbound and > > outbound aircraft. Inbound aircraft will be announced and placed at the > edge > > of the screen, and outbound aircraft will originate from the runway when > > given flight instructions and clearance to take off. The aircraft must > > always maintain "separation" of 1000 feet altitude and 3 miles > horizontally. > > Checking all the aircraft against each other to see if any violate > airspace > > of others, or have collided, might be hard to code. > > > You should decide what sort of coordinate system your planes live in. > You might want to divide the airspace in equally-sized cubes where each > cube can only be occupied by one plane - This will simplify programming, > but loose the impression of 'continuous movement' for the player - or > you might decide to have a coordinate system based on real topograhic > data like "5 miles 400 yards south, 3 miles 100 yards east", which will > be a bit more complicated to handle. I have decided to simply use 0-432 for the x axis and 0-256 for the x-axis. These are FP values so movement will be quite smooth. > [snip] > > 7. I'd like to add an element of realism where planes, including > departures, > > can declare emergencies. > > And planes trying to land on the wrong runway, not on the glide path, > abort the landing, and so on. A game like this shouldn't be too > realistic - otherwise it would become boring. People doing this in real > life get a lot of compensation for doing their boring routine job right > (Travelling a lot by plane, I hope so, at least....) For simplicity, I won't "create" those situations, but if a plane that is asked to land on a runway never crosses the glide-slope, I need to detect that as the plane passes the runway, and have the plane do something rational, like climb, increase speed, hold heading, and contact you for for a go-around. > [snip] > Go get yourself the free Turbo compiler and its toolkit and save your > money. You can't do much better than that. I'll have to hunt that out. I understand Turbo is the one that requires precise coding. Given I've revoked my "old hand" status and consider myself a beginner again, it might not be for me. I'll give it a shot though. In any case, I'll be posting my code. For you all to laugh at. Which you will. And that will be educational for me. :) Dave _______________________________________________ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm