December 2, 2013

First stealth level

After this week demo, I will talk about little enhancements and the creation of the first stealth level in a pirate warehouse!


I - Little enhancements

  • I added a new screen for object discovery: the first time you find a casual item or every time you find an important item, a little screen pops up to explain what it is an how it works, with a little animation of the item.
 The new item discovery screen
  • I also tested to add a cast shadow everywhere, just to see the effect. Maybe it won't make it until the end, but it's not too expensive to test (in terms of work). This made me discover a lighting bug: there is some light flickering when the sun sets down and the moon raises because Unity only renders shadows cast by the most powerful light. So I had to smooth light transition between the sun and the moon.
  • Then I wanted to work on the graple animation of the character, because it's the only one that hasn't been set yet (even if only in a rough state). I had a very hard time designing the graple itself, to the point where I gave up because I was losing too much time on it. Maybe later... But I set up the basic aiming and flying animations, which makes the trick already.
 I belieeeeeve I can flyyyyy : the graple animation! (This item is not usable in the demo...)

  • And finally I worked a bit on the AI of the enemies: I added some reaction when they see one of their colleagues down. So now, they can check out the fallen guy and look around if they spot you. The problem was that I wanted them to remind which guard was down, otherwise, they would check each time... So I implemented some kind of relatively simple memory to avoid this stupid behaviour.

II - Item creation and level design


Another big part of this month work was to create items, including modelisation and texturing of simple objects: nets, pontoons, lanterns, various wood stuff, ramps, ramp poles, chests, doors, switches, keys, ropes, apples, map, ...  But, of course, modeling a door and a switch does not make them interact together. So I coded "simple" (and obvious) systems to make a switch open a door, a chest give items once opened, an apple restore life, ...
 
Aaaah! Lantern and fireflies... :)

Meanwhile, I gathered all those items to construct a "simple" level. I wanted to create the first stealth level (even if you can fight against the enemies). By the way, it would be the first level with pirate enemies. In order to create this first level, I made various logical schemes (even if not very complicated), and ended up with a simple level design: a warehouse secured by a magnetic key where pirates keep their stuff. I added 2 other "big" buildings around to make it more believable: a restaurant (where the guys would eat) and a dormitory set up in a former sailing ship (for the pirate-ish look). I wanted wood, sails, nets and ropes everywhere to accentuate the style.

Once the basic idea was established on the paper, I created the level in Blender using it as a level editor rather than using Unity 3D (which is supposed to have level editor capabilities), because I found out that object positioning is not that precise in Unity. Moreover, and most importantly, I can't model objects in Unity, I can only copy and instantiate objects already modeled in Blender.

The level in Blender. I used a lot of "empty"s with special names to create all the "complex" objects (hero, enemies, doors, chests...) that will be replaced in Unity.

So, I enhanced my simple script dedicated to parse a level created in Blender to partially convert it into smart objects inside Unity (I already talked about this basic blender editor stuff here). I had to find a way to give "parameters" to objects in Blender that could be reinterpreted in Unity, for example: a parenting link is used to represent the key-door relation, a simple tag in the chest object name describes what can be found inside, same thing for a map point name, etc...

The level once imported in Unity. Complex objects are not replaced yet.

The level in Unity after replacing all the complex objects.

But... actually finishing the level (or at least polishing it until it had a nice look) took quite some time! I had to place more than 1800 items in this level! And it's really not big... Creating content may be longer than I expected... :p

See you next time!
Peace!