|Corncob 3D Game Engine|
|Written by Administrator|
|Sunday, 14 March 2010 12:53|
The Corncob 3D Game Engine
The game engine implemented 3D rotation matrices using 16bit fixed-point math. That means we use integer arithmatic to represent fractional values. Here's an example of a code snippet from the source. The fixed point number is a 16bit integer where 32767 = .0.999969482 is the highest number that could be represented, and -32767 = -.0.999969482 was the lowest. The following is a routine to add two of these fixed point numbers and catch the overflow. I.E., I had to handle the case where 0.8 was added to 0.5. The answer is 1.3, which is larger than the biggest number I can store in my 16bit integer. For 3D calculations I handled this by clipping the values to the highest possible value.
The flight model was based on the physics of air flow over the wings and body of the aircraft. Despite the limitations of the integer arithmetic, I got the plane to fly by measuring how the air was hitting the surfaces of the plane, and where the center of mass of the plane was. Turning the plane was really done by the air pressure on the tail of the plane and by tilting the plane so the lift vector had a sideways component.
The true physics really added to the game. The plane the very heavy feeling when air speed was low. As the wings took damage they lost left, and at the same time engine damage would reduce your thrust. Control damage added random variation to the rudder and elevator controls. Trying to get a heavily damaged plane back to the runway after a mission was really fun. Here's another snippet of the code, some of the 11300 lines of assembly in 3.asm. This particular snippet is looking the wind speed over the wings and determining if the wing is stalled or not.
; calculate lift
Sound was done using Midi Adlib sound card interface. The engine, the explosions, and the guns were done with the Yamaha YM3812 synthesizer chip So the sounds were not digitized, but synthesized from waveforms. This was actually good for the engine sound, which could change pitch smoothly and change characteristics with damage, but the explosions and other sound effects had to be done with percussion synthesis and it really wasn't so great.
Although the flight simulation was really the strength of Corncob 3D, some of the other features were fun too. The player could eject and parachute down, or hop out of the plane when it was on the ground, and walk around. There was no 3D model for the person, so it was 1st person perspective only. To get full points for a mission, the player had to make it back to the base, either by flying back and landing for maximum bonus, or just getting close. Or in the worst case, hoofing it back on your own two feet. In at least one of the later version, a 'Rescue Van' would drive out and pick you up if you ended up far from the base without a plane.
As far as the gameplay, another feature which added dramatically to the fun was the system of medals and accomplishments. This was programmed by my friend George, who was using that advanced super high level programming language called 'C' which I wasn't really proficient at yet.
The image at the left is a screen from Moag, captured from YouTube user ">inuchance's video. He is receiving a purple heart medal since he survived a plane crash in the mission which just ended.
Since in the DOS days, memory was a huge issue, we had kind of a peculiar design. George's program, Moag.exe was a text-mode program which had menus, and let the player build a character and select missions. When the player selected 'Start Game', his program would actually simply exit with a return value. In at least the early versions, the game would actually be running a DOS batch script, which called Moag.exe, then moag would exit with a return value. The batch file would either exit or start 3.exe with some command line parameters depending on the options. For selecting the mission, moag would have actually simply overwritten the text files that 3.exe loaded which had the world design.
The artificial intelligence by the enemies was not very advanced. There were anti-aircraft guns which would anticipate your path through the air and aim so that the flak would burst near you. The skill of the guns was configurable for accuracy and rate of fire, etc. The enemy air units (Deathballs) simply headed directly towards you, and so would invariably end up on your tail. Since Corncob had a generously large rearview screen, this added to the gameplay, since you would see them coming and thus maneuvering to avoid them was frequent. On the ground, the shopping carts did more or less the same thing, but they were constrained to the ground.
256 Color Vga Cut Scene Graphics!
I purchased some plastic airplane models and build them, and took pictures with my camera. I don't remember how I got the film pictures into digital form. I also bought a military flight suit and some combat boots at a surplus store and got family and friends to take pictures of myself. In the picture on the right, that's probably me, digitally added to the picture with MVPPAINT.
The Mission Builder
This just another build of the game engine, but with lots of key combinations for creating and placing objects. It was like a very early Garry's Mod where you just created objects where you stood. This worked for creating missions but was not very satisfactory for building good-looking things out polygons.
Corncob was great fun to create, and because it was shareware and basically free, many people got to enjoy it.
Thanks for reading about Corncob3D. If you have any questions or comments, please write to me at the address pictured below:
|Last Updated on Sunday, 14 March 2010 14:43|