Posts Tagged ‘design’

How I make levels

Tuesday, July 13th, 2010

One of the most frequent questions I get is how I go about making levels for Sarah’s Run, so I shall share!

first of all, there has to be an idea for what I want in the level, either in my head or on paper, making it up as I go is possible but it takes a little while and its very likely I lose my train of thought before I get anywhere. so, have a plan, you can come up with one of these anywhere, I was at a train station yesterday, killing time, when I drew this:

sure it’s messy, but it’s enough that I can recognise what I was going for with it and could get on with the level making once I got back to my PC.

First up, TILES!

I made these and set the texture co-ordinates in Blender a while back, if they are unwrapped at this point it saves time later on when I tweak the texture co-ordinates.

Tiles are pretty sweet for a number of reasons, firstly they are super fast to make levels with, and because I can put them together in Unity itself, I can test the level as I make it really quickly, rather than building the level in another 3D app, and exporting then importing and tweaking settings every time I want to see if a ledge is the right height or a gap is wide enough.

The downside to tiles in unity is that they *can* be very inefficient, especially with how many are in many of the levels in Sarah’s Run, hence why I place them all inside a ‘LevelMesh’ game object that combines all the seperate 3D models for each tile into a single mesh, meaning that whilst I’m testing drawing the level takes only one draw call, and not about 3000 (I had 7000 draw calls per frame sometimes before I decided I should fix that lol)

so what follows is lots of adding, testing, tweaking until the level is playable;

So, I can play the level, but it’s not easy to ‘read’. that is, you cant look at the level and quickly see what form the level has, it’s pretty messy. So we need to juice up the graphics a bit with some lighting (the best way to give a 2D image form IMO) and also make the textures more… good πŸ™‚

so, we export the level and take it into Blender (the export script I use is found here for you unity junkies)

first up we tidy the mesh and clear out any faces that wont be seen, and also use a more recent texture atlas:

Once that is done, I go around and move the UVs (texture co-ordinates) for different faces so details like the floor borders look right:

So that’s what folks call the ‘diffuse’ (unlit) texture sorted out, but in Sarahs run my environments have both a diffuse texture and a ‘lightmap’ texture that describes the light in the level. so first step for making a lightmap is I put in some meshes I want to act as ‘lights’ set them to emit and get blender to calculate ‘radiosity’. it sounds complicated but mostly I click ‘go’ and play some guitar hero until it’s finished.

once the ‘light’ has been calculated, I ‘bake’ it onto a texture (that means I get one mesh to copy whatever the lighting is on each face to the relevant part of a texture map). you can see the baked texture on the right of this pic:

here’s what the level looks like when we take it back into unity, with both texture working together (after a little tweaking the brightness):

and just adding the deadly floor and the level is complete!

You can also play the level here if you like.

this is where I say the level is ‘done’ but that isn’t really the case, if this level was going into the game I would have to make quite a few tweaks, such as offsetting the two ledges, especially if it appears earlier in the game, and I’d need to adjust the size of the gap, how high the electric ceiling is etc. I’d also like to test if it works better as a 2.5D level (like level 5 in the preview) I suspect it would.

anyway, hope you enjoyed that. πŸ˜€

A Hub

Sunday, June 6th, 2010

Not much to say today, I’m pretty busy just working on the new preview, squashing the last few bugs, and tweaking the levels and such. I added this yesterday though, a ‘hub level’ personally I think they are much more interesting than a level select, and you dont feel like you are pulled out of the game world when asked which level to play next.

Lights on the ‘Camera Action’ :D

Friday, June 4th, 2010

So I asked on twitter if there was anything folks wanted covered on the devblog and @tyronehenrie mentioned the camera. Seeing as it’s an interesting topic (I think anyway ^_^) and it’s the thing I’ve spent the most time on, here’s the post πŸ˜€

The main design issue with the camera, is that it is actually two cameras, one for mouse users, and one for gamepad users, and it has to be able to tell which is being used at any time and behave accordingly.

A little ranting first…

I’ll take this oppertunity to justify why Sarah’s Run supports a gamepad even though it’s only going to be released on Windows and OS X (for the forseeable future anyway). Β The reason is for most games, gamepads are simply better. look at your keyboard, thats for writing. Now look at a gamepad, that’s for playing games. Now look back at me, I was inspired during the games early development by console platformers that never really worked on PC very, gamepads worked well for them.

