Archive for the 'Game Development' Category

Creating a Game Soundtrack: Interactive and Adaptive Audio

Just as many films now feature a soundtrack music album, typically a compilation by the prolific ‘Various Artists’;-), game soundtracks are already starting to be released as compilation albums, or as ‘composer’ works. For example, soundtracks for several releases of the Final Fantasy game franchise have been released as orchestral works: Music of the Final Fantasy Series. Game soundtracks also seem to be establishing themselves as a bona fide musical genre. For example, the Rhapsody download service already features Video Game Soundtracks as a subgenre of its soundtracks area.

Where the music track provides backing for an inevitable story point, perhaps as the soundtrack to a cutscene, then it can be scored much like a score for a film sequence. In the case of a cutscene, the length of sequence is known, the action fixed, and the lead in and lead out from the scene known in advance.

But if the music is tied to the action, and the action is interactive, maybe even helping drive the creation of an emergent story, things are maybe a little more difficult…?

Skim read through the four page article Defining Adaptive Music and find out how the author defines “adaptive music” (by “skim reading”, I mean: do not read every word - glance through the article looking for appropriate keywords and headings…). How does “adaptve music” compare to a more traditional musical composition?

Now look at this second page of the article Design With Music In Mind: A Guide to Adaptive Audio for Game Designers. To what extent does the design of adaptive audio resemble the design of an emergent narrative structure? What additional constraints must the designer of the adaptive audio track contend with compared to the narrative designer?

If you want to keep tabs on the world of video game music and interactive audio, and maybe find out more, the music4games website and the Interactive Audio Special Interest Group are both worth a visit.

To see a wide variety of examples of game audio, the prettyuglygamesound blog has a growing collection of game audio critiques, with embedded video examples courtesy of Youtube.

From the blog’s ,em>About page:

PrettyUglyGameSoundStudy (or PUGS) is an experiment to gather as many examples of audio in games that people consider either to be ‘good’ (or ‘pretty’) and ‘bad’ (or ‘ugly’). On one hand we wish to get a better understanding of game audio that people consider to work well in games and on the other we would like to get an overview of (typical) game audio blunders, from which the field can benefit. We hope that eventually this archive can grow out to be an inspiration (as well as the occasional good laugh) for those working in the field of game audio.

We are Sander Huiberts and Richard van Tol and we are currently doing PhD research on game audio. For the past three years we have taught a course Game Audio Design at the Utrecht School of the Arts (Netherlands), in which we gave our students an assignment similar to the idea behind PUGS.com (”gather 1 minute of footage of what you consider to be ‘good’ game audio and 1 minute of footage of what you consider to be ‘bad’ game audio”). We ended up with lots of interesting footage as well as discussion points. Through this website we wish to share this footage.

The prohject is a work in progress: “Please feel free to contribute to this website either by uploading your favourite example of good or bad game audio, or by commenting the uploaded examples of others!”

If you do join in, let us know via a comment back here ;-)

Producing Game Audio

In Listening to the Game - A Brief History of Game Audio we briefly considered the history of in-game audio. In this post, I’d like to look at how audio design and production fits in to the game development process.

The following two articles from the IGDA Casual Games Quarterly were written by a game and interactive media audio designer in a company that handles outsourced audio design requirements (Somatone interactive audio). The articles are intended to help other members of a game development team understand what’s involved in audio design, and tell them what they need to know in order to have sensible - and hopefully productive - conversations with their audio developers…

