Tuesday, 28 January 2014

What is a Game Engine?

A game engine is a piece of software that is used by developers in order to create video games. Previously, all games were created from scratch each time, requiring a rewrite of the same kind of code for displaying the graphics, accepting input, processing sound, managing gameplay elements, AI, etc. This was especially aggravating when creating games similar to each other since that would mean writing very similar code over and over again. Furthermore, before game engines, creating and designing content using assets was often-times hardcoded which meant most level design was done by programmers who typically have a poor track record for being particularly artistically minded.
Of course, after a while of doing this, some bright sparks had the idea of creating a stable base, which contained all these non-specific game elements from which games could then be created from.
Nowadays game engines are often created in house for the specific needs of the company and the kind of games they create. Despite the frequent specialisation of company's towards certain genres and types of games, the engines themselves are designed to be quite generalised. This is due to a few factors, including the rapidly changing desires of the market and also the possibility of selling licenses to other companies. Epic is the most obvious example of this. Creators of the Unreal Engine, Epic frequently sells the right to use the engine for other companies to use for their own games, from which Epic takes a cut of the sales. This has provesd quite lucrative and most games released by Epic are closer to tech demos and advertisements of the capabilities of their engine than actual commercial ventures in and of themselves.
But I digress, because first we should discuss what the engine does.
The most noticeable thing that a game engine handles, from a consumers point of view, is the graphics rendering. This is done in real-time (meaning every second thirty frames are rendered) because of the interactive nature of video games. This means games engines have be fast.
The next part the game engine handles is the player input, from a mouse, keyboard, controller, joystick etc, etc. This is what allows the person in front of the screen change what is happening behind the screen.
After receiving input the game engine has to simulate everything in the background. This includes AI, physics, triggers, event, loading and unloading and changing variables. In simpler games the game simulates these things every frame. However, for more complicated games this would cause massive amounts of slowdown, lowering the frame rate and making it an unejoyable experience. As such, many game run the simulation at fixed intervals and the engine then interpolated between the two simulation snapshots, displaying this interpolated information through the graphics. Of course this comes with its own set of problems such as AI not updating to new stimuli often enough or physics being inaccurate but for the most part this method works well.
AI is "artificial intelligence", a routine in the game program as a whole that controls nonplayer characters and allows them to make decisions. It often determines where the AI can and will move (with the aid of path nodes or a Names) and when it will take certain actions.
Physics are a part of the simulation that tries to mimic the natural movement of objects due to unscripted forces. There are actually pieces of middleware such as Havok that is "plugged in" to the engine and handles the physics itself without the programmers having to write an entire physics engine from scratch. Physics also handle any of the collision of a game, making objects solid and preventing the player from running through walls or falling through the floor.
Loading and unloading is part of the optimisation that game engines make so that the the designers can create larger and more detailed levels without massively increasing the computing requirements. Another part of this optimisation is back-face culling. The facing of a polygon is determined by the order in which it's points are defined and so anything that is designated as a "back-face" is not rendered at all saving massive amounts of computational power. A similar idea to this is called occlusion culling in which the game engines determines what the player can and can't see and then doesn't render anything that can't be seen.
Once all these simulations have finished or the game has determined the where everything is on screen through interpolation, the game renders the graphics, processes the sound and displays the output to the player, ready and waiting for more input.
Of course some game engines do more or less than these things and different aspects are emphasised or removed depending on what the engine will be used for.
An important thing to note is two distinct types of game engines. Again, of course there are more and different combinations of styles of engines can be made. But for now, an part of designing a game engine is deciding on its dimensionality: should it be 2d or 3d. The difference between the two is, in a way, small. A 3 dimensional game simply as an extra coordinate, z. There are.things that are affected by this change but for the most part that is the difference between those two types.

Tuesday, 7 January 2014

11 Seconds - Animation Overveiw

Animation: 
Creating an illusion of movement by rapidly display a sequence of images. Derived from the Latin Animatio, "the act of bringing to life", which is a combination of Animo, "give life to", and -atio, "the act of".

History of Animation:

Earliest Examples
Examples of attempts at conveying movement using two dimensional images date back to the stone ages. Borne from a survival instinct of sharing information, humans love telling stories and sometimes images painted on the walls of pre-historic dwellings pictured animals with multiple sets of legs, presumably in an attempt to depict motion. These, of course, aren't actual animations, but they do demonstrate a clear desire for it.

