How To Create Professional 2D Games

This is an interactive guide to creating 2D games. Use the arrow keys to go forwards and backwards between slides.

Notes and Credits:
Music is made by @fredmaster45 and @BlazinDevilify
Guide by TM

How to create a flying 2D game character

Before we explain how to create your flying 2D game character, lets try it out. Press the green flag to start, use the arrow keys to control the player.

To create the illusion of your 2D game character flying you will need to fist create the character costumes. In this example, the character has been given a jet-pack so to create the illusion of a working jet-pack which is powering his flight a series of costumes, each with increasing power from the jet-pack were created to suggest a burst of fuel/power into the jet-pack. See below.







In this example, I will be using the 2D game engine Scratch (free to use) to programme the character but don't worry is you use a different game engine as the principles are  basically the same.

Firstly you will need to create to create 2 variables, 1 for the  characters speed on the x-axis and 1 for the characters speed on the y-axis. You can call them anything you want but ideally use something obvious such as "x speed" and "y speed". These variables can then be used in the programming code to create a realistic sense of gravity.

All the snippets of code below are explained in their captions and how they relate to the overall flying process.

This code toggles through the costumes when the up arrow is pressed


This code uses the x speed variable to speed/slow the character when the left or right arrows are pressed

And finally the gravity creating code...

This code creates the illusion of gravity at the outset and then relates to it
 as the up arrow is pressed, representing the jet-pack being powered

Why not try it yourself, you can remix and edit the project here.

Sample Character For 2D Game

Click the green flag to start. Use arrows keys to make the character walk and jump.



This character was made and programmed using Scratch, but the principles are the same for most other 2D Game engines. See the code below to understand how the character movements are programmed.




This code controls the right arrow key, the process is the same only opposite for the left arrow

This is the code for the up arrow

The costumes referenced in the above code examples are these character costumes...




Between the programming code and the character costumes a basic sense of a moving character can be created.




How To Create A Character Walk Cycle

In 2 Dimensional games and animations the illusion of motion is created by carefully sequencing slightly different still images at a speed quick enough, where the human eye will fill in the gaps between. This is usually 24 fps (frames per second).

Here's an example, the 5 images below are all still images, but when they are programmed to change quickly the character appears to walk, especially when a forward motion is added.


 


This is a basic sample (below) showing how character costumes can be created and arranged to simulate movement in a 2D game. Press the green flag to start.






The motion is created by this block of logical programming along with the character costumes shown above.

programming code for the sample animation above

Rendering in 3D

A  Photorealistic 3D Rendering

Following on from our previous articles on the 3D Modelling, lighting, materials and textures and animation we now finish our 5 part series with a look at 3D Rendering.

In 3D graphics rendering means the calculation of the final image from the scene that includes models, textures, lights, special effects and cameras. The final image will be a 2D image made of pixels. Utilizing materials, lighting techniques, and renderer's settings one can render multitude of different images from a single 3D scene. Often the goal is to produce realistic rendering, for example in live action movies the goal is to render 3D effects as realistically as possible as it is a cheaper and easier alternative to building sets or hiring extras for a scene.


Photo Realistic Rendering:

Photo Realistic Render of 3D Diamonds

With technology continuing to improve at a rapid rate renders from 3D sofwares are becoming more and more realistic. The ability to apply and map bitmap texture images is a big part of this realism but the key to real photorealism is generally attention to detail when lighting the scene but lighting a scene realistically is also one of the most challenging aspects of producing photorealistic renderings. If you haven't already, please see the article of the basics of 3D lighting types to help you get started.


Clay Model Rendering:

A Clay Render of a 3D Model
When 3D modeler's present their modelling skills they often produce a clay render. Clay render means a rendering which looks like a picture of a clay model. The idea of a clay render is to bring out the form of the model. This is not really a rendered effect however as it is generally the default form of a non textured model or a model without materials. However good lighting is necessary to effectively showcase a model in a clay style render.

Wireframe Rendering:

A Wireframe Render of a 3D Model
The purpose of wire rendering is to reveal the polygon structure of the model. Wire rendering displays only edges of the polygons. Wire render and clay render are often combined.

Cell Shading / NPR Rendering:

A Cell Shading Render
Cell Shading is a from of Non-photorealistic rendering (NPR). In contrast to traditional computer graphics, which has focused on photorealism, NPR is inspired by artistic styles such as painting, drawing, technical illustration, and animated cartoons and focuses on enabling a wide variety of expressive styles for digital art. NPR has appeared in movies and video games in the form of "cartoon shading", as well as in architectural illustration and experimental animation. An example of a modern use of NPR is that of cell-shaded animation as seen above. Another form of NPR is cartoon style rendering means a material / rendering method that produces an image that looks like a hand drawn picture.

Rendering Tutorials:


Basics of 3D Animation

Following on from our previous articles on the basics of 3D Modelling, the basics of 3D lighting and 3D materials and textures we now continue on to look at the basics of 3D Animation.


3D Character and Animation
Computer animation is essentially a digital successor to the stop motion techniques used in traditional animation with 3D models and frame-by-frame animation of 2D illustrations. 3D animations are more controllable than other more physically based processes, such as constructing miniatures for effects shots or hiring extras for crowd scenes, and because it allows the creation of images that would not be feasible using any other technology. It can also allow a single graphic artist to produce such content without the use of actors, expensive set pieces, or props.
Creation of 3D character animation is a very complicated process which consists of four separate steps:
  • Modelling the character
  • Rigging the character
  • Skinning the character
  • Animating the character

Modelling the character

Views of a 3D Character Model
A character, especially a realistic one is one of the most challenging subjects to model believably. If a character is going to be animated, the task is even more challenging. When creating 3D models which are going to be deformed (such as a human hand), one must be extra careful when defining the structure of the surface. The structure (orientation and type of polygons) of the 3D model defines how well it is suited for an animation.

Rigging the character

Rigging A Character Face

Character rigging means a process of creating the bone structure for a character. The bone structure is a set of helper objects that correspond to bones in real life. The bones (helper objects) will be animated and the character will move and deform accordingly. Bones itself won't show in the final rendered image.


Skinning the character

Skinning a 3D Character Model
Character skinning means the process of defining how exactly the character responds to the movement of the bones. In skinning process one goes through all the joints in the bone structure and carefully adjusts how the 3D model deforms while a certain bone is moving. As an addition to bones there are also other special tools and modifiers designed to help in character animation. For example facial animation is often carried out by morphing the face between several predefined states.

Animating the character

Animating a 3D Character Model
The last step in character animation is the animating itself. Animating requires a lot of skill and practice. An animator should understand at least the basics of character movement such as the concept of anticipation. Character animation process can be fluid when rigging and skinning are done with care. For 3D animations, objects are modelled and 3D figures are rigged with a virtual skeleton. Then the limbs, eyes, mouth, clothes, etc. of the figure are moved by the animator on key frames. The differences in appearance between key frames are automatically calculated by the computer in a process known as tweening or morphing. Finally, the animation is rendered.
For 3D animations, all frames must be rendered after the modelling is complete. For pre-recorded presentations, the rendered frames are transferred to a different format or medium, such as film or digital video. The frames may also be rendered in real time as they are presented to the end-user audience.
Next up in the 3D Modelling and Animation series is the final stage, 3D Rendering.