Blog

Day 6: Drawing Primitives in OpenGL ES

In the previous day what we learned how to start a simple OpenGL ES project. Today we want to make it more interesting by actually drawing stuff. So, open project My Game in Android Studio and let us begin. If you do not know where to put code mentioned during this tutorial, don’t worry. I will provide downloadable source code for each day from this day forth.

Understanding primitives

Vertices, triangles, and primitives

You may find various objects in computer games with different shapes and characteristics. But regardless of how sophisticated objects are, they can all be described in the same way. In OpenGL ES (and in computer games in general), every object is defined by a series of “corners”. A triangle has 3 corners, a pentagon has 5 corners, and so on. One might argue that shapes like circles and spheres cannot be described in this way. The truth is that there are NO circles and spheres in a game world. In fact, there is nothing smooth. Even the smoothest spheres you may find in a game have corners, albeit many of them so they look smooth. As we are working in 2D, I give a 2D example to make this clear. Take a look at the following figure:

Corners of a Circle

Continue reading

Day 5: First OpenGL ES Project

Before we begin designing our stage, it is good to know how stuff works. Today we create a simple OpenGL ES app. I will try to design it in a way that we can easily conform it into our engine’s library. So buckle up and open Android Studio.

Setting up the environment

Creating the project

First we need to create a project. We target the latest version of Android, while keeping it still compatible with API Level 9 (Android 2.3 Gingerbread). Thus our app will be compatible with almost 99.5% of the devices in market. So, in case you have any doubts, make your New Project’s options look like the following (click to enlarge):

New Project Dialog

Continue reading

Day 4: Stage, Scenes, and Sprites

Today we begin designing our game engine. We start with the most fundamental part of the engine: user interface. How are we going to represent our whole game scenario? Each game has different building blocks. There is usually a main menu, an options menu, and a game scene. Different games can have different sets of these and the ones given here are just examples.

Scenes and the stage

The most intuitive way to design a game user interface is to break it into so-called scenes. Each of the components described above is a scene. A game can have a main menu scene, an options scene, a help scene and a game scene, which is where the user actually plays. We also introduce another concept called the stage. A stage represents an instance of our game. Look at it as a play: there is a stage on which actors play their roles; and the play itself is broken into different parts, which is what we call scenes. As the user interacts with the game, we keep switching scenes to show content to the user. Take a look at the following figure:

Stage and Scenes

Continue reading

Day 3: Our Engine’s Requirements

So far we have talked about graphics engines and game engines. Today we are going to kick-start our own game engine. I have called the game engine Artenus, which is the name of the ancient Persian goddess of creation. Having a name makes it easier to refer to the engine during this guide. In day 2, we introduced different components of a game engine. What is covered today is mainly about what components Artenus has and what you need before getting started. Below is a screenshot of my first ever game made using the Artenus game engine. We will make another game together with this engine, once we are done implementing it.

Bomb Squad Screenshot

Continue reading

Day 2: What Is a Game Engine?

A game engine is a system designed for the creation and development of video games. The capabilities of game engines are different one to another. Some game engines only provide a basic framework through which you can program your games in a high level without thinking of the technical subtleties. Others provide a user interface in which you can visually create your entire game, without the need for a line of code. Below is a screenshot of the 2013 game Gone Home, built using the Unity game engine.

Gone Home - 2013

If we are to design any form of game engine, no matter how simple, we need to understand the concept first. For this reason we break a game engine into its building blocks.

Continue reading