Wednesday, April 8, 2009

Unreal Mod - A Study in Kismet

Okay, so I haven't posted for eons... blah, blah, blah... Anyway, in order to improve my overall understanding of Unreal Tournament 3, I decided to create a mod using assets that shipped with the game, instead of modelling and texturing all of the static meshes that would populate my level. This would give me more time to research and experiment with "Kismet" (which is UT3's scripting language) and focus on the actual level design & gameplay experience. So, just to make sure everyone understands, all of the individual static meshes, textures and characters in the following images were created by the amazing folks at Epic Games, the people who created Unreal Tournament 3.

So, what is Kismet exactly? It is not the C++ code that was used to program the engine itself, but actually a higher level object-oriented programming language called UnrealScript. Since the actual script has been replaced by a graphical user interface (gui) consisting of flowchart-like steps, Kismet is actually considered to be "visual scripting" system. Everything that moves, makes a sound or triggers something in the level (with the exception of the player's character) requires some form of scripting. This scripting can be fairly straightforward, like the example I have below, which toggles off the visibility of "Power Couplings" the player must collect (and incrementing a counter which keeps track of the total number of Power Couplings the player has collected)...
...or can be quite obscene, as this A.I. script I created for the end "boss battle."

Initially, I created a level design sketch of my level, which included details, such as: player path, puzzle spots, pickup locations and general points of interest. I then created "top down" maps using graph paper (since UT3 uses a grid system). Next, I roughed out my Binary Space Partition (BSP) using the Unreal Editor. After I was happy with the scale and placement of everything, I added my terrain and rough lighting. Finally, I simply completed a series of refinement steps, adding textures, static meshes and finished lighting. Regarding scripting, I initially scripted basics, such as: doors, elevators, ladders and moving/changing lights. I then scripted more complex things, such as my simple Non-Player Characters (NPCs), power couplings, glass floor trap, cave-in trap and explosive barrels. Lastly, I scripted the most complex things, such as the basic enemy A.I. and the final boss battle. All in all, it was a wonderful learning experience.

Although the intial inspiration was the animated film Final Fantasy: The Spirits Within, the level evolved as did the player's goal in the game. Instead of running around collecting plants (spirits) as Aki Ross did in the movie, the player must collect "Power Couplings" to repair his damaged ship. Initially, however, the player must simply find a way off his ship and onto the planet, as the main ramp is closed and the Hellbender vehicles are secured. Here's a view of the first floor of the ship:

Here's a view of the second deck, with a control panel that glows softly in the distance.

Activating the control panel turns on a series of lights leading back to the elevator, which is now operational.

The elevator leads to the third deck which has two locked doors which must be accessed by--you guessed it--the distant control panel.

A side passage ladder leads to the top deck, which contains an NPC robot that reveals your mission objective, the all important Main Override Switch as well as a nice view of the planet out of the main window.

Activating the Main Override Switch opens the lower ramp and releases the Hellbender vehicles.

A view of the post-apocalyptic planet surface. The first Power Coupling glows off to the left--it appears to be attached to some machine... possibly used by locals as a makeshift power source.

A passage on the far side of the ship leads to the first Power Coupling.

A long ladder and simple jump puzzle lead to the first Power Coupling (view of the ship and ramp on far right).

Continuing along the canyon path leads under a building and to the...

...Second Power Coupling! The player must shoot the explosive barrel to open the crate in order to collect this Power Coupling.

Turning around, the player discovers a smashed hole in the side of a building. Proceeding inside, the player encounters a large statue, pillars and a glass panel in the ceiling which reveals the third Power Coupling.

The trip to this point in the level has not been easy as the player has been facing scripted enemies throughout. Here, two enemies charge the player through the glass doors of nearby offices. The third Power Coupling is visible in the distance.

Here is a view of one of the offices. Note that although Epic is responsible for creating the individual static meshes present in the level, I recombined them in interesting ways to create new objects. Since Unreal doesn't have any "chair" models, I created these using 4-5 meshes in the game. Also, the desk lights were actually streetlamps. Creative use of assets was key throughout creation of this level.

Here is another view of the second floor from the opposite side of the room. The third Power Coupling is firmly encased in glass.

Passing through an elevator leads to the top floor, where the player enters this consulting office, and is surprised by more enemies.

Here's a nearby conference room.

The final door is the former CEO's office, featuring a fancy skylight, class cubicals, raised dias with desk, and--oh yeah--another Power Coupling. After polishing off the enemies, approaching the desk opening the glass boundary for the last Power Coupling.

Closer view of one of the side cubicals.

Here's a view of the office from the raised dias.

After collecting all of the Power Couplings, you head back to your ship, but are intercepted by a Dark Walker "boss." Prepare for battle. Polishing off the Dark Walker causes your ship's ramp to re-open allowing you to return all of the Power Couplings to the robot NPC on the top floor of the ship. A simple ending sequence finishes the level.