Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more

Tech

Game Dev Diary (Pt.13) - Eye Candy And Easter Eggs

Posted by Mark Alexander on 29 May 2015

When I play a game, I am always on the lookout for little details that make me laugh or that immerse me further the game world or that simply make me think "that was cool!". These details, in general, have nothing to do with the gameplay, add nothing to the main plot, nor do they change anything in the game world, but they are still often the high points of a session for me. What I'm talking about are easter eggs and eye candy - two things that add far more to a game than you might suspect at first glance.

Eye Candy

What do I mean when I talk about "eye candy"? Well, I'm sure you immediately think of things like explosions and special effects, but to me the phrase "eye candy" is much, much more.

To me, eye candy is anything that adds to the visual impact of a game without having any real influence over the gameplay, although it can also be used to include subtle visual clues for the player too. This can be something like a bird that flies over the screen when the player is viewing the overworld, or it can be a rat that pops out a wall in a platformer, or it can be the way the healthbar "bounces" up and down like a spring when the player takes damage... Basically, it can be anything related to the graphics which serves no purpose other than to make your game look nicer and so immerse the player better.

Easter Eggs

An "easter egg" is another one of those seemingly pointless details that I love to find in games. Essentially they are little bonus items or moments that the player gets for doing something unexpected or for having completed a particularly difficult or hidden goal. Game developers love to put easter eggs in games, to the point that some of them have so many - like the GTA series - that players can spend more time hunting for them than they spend to complete the main game! This habit allegedly started with the Atari game "Adventure", but all game developers quickly picked up on the idea, with perhaps Konami and their Konami code being the most famous (try it on this page...).

Why are easter eggs so popular and why do I consider them essential to a good game? People like surprises, and that goes for the players of your game too. They like to have their perseverance - or stupidity! - recognised and rewarded in some way so that they don't feel that their actions were for nothing (even though they probably were essentially). They also like to be able to say to friends "Did you find that easter egg in <such-a-such-game> yet?" and then boast about it or share it like some intimate secret. Easter eggs appeal to the player's curiosity and sense of achievement, and it's that which will drive them to search out every corner of your game and explore every detail far more than just the main plot or gameplay mechanic will.

So, easter eggs and eye candy are important in any game, with easter eggs giving the player a reason to experiment and explore, and eye candy making the whole experience prettier and more coherent as well as providing necessary visual clues for important events. In Skein, I have a number of special effects that I would consider eye candy, so let's explore a few of them first and I'll explain how they were done and my reason for including them.

Particles

The first effects I programmed for Skein were the particle effects. Particles are a fantastic way to get interesting and spectacular graphic effects with very little processing overhead, although for targets like HTML5 you have to be a bit more careful with how you use them (I have a tutorial on how to get the most from particles here). I've gotten into a routine now for particles whereby I create two global systems at the start of the game - one with a very low depth and the other with a very high depth - and then call a script to define all my particle types (also global).If I need a new effect I simply define another global particle type in this script and can then use it anywhere in the game, bursting it either beneath all the game instances or above them. I built the same system for Skein and started creating some effects - smoke, fire, gold pickups, using a potion, eating food... these were all things that I used particle effects for as I only needed to nicely communicate to the player that something has happened, letting the effect itself convey to the player what it was.

 

Particles are pretty much a "stock" effect in my games, but I also like to use debris effects too. When playing a game, especially one where I can explore my environment, I love to find debris from previous battles littering the floor - it provides a sense of accomplishment as well as a marker for where I've been and explored previously. So, I almost always have some kind of permanent debris effects in my games and Skein was to be no different!

Debris

Creating debris effects that are permanent can be tricky... you can use instances that simply do nothing but draw themselves, but that's a bit of a waste of processing power since the instance will still be getting checked and updated every step. You could also have a controller object that stores the position and type of debris required and then draws all of it at once in a loop, but with a lot of debris this would quickly slow things down too. The obvious solution to these issues is to use a surface for debris, which is what I do in Skein.