So I know going in that this type of game traditionally suits gamepad best, the buttons are all within reach, analog control is wonderful etc, its all good. But I also know no matter how much a beg, no more than 25% of PC gamers will have gamepads and even then plenty of those will be at the bottom of some box tangled up with other random things and wont get used anyway. I have to make the game feel good on PC, and this isn’t just some port of a console game to squeeze a few extra bucks, this is a PC game; the controls have to feel good on PC, and the camera is a very (if not the most) important part of that in a game like this. The camera is the player’s eyes into the world after all, few people want to be without their eyes.

The quest for a good camera!

The first thing I did was to look around for platformers with good camera control on PC; I gave up pretty fast, 3D platformers on PC for the most part suck pretty damn hard. So plan B then, what really works on PCs? the mouse is a super good input device after all.

The answer is obvious really, first person shooters have a pretty standard control set and behaviour, plus it drops onto Sarah’s abilities pretty cleanly. (it’s mostly running and jumping after all)

So what’s the difference between the camera’s mouse control and gamepad control, and how did I get them to work? I’ll start off with:

1. Gamepad Camera

The code that drives the camera can pretty much be described in two steps:

  1. Position the camera at the center of its orbit (where it’s looking at, AKA Sarah)
  2. Translate the camera backwards

This keeps Sarah in the center of the camera’s view and a constant distance from the camera, and we can get different behaviour by doing extra stuff around these steps.

For the gamepad behaviour, we want the camera to ‘follow’ Sarah, so if she moves left relative to the camera, the camera turns left to see where Sarah is going. Β much like in this diagram:

This behaviour is pretty standard for most all platforming games (even on PC, which I think is why most 3D platforming sucks… more on that further down). here’s how I go about doing it;

First of all, before positioning the camera at it’s target (Sarah), we make the camera look at it’s target.

This way, when we translate the camera back, the angle it’s looking at is different (if the player has moved) and it wil be looking more in the direction the player is moving. This process will be repeated each timestep and gradually the camera will pull behind the player.

I think this is the ideal behaviour for the camera, as it is showing where Sarah is going, she is always on the screen, and I even have the camera favour looking down a little, all so you can see where she is standing and you will almost always see what is relevant to the immediate platforming around Sarah. If there is a pit you likely wont miss it, if there is a gap you can best judge how wide it is.

But the player can control the camera too of course, that step comes after positioning the camera at it’s target and before translating it backwards, we just rotate the camera by however much the right stick is tilting. This way the camera orbits Sarah however the player likes. Plus we stop doing things like the camera favouring looking down when the player is directly controlling the camera; it’s not just that they might be wanting to look up, but if the player is changing the camera odds are it means they aren’t happy with where it is at the moment. So it’s not wise to impair the players control.

and that brings us to…

2. Mouse Camera

As I mentioned before, even on PC most platforming games have a camera that tries to follow the player character and look in the direction they are moving, this is frankly an asshat’s move and here’s why:

On a gamepad, if the camera turns a little and you want to keep moving in the same direction you just alter your input on the analog stick a little, it’s smooth, it feels natural.

On PC, if the camera turns a little, you have no analog input, you have four buttons, thats Eight directions total. When movement it relative to the camera, when the camera changes, all your buttons change. You can’t ease from one to the other really and you either end up running in a squiggly line or falling off the edge you were trying to avoid, or both. All because the camera changed.

We can keep our analog control by giving the player complete control of the camera with the mouse (the analog input on a PC), and because movement is relative to the camera, we can still weave in nice curves by running and steering with the mouse, just like in an FPS.

In practice, making the camera work this way is really just a case of taking the gamepad behaviour (look at target, position at target, rotate, translate back) and removing the first bit (look at target).

Like this, when you are pressing left, so long as the player doesn’t change the camera, left will always go left. And if the camera is changed, it’s because the player wants left to be some other direction within the game world.

Seeing as I’ve gone on long enough…

That’s pretty much it, we have both ways the camera can behave, and if the game detects no mouse movement for a while, it eases into gamepad camera behaviour. Overall I’d say it feels pretty good, and it certainly took a while to get it to the point where people didn’t complain about it when playing. Which is understandable, when the player’s control over something in a game feels bad, the game feels bad. And in this game, the camera is as important to control as the player character; the look is as needed as the leap so to speak πŸ™‚

