|Second video preview|
|Written by Jonas Eschenburg|
|Monday, 02 July 2007|
This is another preview of the upcoming release of Thunder&Lightning.
The video showcases the new aircraft carrier, reflective water rendering and a slightly enhanced cockpit with a magnifying view.
What's less visible is the reworked AI. The complete flight of all three aircraft is performed by the autopilot. Whereas most of the flying is just following a predefined path, the landing is slightly more challenging. As you can see, the autopilot is dissatisfied with the first landing attempt and tries a second time. This happens sometimes as the approach path is kept aggressively short to enable multiple aircraft to land quickly.
The Lightning's cockpit has received a slight makeover. There is a big multifunction display. Actually, at the moment it's rather a single function display. It will become a real MFD though with functionality to replace the scrapped map of older releases.
Having a MFD will help to simplify gameplay a little. The only key a player will have to remember is TAB which will cycle between MFD states. This comes together with the decision to get rid of weapon groups. No more primary and secondary weapons. Left mouse button to fire and right mouse button to switch weapon. Middle mouse button to select target in HUD. TnL plays smoother this way.
The MFD uses the new multipass rendering functionality that was originally built into TnL to enable the water rendering. This opens up a lot of possibilities. And a lot of distraction too, since graphics programming is about the worst time sink thinkable to mankind. I will restrain from doing any graphics programming for the next couple of weeks!
Concentrating on gameplay functionality, I worked on unifying the various AI for aircraft, tanks and turrets (the carrier!). There was a large heap of unfinished work still in the code. Over time, I had experimented with various approaches to AI that were never really replaced, just superseded by new systems. Altogether, there were three different systems programmed in C++: The state-machine-like originally used for the drones (in 2002 or something), the hierarchical one used for tanks (where I wanted to make everything better and failed miserably) and the coroutine-using one for the drones that made combat more challenging but was integrated too badly into the original system to be of real use.
All these had the additional disadvantage of being written in C++. With its long compile times and static structure, C++ is not the best candidate for the kind of throw-away, quick-n-easy code needed for AI scripting. Writing a common AI for aircraft, tanks and whatnot is hard, and it's not something that is taught in computer science courses. The development in itself is a learning process where you never know what's waiting behind the next corner. This is where you need a script language. In the end, I scrapped a couple of thousand lines of C++ code in favor of a couple of hundred lines of Io code.
There is a price to be paid for the flexibility that comes with it, and it's called performance. Yes, doing the nitty-gritty work of keeping an airplane in the air inside the script language comes with a performance penalty. Right now, a couple of drones and tanks bring TnL to its knees on my (not so high-end 1.4GHz) machine. Before the change, AI performance was basically not a problem. I once created a mission where more than 200 drones were flying around and shooting missiles at each other at the same time. The only limiting factor was collision detection. Now the AI takes away a large percentage of time between two frames.
I might be forced to move some low-level parts into C++ again. But by then, these parts will at least be tried and proven.
So much for now, I hope you like the video!
|Last Updated ( Monday, 02 July 2007 )|