Saturday 12 December 2009

Level Editor Video - The Inside Scoop

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!

The Video (our first HD release!):


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!


36 comments:

  1. What a beautiful carol.


    Hvorfor daler som møntenhed i Amnesia?

    ReplyDelete
  2. I really enjoyed watching/reading this. I really like these things about your tools because it helps me with ideas how to design my own game and eventually my own tools =)

    ~DtD

    ReplyDelete
  3. Oh man this looks so great! The editor and scripting looks pretty easy and very flexible. Fun to get a glimpse of some of the game mechanics as well... tinderboxes, thalers and sanity, I like it! Using coins to open chests seems a little strange, though. I like how you've made the physics of opening doors and drawers easier to do. I can't wait to get my hands on this game!

    ReplyDelete
  4. Wow, that was a truly awesome demonstration. I love that you guys are really making an effort to make modding relatively easy and fun-looking! The room was of a simple design, but what you pulled off in those thirty minutes looked pretty damn good to me.

    And I liked the song you made, but I'm glad you kept it out of the video. You trying to freestyle like Coach Z would have killed the magic, I think. :-P

    Still, I'm excited for Amnesia!

    ReplyDelete
  5. "Hvorfor daler som møntenhed i Amnesia?"

    I couldn't tell you without spoiling a bit of the story ;)

    ReplyDelete
  6. Swedish: Hvorfor daler som møntenhed i Amnesia?

    English: Why dollar as currency in Amnesia?

    Dutch: Waarom dollar als munteenheid in Amnesia?

    Response:
    I couldn't tell you without spoiling a bit of the story ;)

    ReplyDelete
  7. You said that you did record the carol? I understand why it was left out of the video, but would it be possible for you to share it with us? I would love to hear it.

    ReplyDelete
  8. Looks great. The athmosphere was spot on, even though I've heard that monster several times before and knew it was coming it still gave me bit of a fright. And I wasn't even playing myself :P

    ReplyDelete
  9. Fan alltså... programmet ni använder ser så lätt ut när du donar och fixar! Skulle va grymt att prova på lite själv ;) Är det ni som gör alla Tiles eller vad det nu kallas, alltså färger för väggar/tak/golv osv osv? Eller kommer mycket av det med i programmet?

    Har kollat på videon, 30 min och ni lyckades göra allt det där! Kan knappt vänta tills jag lägger vantarna på Amnesia!!!

    ReplyDelete
  10. Michael:
    To be exact it was only a poem, I called it a carol to stay in the spirit of the season. It was only recorded with a text-to-speech voice for testing so not very interesting!

    Joakim:
    All tiles are made by us, the idea is to use all the content we do to easily combine it into new stuff. Then it is also possible to create your own new graphics, but for that you use a normal 3D editor such as Blender and export to the file format Collada which the editor can use.

    ReplyDelete
  11. Alldeles fantastiskt.
    Jag kommer ladda hem spelet så snart jag kan ifall det funkar med Novint Falconen. Med ladda ner menar jag från deras hemsida såklart :P.
    Kommer det att fungera med NF eller inte?

    ReplyDelete
  12. For non-swedish-speakers: Anonymous wondered if the game will work on the Novint Falcon.

    Right now we there is no deal in place for this, but it will certainly be possible if Novint and/or Reachin (who made a lot of the Penumbra porting for haptics) are interested. If you really want to see Amnesia for Novint make sure to contact them and tell them so!

    ReplyDelete
  13. please do release it for Linux as well - am keeping my money aside for you!

    ReplyDelete
  14. It will be released for Linux unless something very strange happens. Acutally, the Linux version is pretty much already working!

    ReplyDelete
  15. Wow, it looks easy! im new to coding and are learning basic java in processing. Is it java your using? I really got to try your level editor when its released

    Christoffer, Malmö

    ReplyDelete
  16. Christoffer:
    The scripting language is a C/C++ like script called AngelCode. More info here:
    http://www.angelcode.com/angelscript/

    (The reason it looks like java is because java looks like c/c++ :) )

    ReplyDelete
  17. Hey I had a few questions about the engine's internals:
    Are there light maps in Penumbra/Amnesia? Or is everything dynamically lit? Or a combination?

    How exactly do the 3D tiles work? Do you store them as a mesh and then define which edges are on the outside, and then when the level is built/render/loaded the neighboring edges are merged? Do you store the final file for the actual game as tiles or one large mesh?

    Thanks for reading.

    ~DtD

    ReplyDelete
  18. DtD:
    The maps are 100% dynamically lit.

    The tiles are saved separately and when loaded tiles using the same material are combined into chunks. Not all tiles with same material are combined, but a middle ground between having a small amount of objects to renderer and some good culling is calculated using a kind of kd-tree structure. We are thinking about having some prebuilt binary format for faster loading though.

    ReplyDelete
  19. Hello)) When the game will be released??

    ReplyDelete
  20. Так бля когда он выйдет?)

    ReplyDelete
  21. Release date is Q3 or later this year.

    ReplyDelete
  22. thank you). You wonderful people! Hope Amnesia is a penumbra. Your game is brilliant, not like the others))

    ReplyDelete
  23. Your work is really inspiring. I detonated Penumbra BP and Requiem. Can't wait to grab the upcomming one :) offtopic: that piano teases for a cliché melody-based puzzle :D

    Keep it up. Cheers!

    ReplyDelete
  24. Is there any way for someone to get their hands on this program? A friend and I are planning on making a game and we haven't been able to find a program to use, and we really like this one? Is there any way to download or buy this?

    ReplyDelete
  25. alyakcim:
    It will be released together (or close after) the release of Amnesia: The Dark Descent this fall.

    ReplyDelete
  26. Where can you download this editor?

    ReplyDelete
  27. Not out yet... but sooon! promise!

    ReplyDelete
  28. soon? are we talking of days, weeks or months? I really can't wait for this editor to come out. I already own the game and it's astonishing!

    ReplyDelete
  29. oops, i come here to read when the editor will be released. But i can see that isnt out yet. I finished amnesia, i want make some custom levels now, i hope it come out soon.
    Thanks for all your work!! A really cool game (a bit short, but nice). Mmmm In what are you guys working now? New game or amnesia sequel/prequel or something? If you make a new game, it will be horror game again or want explore others genres?

    ReplyDelete
  30. please cen somebody help me i download the game amnesia the... instal it but if i run it, it show me ne window that the game crashed can some body help me to fix it please i cant wait when i will play it thanks to my nail fofana@seznam.cz

    ReplyDelete
  31. Playing amnesia, and I love it. Playing with the editer and loving it too. Is there anyway you could put this video up without the timelapse as a download I would love to watch it in a normal speed. :) Once again fantastic game been sharing it with everyone I know.

    ReplyDelete
  32. awsome! is the is the level editor reay for download?

    ReplyDelete
  33. Its out!
    http://wiki.frictionalgames.com/hpl2/start

    ReplyDelete
  34. Hi, can you tell me if we will be able to make the levels stand alone games instead of them being a subset of Amnesia?

    Is making a stand alone game possible with HPL1?

    ReplyDelete
  35. It is possible to use the rendering code of hpl1 to make your own standalone game.
    But this level editor saves the life of developers in making levels.
    Is it possible that this level editor will be open sourced like hpl1?
    It will be great for indies like us who are just starting.

    ReplyDelete

Note: only a member of this blog may post a comment.