Based on a reading of Improving Communication with Your Sound Designer, Part 1, or otherwise:

  • what is the role of a sound designer in a game design team, compared to a composer? Does this view differ in the games industry compared to other creative industries?
  • what tools is the sound designer likely to use to in the audio production process?
  • what are the differences between composers and sound designers in an interactive media production team? At one points are the involved in the game design process? (If you put together your own game development process diagram having read The Process of Game Creation & the Game Design Document, modify your diagram if necessary to include the roles of sound designer and composer?
  • what properties of the audio signal are dealt with when the audio is “mixed”?

The second article addresses the concepts involved in audio design at a more technical level. If you are particularly interested in audio design, it’s worth reading… but for the purposes of Digital Worlds, I think it’s a little too involved for now!

Knowing what you know about the game design process, you might expect there to be a part of the game design document dedicated to audio design. Read the first part of Design With Music In Mind: A Guide to Adaptive Audio for Game Designers. What are the key questions that must be addressed by the ‘music design’ for a game? As well as music design, what other elements of audio design need to be addressed by a complete audio design statement? (You may find the first part of Finishing the Maze - Adding Background Music, as well as the comments, relevant here.)

Growing the Platform Game - You’re On Your Own, Now (If You Want to Be!)

Having introduced the idea of a platform game, your mission, should you care to accept it, is to build a platform game of your own, on your own, using the Game Maker Platform game tutorial, as well as any other resources you happen to find, to guide you…

If you don’t fancy the idea of that, I’ll carry on developing the platform game here in the Digital Worlds uncourse blog, at a slightly gentler pace. I’ll also show how to use some of the new techniques in the context of the maze game world.

So - if the DIY platform game adventure is for you, read on… feel free to blog your progress and link your posts back here, or even set up a page for your game in the Digital Worlds wiki. If not, get a yourself a cup of tea, write down some requirements about how you’d like some monsters to behave in your platform game world, and stay posted…

For those of you who’ve opted for the solo mission, visit the YoYo games website, and download the Platform Game Tutorial (if you haven’t already done so) and use it to guide your exploration of how to develop a simple, arcade style 2D platform game.

We’ve already looked at how to create a simple platform world for your player character to explore, but the Game Maker tutorial goes into more detail. If you work through it, you will learn how to:

  • introduce monsters into the game: you already know the basics, but here you’ll find how to ’squish’ monsters by jumping on them, and how to use invisible markers to limit the territory the monsters patrol;
  • make the platform look pretty: the tutorial includes a tileset in the Resources folder that is ideal for creating a stylish looking platform game;
  • construct - and explore - huge rooms: our games to date have shown the whole extent of a room within the screen view. It is possible to spread a room over several screens however, through the use of views. At any particular time, the player character is kept in focus and a view of a small part of the room around the character is presented. This technique requires the player character to explore several screens worth of room - not all of which can be seen at once - in order to negotiate the level;
  • introduce ramps and ladders: as well as jumping to get between levels, it’s sometimes nicer to walk - or climb. The tutorial describes how configure the player character to walk up a ramp, thought you’ll have to do a bit of thinking yourself (or peek at the tutorial programme code!) to work out how to create a ladder with the correct properties!

Feel free to work through the above tutorial as quickly, and as in as much depth, as you like.

If you would like to explore the construction of platform games in a slightly more theoretical, formal academic sense, try working through the Game Maker platform game lecture notes from the UCSC Foundations of Interactive Game Design course: Creating a Platformer using Game Maker (collision detection, undesirable collision detection cases, creating simple state machines, jumping mechanic) [(PDF) (iPaper)], Creating a Platformer using Game Maker, Part 2 (advanced collision detection, all-in-one collision handler for platformers, jumping onto a moving platform) [ (PDF) (iPaper)]. Audio versions of the lectures are also available from the actual course site.

Remember, if you don’t fancy the idea of working through the YoYo Games Game Maker tutorial at your own hectic rate, I’ll carry on at a gentler pace, over the next week or two, here in the Digital Worlds uncourse blog…

One, Two, Three, JUMP!

As well as fixed platforms that are somehow suspended in the game world sky, and player characters that are subject to gravity (and are hence capable off falling of the edge of a suspended platform!), another defining characteristic of many arcade style platform games is the ability of a player character to jump.

Jumping is a core mechanic of many platform games, because it provides an easily understood way of helping a player character get from one platform level onto a higher one.

Before we look at jumping, however, let’s revisit how we go about making our player character move… To give it somewhere to explore, create a simple, platform filled room using instances of a solid, visible wall/platform object, configured with an appropriate sprite, but no event handlers. Also create a player object and give it a sensible sprite.

Moving the player character from side to side…

In a platform game, the player character typically moves only when an appropriate key is pressed - otherwise, it can be difficult to stop close to the edge of a particular platform.

One way of achieving this mechanic is to configure the player object so that it reacts to the keyboard arrow controls in the following way. When the appropriate keyboard event is raised, check to see if there is anything in the blocking the sprite’s movement in the desired direction:

Remember, the Game Maker co-ordinate system is defined with absolute co-ordinates (x, y) set to (0,0) in the top-left hand corner of the screen, increasing x from left to right, and increasing y from top to bottom. So to check the player character can move to the left, we need to check there’s nothing at the x coordinate location several pixels to the left of the character’s current position (that is, a negative x direction). Ticking the Relative box ensures that we are ticking 4 pixels to the left of the actual location of the player character, rather than the location at x=4.

If the path is clear, we want to move the sprite in the appropriate direction - use the Jump to Position action to achieve this:

For the right arrow, the x value should be set to 4 in each case (that is, a positive x-direction, i.e. to the right). To get a less jerky movement, you might check closer distances/use a smaller jump distance in the arrow key actions.

Try your game out just to check that the player moves correctly in response to your keyboard commands.

In the official Game Maker platform game tutorial, it is suggested that gravity should only be “switched on” when an object is in mid-air - that is, when it unsupported by a solid platform block.

To test whether or not there is anything below an instance of an object, we will use a Step event to repeatedly check whether there is anything immediately below the player character sprite:

If the player character is in mid-air, turn gravity on:

(The direction - 270 - is 270 degrees, measured in anti-clockwise direction from an origin of 0 degrees that points to the right. So 90 is straight up, and 180 is directed to the left…)

Otherwise, turn gravity off, by setting it to 0.

As the setup currently stands, there is no reason for the player character to stop moving through any platforms beneath it once it starts to fall. To stop the player falling through a platform, we need to set its vertical speed to zero when it collides with a platform block.

…then JUMP

When we press the up arrow key, we want the player character to jump up. Can you work out how we might achieve this?

First of all, we need to ensure that the player is stood on something, so that they can generate the necessary force to lift itself off the ground… (physics again! Remember that ‘equal and opposite force’ law…?!). Check that there is something immediately below the layer sprite:

That is, we check that the there is NOT an empty space immediately below the player character (that is, at a y co-ordinate +1 relative to the current location of the bottom edge of the player character).

If the player character is a underneath a platform when it jumps, what happens? Can you explain why? Can you also explain why, when the player character jumps, it does not keep floatng up the room?

Experiment with various settings for the gravity in the room, the speed with which the player character jumps upwards, and the height and spacing between platforms). Can your player make it onto every platform? Try building a tall, vertical wall in the middle of the room and place platforms in such a way that the player character must bounce from one platform to the next to get over the dividing wall, and so cross the room.

