Level Editor Video – The Inside Scoop

Originally posted by Jens.

Continuing the topic of my last post, here comes a post about the creation of our latest video…

What we wanted to do in this video was to show how quickly you can create something playable using our Level Editor. So we decided to take 30 minutes to build something, use another 10 minutes at most to do some gameplay scripting and then finally show it all in game.

To make it all viewable without spending more than 40 minutes watching a video we time lapsed it all down to about 8 minutes. While working on the video we also wanted to add a voice, describing what was going on, but it did not work very well. To make this properly, you should write down what you want to say first, then record and edit the material after the spoken text. So it got difficult to make a voice that would have enough time to properly say what was going on during the very fast level editing (due to the time lapse). As I was battling with this problem I had a chat with Thomas, who joked that I could “write it all in verse”, which I thought was actually a pretty good idea. Then I could have some voice talking, making the video more interesting but not need to be overly specific in what is said, so it could be more freely added to the visual editing going on in the video.

It took me about 4-6 hours to write the whole thing for the full video and then another 2 hours to record and edit the voice. Then I showed Thomas the video…

He got a bit worried, with good cause, that the video could give the wrong impression about the game. Is the game a parody on the horror genre? Or what is really going on? So after some discussion we decided that we should probably skip the voice altogether and only add some nice music or else the video would go on consuming time we need to spend on the game!

To cut things short, here you have the final demonstration of our Level Editor! We have shortened it a bit, then removed the actual scripting part as we felt it looked more difficult than it actually is. But to give you all the goodies, at the bottom of the post you can find the script with comments, to give you a view of the amount of script needed (and to show that a lot of gameplay is done automatically by the objects in the game). I have also, for everybody’s pleasures, added the original verse. It’s not structured correctly but hey let us call it free-form verse.

Have you got any questions about the editing or scripting of levels for Amnesia? Shout them out in the comments!

Gameplay Script:

As you can see, if we remove the comments (in green) it is a total of 19 lines of script code!



// This is the initial setup that is done when starting the level

void OnStart()

{

// Check if Player enters the area called AreaExit, if so then do the CollideExit function

AddEntityCollideCallback("Player", "AreaExit", "CollideExit", true, 1);





// Check if Player uses any of the two keys on the desk or door if so do the UseKey function

AddUseItemCallback("usedesk", "key_desk", "desk", "UseKey", true);

AddUseItemCallback("useexit", "key_exit", "mansion_1", "UseKey",true);





// A timer that will activate a function after 120 seconds

AddTimer("enemy", 120, "TimerActivateEnemy");





// This says to play the music file 04_amb.ogg, that it should loop, play at volume 1, start with a 3 second fade, have a priority of 0 and that it will resume where it ended if the music is stopped and played again.

PlayMusic("04_amb.ogg", true, 1, 3, 0, true);





// Adds a quest for the player, escape is the name to use in scripts and XXVideo is an entry in the file that contains all the text for Amnesia.

AddQuest("escape", "XXVideo");





// As this level is for testing, we give the player a lantern at the start of the level

GiveItemFromFile("lantern", "lantern.ent");

}





// The timer function that is called after 120 seconds from start of level

void TimerActivateEnemy(string &in asTimer)

{

// Slide the door open leading to the room with the enemy

SetMoveObjectState("door_1", 1);



// Activate the enemy

SetEntityActive("grunt_normal_1", true);



// Play an extra sound to warn the player

PlaySoundAtEntity("enemyBoo", "notice", "door_1", 0);



// Give the enemy a patrol node so that he will start to move into the large room

AddEnemyPatrolNode("grunt_normal_1", "PathNodeArea_5", 0, "");

}





// Function for when using keys on the desk and door

void UseKey(string &in asItem, string &in asEntity)

{

// Set the entity(desk or door) to unlocked

SetSwingDoorLocked(asEntity, false, true);



// Remove the item used from the inventory

RemoveItem(asItem);

}





// Function triggered as player enters the exit area

void CollideExit(string &in asParent, string &in asChild, int alState)

{

// Show quest complete message, using XXVideo entry in the text file.

CompleteQuest("escape", "XXVideo");



// Change the map to 02_entrance_hall, player start in area PlayerStartArea_1

ChangeMap("02_entrance_hall", "PlayerStartArea_1", "", "");

}