That’s not all there is to the camera though, for example the way sarah can run up walls gave me endless headaches for getting camera behaviour right (it still presents issues from time to time, but the number is always going down!) I think thats enough for today though. I probably went into way more detail than anyone wanted anyway. ^_^

So, What is “Sarah’s Run: Escape from Capital Evil” then?

Monday, May 10th, 2010

been meaning to cover this since I started the blog, and didn’t quite know how to describe it best, but a comment someone left me on deviantArt today seems to fit pretty well:

“It’s like my highschool physics class combined with sonic… Combined with a really bad headache.”

Gameplay:

If you want to label the gameplay, it fits the description ‘puzzle platformer’ pretty well, as there are puzzles, and platforming, though normally a ‘puzzle platformer’ involves being a platform game with a block-pushing puzzle somewhere on each level, it’s my intention with Sarah’s run for the platforming and the puzzle solving to be sort of one-and-the-same, the platforming is the tool for solving the puzzles.

That is to say; most of the time the goal in any ‘area’ in the game is to reach a specific point, just like in most platformers, however there are very few routes that can be taken to get there and it should require some planning. If you have played one of my other games ‘BOXGAME‘ it should (hopefully) be fairly clear what I mean when I say the puzzles are ‘navigational’ in nature.

Story:

Our Villain, the evil Doctor-Hasn’t-been-named-yet is tired of all his cunning plans to destroy various Orphanages and Kitten shelters thwarted by the new rising super-hero Sarah. And what’s more she has the nerve to use a new type of super-power that science just doesen’t understand yet:Β  manipulating gravity.

As a scientist, this simply won’t do, and so he kidnaps Sarah, and takes her to his facility known as ‘Capital Evil’ to study her, punish her and hold her for ransom (who says villains can’t multi-task!?).

Can Sarah subvert our nasty villain’s experiments and escape Capital Evil, perhaps even put an end to his villanous villany?

The story for Sarah’s run started out as quite a horrible, horrible thing before this, but I went to my super-friend Logan and this is what we worked out together (also as well as being co-writer for the game, Logan will be supplying his lovely voice for the villain).

I’ll probably go into more details about the story as more of it and the characters in the game are finalized, however I’ll likely be keeping quite a few things back, the game will be pretty lighthearted, but I’ve got lots planned and dont want to spoil it πŸ˜€

Stacking problems makes for more interesting puzzles

Saturday, May 8th, 2010

I know I said I’d be making a decent introduction to my game saying what it’s about and stuff, but I’ll leave that for another day as I’d rather talk about what I’ve done today, and the thinking behind it.

A new level I made today, just for you... well really I made it for me but I'm in the mood for sharing so you are lucky πŸ™‚

In this post I’ll be going into detail about a new level I made, so if you dont want ‘puzzle spoilers’ (if such a thing exists) then you can play here before reading.

this level was made as a quick test for a feature I coded today of what I call a ‘drain field’; when Sarah passes through it, she can’t use her wall running powers until she reaches a recharge point.

Why I made these new ‘drain field’ things:

this is a similarish use to what I originally had in mind for recharge points, Sarah would only have so many ‘uses’ of her wall-running before having to return to a charge point to refil them. after a little testing it turned out this created very few extra possibilities for gameplay, and mostly meant 400% (figure may be a guess) more backtracking, so this was ditched in favour of a ‘limited time’ power, so I can have walls that take longer than the timer allows to traverse, causing sarah to fall off the wall unless she can make it to a recharge point and max out her wall-running timer.

This worked out pretty well, but resulted in very few possible situations where a recharge point was actually neccesary, and I did like how not being able to use your ability before getting to a recharge point forced a certain type of traditional platforming, essentially changing the way the player has to see the level until they are ready to run along walls again.

Complex problems are just sevral simple ones bundled together:

And thus, the drain field was born. I like it particularly because it lends itself very well to how I design puzzles; any problem is simple on its own, but when sevral simple problems are combined it makes for a more complex one where the player is best off standing back and trying to figure bits out step by step. heres an explanation of how this works in todays level:

simple problem #1:

The button is on the wall, you cant stand on walls

simple solution #1:

use your super power, then you can stand on walls!

and we can make this ‘puzzle’ more complex by adding another problem, specifically the problem being the removal of the solution.

simple problem #2:

cross the field, and you wont be able to use your power

