As promised, here's the huge post I promised you guys, and relatively early in the day too!
The most obvious part of A22 that seperates it from A20 is that the terrain is not completely flat, and in fact can be quite bumpy. In Angels 20, the "engine" was tile-based, there was a 1D array of ground tiles that made up the entire "terrain". This worked okay for small little islands, but eventually we wanted to try and put some mountains in there, but that didn't go so well, so we stuck with flat terrain the entire game... which sucked. The engine running Angels 22 however, uses a different approach to terrain, what I call the "Cookie Cutter HeightMap".. or something like that.
The terrain in A22 is a 2D heightmap. A heightmap is a way of modeling terrain, by having a bunch of interconnected "points" with an equal distance between them, but each one having its own height. Now the one thing that was stopping me from having Angels 20 use a heightmap was that I couldn't figure out a good way to texture the thing without having the texture look stretched. Finally, about 2 months ago, I was bored in Calculus, so I started thinking up a way to nicely texture a 2D heightmap. The method I eventually came up with actually worked really well, I call it "The Cookie Cutter Method".
It works by taking a texture that is as wide as the distance between 2 adjacent height points, and as tall as the terrain can possibly be. This terrain is essentially a slab of ground with rock layers, grass, snow , etc. When rendering the heightmap, each segment of the heightmap is used to "trim" the slab texture to the shape of the segment. The trimmed texture is then applied to that heightmap segment, and since it is trimmed, there's no stretching in the final polygon. You can see the process in the screen below:
Now, while the terrain is technically a heightmap, it is also semi-tiled, because the same slab texture is used on alot of segments, in fact you can sort of see the seams between the heightmap segments in some of the screenshots we released.
Collision With The HeightMap
Testing for collisions with the heightmap is actually pretty easy and straightforward. Whenever an object needs to see if it has hit the heightmap, it just draws a vertical line at it's xposition. Then, a line intersection test is used to determine the ycoord of the terrain for that xposition. If the object's old y-position was above the terrain altitude, and its current y-position is below the terrain altitude, then there was a collision, and the object reacts accordingly. It's pretty simple, but effective.
The entities in A22 all derive from a base class called "Thing", and are all stored in various std::vectors of "Things". There's a vector for all the inactive objects like trees, rocks, etc. This saves me from doing all the collision detection and updating for those objects. Then there's the "active vector", which contains stuff like the planes, bullets, buildings, etc. The final vector is the "Combatants vector", which contains all the "attackable" objects. Every "Thing" has a reference to this vector, which allows them to internally decide what to attack, what to defend, where to go, etc. While the entities may look like they are in tiled positions in the screenshots, they can be placed anywhere on the map. Yeah, entities are pretty boring... until they start shooting at you!
The Wrap Up
Well thats about all you really need to know about the Dogfight Engine at this point, but if anyone has any questions, feel free to ask, I yearn for human contact......
Well, as many of you may (not) have noticed, I was gone all last week. I went up to Colorado to go to the Air Force Academy for 1 week to see what it is like being a cadet there, and I must say, I have an assload of respect for anyone who goes there for college. It was pretty hardcore, both academically, and physically.
My days there consisted of waking up at 5AM and going outside to do an our of PT(Physical Training). Then we proceeded to go to breakfast, which lasted about 30 minutes. After breakfast, we would be rounded up by some officers and sent to a seminar hosted by a teacher at the academy. The seminars were mainly what one would expect from an engineering oriented school, there was Biology, Physics, Aeronautical Engineering, Astronautical Engineering(which was really cool), etc. Some of the cooler subjects you can major in were, Military Strategic Studies, Ops Research, Military Aquisitions, etc. All in all, the classes were fucking awesome. Anyways, after that first class, we would proceed to go to lunch, which was followed by another 3 hours of classes. At ~4PM, we would go play an intramural sport against other "squadrons". After 2 hours of that, it was off to dinner, which was followed by about 2 hours of briefings on Academy life. Then there were assorted leadership activities until about 10PM, after which we went to sleep and then repeated the whle process the next day.
It sounds like hell, and some of it was (2011 pushups anyone?), but at the end of the day I felt pretty damn accomplished. The facilities there are kickass (although the dorms suck), and hey, it's free! I still have a lot to think about, but I'm definitely considering going there (provided I can get a Congressional nomination, which isn't that hard in New Mexico[grin]).
Anyways, it's good to be back, and now if you'll excuse me, I've got some journals to read. Peace Out!