Without further ado, a Christmas carol just for you:

Jens I am, Frictional Games I curse you damn –
“Bastard from hell, don’t force me to tell!”
“You better sing it like a snake or else you won’t get that cake!”
“OK, OK I’ll spill it all!”

You see, I got a call during the fall… a dude handed it to me “Man, what can you do in 30 minutes short, using that editor of yours, I’ve heard its like snort?”

Lo and behold, I told. See you do it like this. Half an hour building the base, 666 seconds to script, not even taking a piss. To not bore you stiff, check my time-lapse I’m fast as a mastiff, pay attention or get lost in another HPL dimension.

With sets of 3D tiles, even kids will get smiles. Easy as copy that floppy a room is crafted, damn it might even get you drafted. Walls, windows, ceiling and floor comes in different flavours we all can adore, combine as it unfold, see how I build a top so gold. Press B to compound create, it will save you from being late.

Feisty as they are, Entities of many kind makes the world go round, what ever you can find, make sure to use them sound. At times like these, a light or two will surely brighten the mood, where art thou tease of a candle? Shine upon my wood so I can tweak it further, it can’t look as if created by a vandal.

A bed or cradle to take a nap, drawers and a table, you know, we even have a horse stable. Crap! Thomas – damn you and your ideas, “write it in verse” your words gave me this curse! I hope the christmas sock has nothing but peas (this should rime with ideas).

It is all pre-configured, place it and you won’t have to go figure. What the player can do, we have already turned to our attention, it works as I mention: Doors swing, drawers pull, boxes carry, if a berry found it can be eaten, it will even crunch as you munch.

Entities of light is best placed in the dark, it will show their proper mark. Some gameplay they have, with the player around it can astound – as the Tinderbox comes to use, sort of like a fuse. Paintings, paper and books you could have them all on hooks, but let’s put them all at their proper places: Walls so fine with a painting of mine, a desk is best if placed below papers and pen, the book from the den fits perfect by the pillow, perhaps something about Willow? Where did I put my glasses? Argh, it did not rhyme with places, it must be time for tea, why those long faces?

Adding a chest for treasures to keep, it is as safe as it is true that a mouse says “meep”. A key for a puzzle and tinderboxes, just for the dazzle, put them all in. Remember though, it will cost you a dime if you want to get them back, not gooey in slime.

In a closet so small, Santa will fall. We poked him with a stick, to really make him tick. Locked behind a door he can’t get out, but as I’ll later shout – we can script some dangerous code, letting him get out finding a node. Like bread crumbs Santa can follow, the player better hide in hollow or better yet! Escape the room avoiding Santa’s evil bloom.

Speaking of which, let’s brighten it all up in a hitch. Spotlights in windows, shadows will cast, a gobo can be added just as fast. Size and colour adjusted with ease, we promise you do not need to lease a professional. This has all been very visional, just one more thing. We need glory fitting for a king, rays from the windows to shine upon the gory inner part of our highly technical art. Tweak it back and forth, you can really make it worth by adding particles as pretty in the light as pickles are delight.

Let’s continue on and write that script or else Frictional will throw me down the crypt!

Music, oh music, my kingdom for some music. With one line of code, some music will load.

Add a timer that when 60 seconds pass, a Santa will get on your ass. Add a noise, to make sure the player has a choice. I forgot it at this point, but later I will make the door open as though pushed by a spring joint.

With a few lines of code two keys of use will be. On a desk and a door both will see, that there is no stopping me. Writing code should be made with care, not like here – I wrote a lot but “SetSwingDoorLocked” would have made a perfect knot. Erase it all and do it proper while standing tall.

An area we placed, to check if the player is correctly paced. If they collide, we should take it with pride, load a new level and end the player’s ride. Took it for a test. But quickly noticed what a mess! Some last minute fixes, should make it all work without any trixes. A patrol route here, a remove item there, it starts to feel polished, if only the player knows it all clear. As a cooking show on TV, I prepared some text in a file that will make it all worthwhile, with a big bong a quest is heard making the player follow the herd. One minute the timer was short, Santa came out furious and picky, I had to increase the timer in a quickie.

And so the carol reaches the final destination, the player’s faith I won’t even mention. Take a look, hope we got you on the hook!