Recent History
-Thaumatrope, created in 1824 by Sir John Herschel. It was used to demonstrate the "Phi phenomenom"(or the persistence of vision). It is a double sided card with a string from the top and bottom in the center. When the string is spun with sufficient speed the images on both sides of the card appear to combine into a single image.
-Phenakistoscope, created in 1831 simultaneously by Joseph Plateau and Simon Von Stampfer. Consists of a disk with a series of images and a correspoding set of slots. The device is placed facing a mirror and then spun, the veiwer looking through the slots. At it spins the image the veiwer can see changes, creating the illusion of movement. The animations created by these devices are looped so that it ends at the beginning, allowing it to repeat indefinitely.
-Zoetrope, a similar invention created in 180 AD by Chinese inventor Ting Huan, the modern version was invented in 1834 by William George Horner. A cylindrical spinning device with a set of images on the inside and slots above that. As it spun the veiwer would look through the slots and the image would spin. It was superior to the Phenakistoscope due to the lack of mirror requirement and ability to allow multiple people to veiw it at once.
-Flip Books, a simple idea patented by John Barnes Linnett. It is a book of particlarly spring pages on which the edge opposite the spine of every page would be an image, each one a series of the animation. As the name implies, the veiwer would hold the book by the spine and flip the pages sequentially, making visible each image in order, creating a moving visual.
-Praxinoscope, created by Charles-Emile Reynaud in 1877, it was the first animated projection. The project slides were notable for actually being hand drawn animation on transparent strips.

Traditional Animation

Animation was first done in what we now call a traditional style at the beginning of the 20th century.

The Silent Era
In 1908, Emile Cohl created Fantasmagorie, a two minute animation with each frame drawn by hand. Due to the short duration and simplistic visuals, this was possible by one man. Traditional animations of a grander scale required teams of artists working in tandem.

A stop-motion animation called The Humpty Dumpty Circus was made in 1908 by J. Stewart Blackton and Albert E. Smith. Stop motion involves taking pictures of real life objects and then moving them frame by frame, picture by picture. Then the set of images are strung together and produce the illusion of movement.

Influenced by Emile Cohl, Ladislas Starevich created a stop motion animation using dead insects with wire limbs called The Cameraman's Revenge which is cited as the first example of an animation that contains a detailed and complex story with multiple characters.

Commercialisation of these more detailed, traditional animations, was not viable until 1914 during which an employee of John Bray Studios, Earl Hund, patented the cel technique. This involved animating moving objects on transparent sheets when were then placed over a static background and then photographed which reduced the workload massively and allowed a team of animators to create a series. A further innovation that eased a transition into commercialism was the creation of rotoscoping, invented by Max and Dave Fleischer. The first merchandised cartoon was Felix the Cat in 1920 who soon became a household name and the first animated feature film was Adventures of Prince Achmed created by Lotte Reiniger and Verthold Bartosch in 1926.

The Golden Age of Animation
In 1923, Walt Disney's studio Laugh-O-Grams went bankrupt. Despite this setback, Disney decided to try again and opened a new studio in Los Angeles. He later went on to create the animated character, Mickey Mouse, a household name and also the first successful feature length animated film.

Seven years after Disney set up the The Walt Disney Company, Warner Brother's Cartoons was put together. In contrast to Disney, the animators working at the company were allowed much more freedom and expression which meant different people gained distinctive personal styles. For example, Tex Avery introduced The Loony Tunes characters which appealed to a much wider audience than Disney's children-specific demographic.

Modern Animation
Animation created in recent times is still often done in the traditional way. Computer technology, however, has revolutionised the way animation is created and has also paved the way for a new technique of animating: CGI animation.

Animating on the computer can take two forms: two-dimensional and three-dimensional. Two-dimensional computer animating is often similar to traditional with some of the limitations removed whereas three-dimensional animation is actually similar to stopmotion. A digital model is created, and then a skeleton is made, and the model is rigged up to the skeleton. Moving the skeleton bone structure moves the vertices composing the model. This is still a painstaking process and is slightly more limited than handdrawn animation but allows for aspects such as perspective and scale to always be correct.

11 Seconds - 3D

Research
Since Maya was really the only available 3d animation suite available to me, no research was required to figure out how I was going to create the animation. After finding the rig I wanted to use (Max from the 11secondclub website), I set about creating the actual animation. Once again the 12 basic principles of animation I found during my research for my 2d animation proved invaluable. Whilst some of the principles were difficult to apply to 3d, I tried to apply some of the others specifically, including Anticipation, Follow Through and Overlapping Action, Slow In and Slow Out, Arcs and Secondary Action.