so the solution is to find a way use your power, in this level you must do some platforming to cross the field and find a recharge point, but I could just as easily force platforming and have a gap in the field to navigate to, or some button puzzle to turn off the field etc, all possible solutions to the problem I will explore as I plan my levels.

The Point is…

the point, which I’m probably not being all too clear about, is that with a wider range of simple problems to choose from, the combination of these different problems can create a vast range of potential complex problems, and keep the game both interesting and challenging.

also, it’s my hope by forcing the player to navigate without using wall running powers I’ll be able to make parts of my levels contain more traditional platforming with bouncy, slippery and moving surfaces I had (and quite enjoyed) in my early builds but not so much since adding the wall running power.

what do you think of my approach to puzzle design, is it a little too simple, as all the puzzles can be potentially solved by deciding where you want to end and work backwards step by step, or is that the perfect way to have to solve a puzzle? any suggestiong for alternatives?

Development Log catchup

Friday, May 7th, 2010

I thought seeing as this development blog is starting after already a lot of development I’d play catchup and go over the story of Sarah’s Run development so far:

ok then, where to start… how about the BEGINNING!? πŸ˜€

its February 28th 2010, and I’m working on my game Phantasmal, things are going pretty well, but I like to take breaks every now and then to keep my work feeling fresh, so I do a doodle with the thought: “what if Mario and Peaches actually had sex”

Super Maria, in all her potentially copyright infringing glory was how I met Sarah

Ok, so its a pretty cool doodle, time to get back to my main project… but wouldnt it be cool if I made a 3D model of this character, I do need practice making models from my concepts after all, thats some skills that will help me make phantasmal too!

I made a model, unwrapped her, might as well paint her next...

pretty good, one of my better models and textures I think...

Pretty good, one of my better models and textures I think...

ok, not bad for a days work, tommorow surely I’ll be all fired up to work on Phantasmal some more!

but tommorow came, and I found myself thinking… well what good is the model if it isn’t rigged and animated, and maybe if I do that, I can drop it into the phantasmal engine and maybe tweak it a little to play like super mario, just for fun. but these ideas were just passing thoughts, surely…

oops...

...now she's animated...

...well I guess I made a super maria version of phantasmal after all >__>

So it turns out I kind of had already taken 2 days off phantasmal andΒ  I already had the begginings of what felt like a pretty solid platformer and a cool looking character. (this version is playable here by the way)

the next day I just feel its probably best to work on this game some more, it shouldnt take me too long to finish after all… but by the end of the day (after adding moving platforms and conveyor belts) I make the following tweet:

“things that are good but actually make me want to kill myself #1:
something I’ve spent 3 days on is way more fun than my main project”

and thats the point where phantasmal takes a backseat, at heart I want to make the best games I can, and besides, the last time I stopped working on on Phantasmal to do another project, it went down pretty well.

so with my resolve to take on super maria, and the desire to make a new Mario/Sonic/Crash/Spyro type game that doesen’t suck.

First off I spend some time playing around with effects I could use for a power up/invincible mode.

doesn't have a purpose yet, but an effect this cool? I'll find a place for it!

next thing I do is see if I cant get ‘Maria’ to stand at an angle on slopes like mario and sonic do, I always wanted to see if I could pull that off, and it turns out I can, but ‘standing’ on slopes is no fun on its own, you gotta be able to run along them too. though I hadn’t quite thought “check that the slope isnt too steep to stand on”. I had a build where I could run up near vertical surfaces, and that got me thinking, and then tinkering:

Con: Quitting work on phantasmal to make a game about fucking with gravity is somewhere I've been before

Pro: HOLYFUCKAWESOME RUNNING ALONG WALLS IS FUUUN

Here’s a game design tip for you; if any of your pro list items contain ‘holyfuckawesome’ your con list doesent matter.

so that was it, running up walls is cool, and it turns out if you limit the ability some it can make for a pretty interesting navigational and puzzle mechanic. I spent the rest of march pretty much planning how levels in the game could work and how I could put them together quickly. I even put together a test preview with five levels which was pretty well recieved by my friends and internet lovers, and worked with my e-brother Logan on an original story, title and name for the character so I wouldnt get hit in a drive by from a Nintendo van.

"Green Hill Zone called, they want their textures back" - I find checker textures are perfect during prototyping/early dev

I think that’s us more or less caught up, I’ll make a ‘what is sarah’s run’ post soon and I’ll go into much more exciting detail about design deciscions, coding approaches and stuff in the next few posts. πŸ˜€