Since levels in Skein will never go beyond the 1024x1024px size, I can create a single surface the size of the room and then use it to "catch" the instances that I want to use for debris (if the room were any bigger then I'd need to create multiple surfaces and "tile" the room with them). For example, I have skeleton warriors in Skein and when you kill them they break up into bones that fly about the room. These "bones" are simply instances of a special object I created just for debris. This object has no sprite and a very little code, and is only created through a script when an instance is destroyed. In the script I set the sprite index and - optionally - the speed and colour and so it can create multiple different debris effects from a single script call:

/// scrCreateDebris(sprite, [speed], [colour]);
var n = spritegetnumber(argument[0]);
for (var i = 0; i < n; i++;){
with(instancecreate(x + 4, y + 4, objDebris)){
    if argumentcount > 1{
        speed = argument[1] + random(argument[1]);
        if argumentcount > 2{
            imageblend = argument[2];
            }
} sprite
index = argument[0]; imageindex = i; } }

The debris object has a check in its Step event for when the speed drops below 0.1, and when that happens, it draws itself to the debris surface and then destroys itself. The player is unaware of this happening and all they see is that there are bones on the floor from where they have killed a skeleton. It's a great effect and very easy to set up and cheap as anything to use!

<img src="http://media.indiedb.com/cache/images/games/1/41/40799/thumb620x2000/Skein_Debris.png" alt="" />

Shaders

Shaders are another amazing resource for creating delicious eye candy in games, but they can also be used to create much more subtle or minor effects. I'd love to take this opportunity to dazzle you with my mad shader skillz, but unfortunately I have to confess to knowing little about how to program them. In fact, Skein is the first time I've actually created any shaders but the few I've added work well, do exactly what I wanted, and provided a valuable lesson along the road to learning how they work.

For example, I wanted a way to colourise a full sprite to a flat colour (ie: no blending), so wrote a very simple shader that does just that - it's used when the main character takes damage as a visual cue for the player. Another shader I've used is one I wrote to create a "vignette" feel when the game is paused. Again, this is a simple fragment shader that simply desaturates the inputs then colours the output with a sepia colour. 

 

You can see both shaders at work in the image above, and I'll no doubt create other ones as the game development continues, especially now that I have a bit more confidence in what I'm doing! 

PS: Note the little bouncing "p1" and "p2" markers. More eye candy but useful too!

Unique Effects

Apart from the above I've also had to create certain unique objects that I can create for very specific special effects. These extra objects are necessary due to the fact that some things, like certain magic spells, or enemy "aura" effects, require something that a particle or surface effect just can't do.

The other reason I made individual objects for a lot of these effects was to try and limit the vertex batches being sent to the GPU. You see, when you set a blend mode, you break the vertex batch and doing this too often in a single frame can result in pretty poor performance (especially on mobile). So what I've done for these magic effects that use additive blending is create a controller object with a really low depth, then in that I have a draw event that sets the blend mode to additive, calls event perform for the draw event of all the effects objects - they have a single parent to make this simpler - and then resets the blend mode. The effects objects themselves are flagged as being invisible so that they don't "natively" run their draw event code. Now all the instances that use additive blending for an effect will be draw at the same time and require only a single vertex batch... which is a good thing!

Polishing Eggs

What about easter eggs? I haven't implemented too many of them into Skein yet, as they will be something that I'll work on in the final push to polish the game for release, but I have added a couple in there already and have a few more planned. For example in the intro scene the main characters pass by some ruins and out fly a flock of birds, but - once the introduction has finished - if the player then clicks that same area they can also trigger the birds. Why? Because I can! I've also made it so that if you trigger the sheep transform spell (shown in the gif above) when the other player is within the radius, then the other player gets turned into a sheep dog for a short time!

I'm planning a few more too, like having Death killable to get a special reward (it'll take a long time and a lot of patience), as well as further extras for using specific magic on things you probably shouldn't etc... and I'll have hidden areas with special (silly) magic spells or massive amounts of loot. By the end of development I really want to have as many little surprises as possible in the game as it'll give another challenge to players to find them all, and provide an extra level of immersion and interaction between the player and the game.

What next?

Skein has come a long way since I started making it, and although it's grown technically it's not grown too much in scope which is just what I wanted. The core gameplay was the same frantic mix of exploration and fighting that I originally envisioned, with only a few extras thrown in like the spell system, which meant it was time to flesh things out with a decent introduction, tutorials, game over screens and a save system... all of which we'll talk about next week!

 

Back to Top