Monday, October 29, 2012

How to Make a Basic AI - Seek & Wander

If anyone remembers in Super Mario 64, the goombas were different then their 2D counter parts. Instead of simply walking in a straight line, they actually did some somewhat more dynamic AI. They walked around and when you got close, they suddenly turned toward you and ran at you. This is a very basic AI that can work in a 3D game and today I'd like to show how it can be done.

First off let's break down what kind of behaviours the goomba is using. It uses two simple AI behaviours...

  • Seek
  • Wander
The seek behaviour means to head towards a designated target, simple enough. The behaviour is a little more complicated but it eventually involves the same thing. It seeks towards a target, but what it does is calculate a new target in front of itself whenever it's called to make it appear like its just walking around aimlessly.

Physics System

So we know what these behaviours are and they sound pretty simple. Before you just go ahead and make them we need to make sure we have a physics system of some sort. So let's say we have our "Goomba object", well if we want to accurately calculate forces for our AI, we need to make sure he adheres to some form of physics.  This physics system is not too complicated, in fact all it needs to consist of for us at this point is the following...

  • Force
  • Mass
  • Acceleration
  • Velocity (Speed)
  • Position
You would give your goomba this physics system and give it an update function that applies these forces every frame. With the proper system, simply applying some force, will automatically do all the calculations to make the goomba move. So Force = Mass*acceleration, velocity += acceleration, position += velocity or something of the sort. So this means in our AI behaviours we would be calculating the forced required to go to our target.

Basic AI Systems - Pattern and Dynamic AI

A major factor in how believable the game world is, comes from the AI system. When you think about it, almost every game has AI in one form or another. Even a simple game such as Super Mario Bros. has AI,  very basic AI that follows the same pattern. Nowaways we have highly advanced AI, like the ones demonstrated in the Halo series, renowned for their AI. There are varying types of AI, they can be set patterns or they can be dynamic and changing based on the state of the game. The type of AI used is dependent on the type of game being made.

For my post about making a Basic AI Behaviour, click here

Pattern AI

At it's core, a patterned AI doesn't care about what the player is doing, it's not going to react specifically to you if you happen to be jumping, attacking, or dodging. The most they might react is if you happen to be near, it will activate their AI. This is the kind of AI that was featured a lot in games in the 90s and earlier.

The most basic versions of these come in the form of goombas in Super Mario Bros. Their AI pattern is to just walk ahead and if they run into an obstacle turn around. These enemies in particular don't care at all where you are.
Super Mario Bros - World 1-1 ~ The Goomba AI literally just walks forward

Another rather basic AI is the AI in turn based RPGs, notably Pokemon (the old games). They pretty much have no AI. Where pokemon will have a list of four moves, in most battles though they will simply use them at random, with no thought to strategy. Later games started to implement actual patterns in battles to make some good strategies but they were still mostly patterned.

Pokemon Red - The AI used to just randomly use whatever attacks where in their movelist

Saturday, October 27, 2012

Dialogue in Games

How does dialogue enhance the experience of a game for us? What are it's advantages and it's disadvantages? What are the different ways we can go about bringing dialogue to life and bringing story to the players? As a follow up to my previous blog I want to talk about the difference between dialogue with audio, dialogue without and even games that feature no dialogue at all to convey the story.