Gravity Waves…

Many games utilise a common sense notion of gravity as part of the overall game mechanics. In Line Rider, the sledge rides the line under the force of gravity, for example; in Launchball, the ball is affected by gravity; and in the Newtoon physics game, gravity (as well as electrostatic forces) can be modeled within the game.

The Phun 2D physics sandbox also provides an environment for creating animations that explore a gravity filled, abstract digital word:

(Unfortunately, phun isn’t released for Macs…. yet…)

At the simplest level, the effect of gravity can be seen in games where things ‘drop’ from higher up in a room to the ‘floor’, and maybe bounce around a little when they land. The speed (or more correctly, velocity) of the item increases as it drops - that is, it accelerates due to the force of gravity. If the item bounces when it hits the ground, the height it bounces up to is related to the height from which it was dropped in the first place - another consequence of the “physical laws” implemented by the game (in this case, a consideration of the kinetic energy of the object as it hits the ground, and the angle at which it does so).

So far, so basic physics…

I bet you always wondered what physics was good for, didn’t you? Well this is it - creating games and game engines! If you would like to learn more about the details, such as how gravity works “in the real world”, and how gravity can be modeled mathematically (so that it can be implemented by a game’s physics engine, for example), try working through the OpenLearn unit Motion under gravity, or the more mathematical Describing motion along a line.

So - how do we add gravity to a Game Maker game? Very easily, in fact.

Create a new game, add a couple of sprites (such as the clown or a simple monster sprite, and a wall sprite), a couple of objects and an empty room.

Configure one object as a wall object (no events or actions required - just a solid object), and add a wall along at least the bottom edge of the room:

Turning now to the ‘dropping object’, configure it with a Create Event that is handled by a Set Gravity action. When you start running the ‘game’, you may wish to experiment with the gravity settings to see what happens… If there’s anything you don’t understand, raise it in a comment…

When the dropping object collides with the floor/wall object, we need it to do two things: firstly, we need it to bounce:

Secondly, we need to model the change in velocity, and in particular lose energy. If the collision was elastic, then no energy would be lost during the collision and the object would bounce back to its original height. In an inelastic collision, however, energy is lost from the dropped object, and it will bounces to a lower height with each bounce.

Place several instances of the dropping object in the room at different heights above the solid floor, and run the game. Does each instance bounce to a different height?

One of the popular exercises in basic animation is to animate a bouncing ball. In Game Maker, the internal ‘physics engine’ handles most of the animation work for us. To make the ball look more realistic, it is often set spinning. See if you can design, or find, a multi-image sprite to simulate a spinning ball.

Experiment with various gravity settings in the initial object creation event. What does the direction setting determine (and how do you know which direction gravity is acting in?) Also experiment with the vert speed setting in the collision action. How significant is that setting in terms of the mechanics of the bounce ‘feeling right’?

Create a room that contains a series of platforms, made out of wall objects. The player character should enter the room at the top!

Configure the player character object so that is can be controlled using the left and right arrow keys. If the player character walks off the edge of wall platform, it should fall under gravity until it lands on a wall object underneath. (In the player object defined below, I have inherited the gravity behaviour form a parent object.)

To add an element of risk to the game, add one or more instances of a poison object to the room that will kill the player and send it back to the start. Experiment with adding one or two more instances of the dropped/player object to the room, all of which will be controlled by the same keyboard commands. The aim of the game now is to get all of the characters out of the room without killing any of them…

Alternatively, you may wish to add some treasure to the room (in which case you’ll also need to keep track of your score!). To add a little bit more tension to the game, how about creating a key object that must be collected from one of the platforms halfway up the room that will unlock a door leading out of the room on the ground floor platform?

What “issues” does your game have in terms of its playabilty? Do the objects bounce appropriately if they hit the wall at an angle? If the door out of the room is not on the lowest platform level, is there any way for that player character to get out of the room?