Brainstorm


Storyboards
Download here.

Creative Process
First step was importing the rigged models. I found a slight issue with rotating the entire character, especially without a master controller, so instead imported a copy of the character which had been duplicated in the negative X. Then I colour coded them in red and blue, to aid the audience in differentiating between the two characters.




Evaluation
Here is the link to the final animation: link.

Overall, I think the animation looked relatively good. A lot of the motion was smooth and realistic. The faces of the characters accurately conveyed my intended emotions and looked appealing. Also, the subtle secondary animation with the red character rotating his finger really helped to create anticipation which I feel worked really well. Unfortunately, whilst the detailed movements and facial animation works really well, the larger movements of the body are very reigned in and could really be pushed more to exaggerate the movements and increase readability and appeal. Also, towards the end of the animation (around 00:07 onward) the movement is much more robotic than the rest of the animation. This was caused by a lack of planning which meant I rapidly ran out of time. Moreover, because I didn't have great planning, I relied on straight ahead action rather than using pose to pose which meant, as I mentioned previously, that the larger movements weren't exaggerated adequately.

11 Seconds - 2D

Research
My time researching was categorised into two different areas: tools and principles. By researching into tools I was trying to determine what programs or types of animation would work best for me, considering things like the learning curve, ease of use, features or range of what is possible as well as the quality that could be produced. Here are some of the options I found available to me:

  • Stop motion
    • Paper
    • Clay
    • Leg/Toys/Objects
  • Hand Drawn (Traditional)
  • Adobe Photoshop 
  • Adobe Flash

Due to personal preference, I eschewed the thought of doing stopmotion- while simple and easy to learn, timings things to a soundtrack with it is actually quite difficult to do and since I knew I wouldn't have much time (just 3 weeks from beginning to research to final animation) I didn't want to risk getting stuck trying to line everything up only to run out of time. Furthermore, due to the lack of computer generated interpolation, I would be limited to a maximum number of frames by the amount of time I had available. As such, the animation would never be as smooth as I could get it by using computer software to aid me.

Despite the thought of an entirely hand drawn animation being impressive, I also recognised it would be time consuming with many of the same issues as stop motion and so I began looking into two-dimensional animation packages on the computer.

There were two major options, both from Adobe. One was the ever popular Photoshop, designed primarily for photo editing and manipulation with basic animation as one of its features, and the other was Flash, built for, among other things, animation from the get go.

Tutorials for animation in Photoshop were few and far between and searching for them meant sifting through tutorials about the main focus of the program. Despite being mostly intuitive, the interface was frustrating because a few things weren't intuitive. Moreover, I struggled to find a way to easily control the frames of the animation and there was no way I found that allowed me to import the sound file, meaning synchronisation of the audio and visual components would be difficult and the final result would have to be manipulated in a different, external program after the fact, an idea I did not relish.

Flash, being something I had dabbled in slightly a few years back, was much easier to pick up and go. I'm sure there were many inefficiencies and silly decision I did make in Flash that could have been remedied with the proper application of some of the automation tools that Flash provides but I found simple, frame by frame animation worked fine for my needs and Flash allowed me to do that intuitively. The onion skinning feature was invaluable and towards the end of the animation I wanted to experimented with motion tweening, in an attempt to emulate the smoothness of camera movement and Flash was much easier in that regard. With time running short I chose Flash.

After my research into what kind of animation I wanted to produce I then wanted to look into how to actually make animation that looked good. My first search actually came upon an invaluable resource which I had heard of time and time again in the past: Disney Animation - The Illusion of Life by Ollie Johnston and Frank Thomas. It sets out twelve basic principles of animation that animators use to create interesting and good looking animation that is believable:

-Squash and Stretch
-Anticipation
-Staging
-Straight Ahead Action and Pose to Pose
-Follow Through and Overlapping Action
-Slow In and Slow Out
-Arcs
-Secondary Action
-Timing
-Exaggeration
-Solid Drawing
-Appeal

This information proved critical in order to achieve to quality of animation that I did reach; without it my animations would have been much more basic and amateurish.

Brainstorm

Storyboards
Link to storyboard here.

Creative Process
Creation was done entirely in Flash, using "Pose to Pose" animation rather than Straight Ahead Action

Evaluation