Story has always been an important part in some games. A lot of games still have story of some sort even if they have no cutscenes or dialogue. Some games simply feature a "story" button featured in the main menu or something of the sort (though that's usually for flash games or lower budget quick games). For titles with larger budgets they usually have either cutscenes with dialogue & voice acting, cutscenes with only text dialogue, or the rare no dialogue and no text ones.

Action Only

These aren't too common and it's very important for these kinds of cutscenes to convey all the emotion and the messages they need with only character motions. It becomes very hard to pull this off for certain kinds of games, such as RPGs which usually have the largest of backstories. However there have been some very notable successes that have proven that you don't always need talking and text to convey what's going on in a scene.

The best example I have experienced of this is the Lego series games, such as Lego Star Wars, Lego Batman, Lego Indiana Jones, etc. In these games, the Lego characters do not talk at all but they have to re-enact scenes from the movies or settings they are in as though they were mimes. They are able to provide and make the emotions obviously in certain scenes such as worry, happiness, laughter, while still trying to stick to the character they are playing. They also have to use a lot of exaggerated gestures to convey more emotion as well.

Tuesday, October 23, 2012

Fragmentation - My memory has got some holes!

When I am talking about memory I do not mean the memory of our conscious self.  I instead mean memory that our computer uses. Our computer contains different kinds of memory, some of them faster to use and some of them slower. Fragmentation is like the title says, making our memory have holes in them. I will explain the whole process of fragmentation and how it does this but before we do that let's talk a bit about what kind of memory our computer has at it's disposal.


Our memory is responsible for allowing our computer to do all sorts of complex calculations at rates faster than a human possibly could. The more memory we have, the more things we can do at once and the faster we can do it. This applies for all of the programs that our computer has to use when it's being run, from a calculator, to a game. 

We generally have two types of memory, cache memory and RAM (Random Access Memory).

Cache Memory is the faster of the two and is located closest to the CPU in our computer. The CPU is what is doing our calculations, therefore the closer we are to the CPU, the faster our calculations. The problem with cache memory is that we have a lot less of it then we do of RAM. This means we want to perform as much calculation in cache memory as we can before resorting to RAM in order to be as fast and efficient as possible. We also have several layers of cache memory, the closest one labelled "L1" while the others being L2, L3, etc. L1 is the fastest layer while the others get progressively slower.

Random Access Memory is the slower of the two and located farther away from the CPU. However you can have much more of this kind of memory, and can frequently be seen in large 1-8 Gigabyte sticks now, with multiple of them on one computer.

Thursday, October 18, 2012

Sound is important! ~ Audio in Games

We often take for granted the sound we hear in games. As our professor Bill Kaprolos taught us, sound is often a neglected part in games. Not just by designers at times but also by players as well. How often is it that people will play a game without the sound or replace the game's music with their own. Designers adding in sound in the last few months and thinking of it as an after thought. Not everyone does these but it's not uncommon for it to happen. For this post I'm going to take a look into how sound, from music, to dialogue, to sound effects and ambiance affect the game. I believe that a truly great game will have great sound to make it a truly complete experience.

Sound Effects

These are the bread and butter of pretty much every game now. These define the sounds your enemies and players will make in the world, the environmental reactions to your actions. This ranges from things such as character footsteps, sword slashes, gunshots, explosions and anything that is resulted from an action or visual change in the environment. It can be a scripted sequence like a bomb going off and setting off that explosion, or your character holding a gun and you, the player making the gun shoot by pressing the trigger.

The reason these are so important is because they are something you will hear a lot during your game, pretty much all the time. It means that they cannot be annoying, tedious or repetitive. They need to be designed in such a way that they make the experience for the player even better. They need to be satisfying and make sense with what's happening on screen.

Monday, October 15, 2012

Humans Opponents vs AI Opponents

Human opponents and AI opponents, there has always been a debate between which provides a better experience for players. Many stronger players have agreed that humans are much better and that there is no question about it, while others have tried to argue that AI opponents can be compable. All of this is usually a comparison in multiplayer games where the option to play with bots or human opponents is provided. In this blog post I look to compare the advantages and disadvantages of both in a multiplayer environment as well as take a look at how they provide a different experience for singleplayer versus multiplayer in a variety of different genres.

Human Opponents

Skill Levels

Your entire play experience changes depending on the skill of your opponents. Since there are so many players with different skill levels and different strategies it means that your experience can change with every match you play. This is the most important factor in having human opponents versus AI opponents because it means humans can provide you some uniquely different experiences that you could never get from AI.

Soul Calibur V - My Online Matches against human opponents, much more dynamic and interesting than AI.

Saturday, October 13, 2012

Repositories - Back up ALL the files!

Repository? What is that and why is this related to game engines? Well it's useful for game engines, more specifically programming in general and has a variety of other uses too. A repository is sort of like a back up system for your code (or other files). If you have a repository for your code and you make a really terrible mistake later on, you have the ability to revert to an older version and restore code! It has a lot of other things too but let's seperate this blog post neatly into some sections first.

Backing Up

Repositories have the ability to back up your files and revert to older versions. You would set up a folder of your choice as a repository and from there the program will let you do a variety of things (program of your choice, I use mercurial and tortoise HG, but more on that later). Essentially I can choose which files I would like to include to back up, so even if there are a ton of files in the folder I chose, I can select each one that I want and exclude the ones I don't want. There is even a file called .hgignore that allows you to ignore certain types of files so that they will never appear when choosing to select what to back up.

From there (for mercurial) all you have to do is add a comment that says something about what you're doing so, something like "Just created this program that adds numbers" or "[ADD] Added the ability to multiply to program". And then you just click commit. This will add a new "revision" which can be reverted back to in the future. You can add new revisions whenever you want to add a new file or change a file.

It's also possible to branch off as well, which means you're making another version that might be significantly different. From there you can multiple branches, each changing different things and even merge them later. So you could edit one file A, and one file B in a different revision. And later on do a merge that allows you to have both the changes. There can be conflicts though so you will have to use some provided tools to resolve those.

Sunday, October 7, 2012

Concept Art Creation & Tips

Development for this year's game has already begun with my group Scorching South Studios. We have already began preliminary game design ideas as well as concept art for the models we're going to create. Each of us had to do concept art for either a character or several props, each of them all needed orthographic views for Front, Side and Top as well as a perspective drawing.

In this post I'll detail my process for creating the various views as well as some tips on how to make life easier in photoshop for making concept art in this style. Here I draw one of the "pirate" characters in our game, Violet Blackwood.

Here is a link to a description of our PIRATE GAME


First we begin with our outline of the shape of the body. Since this is concept art we don't necessarily have to make it like a painting. A good step for beginners and experts a like is to draw a stick figure and figure out where the joints are. This gives a basic idea of our proportions. Make sure to use references if you don't know your anatomy, there are plenty of guides out there so I won't be covering how to do anatomy. Not to mention I still have some ways to go to fully understand anatomy.

Here I am simply drawing only half of the pose since this is a front pose and we can use an easy trick to make things easier and more accurate.

We can select the layer our pose was on and simply make a copy of it and flip it around. Voila the full pose in half the time and matching the other side.

From there it's all up to your design ideas for what you want the character to look like. Look up references for what you might want and look for inspiration. Figure out who your character is, how they might dress, what kind of expression they might have, etc.

Since we already have a base outline of the shape of the body, we can make changes if we aren't satisfied with a certain copy. Here I have redone some features, just using the base outline I made earlier. I even have a copy of the old outline from the image above in case I want to use it or reference it.

Saturday, October 6, 2012

Game Engines & Glitches!

Although I did an old post on glitches, I would like to do another because glitches are so interesting and I can take another look at it more so from a Game Engine point of view than computer graphics one.

What are glitches?

Glitches are a common issue in a lot of games and can range from being problems with graphics, to gameplay itself. A glitch is a very broad term for the game behaving in an improper fashion. A behaviour that is not the one intended by the developers. Pretty much every gamer has experienced a variety of glitches in different games, sometimes obvious, sometimes subtle. Sometimes they are a hilarious occurance and othertimes a frustrating detour to the gameplay. It can even go so far as to break the game for you, preventing you from proceeding and just causing mental suffering.

Friday, October 5, 2012

Linearity versus Freedom in RPGs

The balance between control and freedom between the players and game developpers has teetered since the beginning. Developers have tried to find the right balance of leading players into their story and levels while giving them enough freedom that they aren't suffocated and can have their own unique experiences.

But its not just about freedom. it's about the type of game is being represented. Some games benefit more from a linear experience while others are better suited to give more freedom. Every game is different and requires the right balance to fit with the games mechanics. In this post we will take a look at how some games have gone linear or given freedom and how they faired.

Three layers of Freedom

Before we begin let's take a look at the three types of linearity/non linearity we can have.


Pretty much controlling the entire experience, forcing you onto a single path to one objective, no alternate paths or methods of completing that objective. Players learn new things in the appropriate order and developers can make sure everything goes right.

The path is very guided in Linear. The gray lines represent missions/obstacles that must be completed in order to proceed.


Players are sent to complete their objective but they can use alternate methods of completing it. Players are given some amount of freedom but they are still being led slowly towards the final goal (Main storyline). Developers will have less control as players can do certain actions out of order that can make the experience not the intended one designed by the developers.

There are many more choices, alternate paths but to proceed any farther you must reach the end of the current level. From there you will get more paths.