March 19, 2013 by jonmillymiles
I haven’t reviewed my goals in a little while and at the end of an exhausting couple of days I think that now would be a very good time. Why??? Because I’ve achieved some, or at least part of them. Call it a small milestone that I have met, but a significant one nonetheless.
In my plan I have:
- 5 – Create objects for the level
- 6 – Create animated textures
- 7 – Use Kismet to create interactive puzzles
- 8 – Create matinees to demonstrate the effects of the puzzle
At the last check I had animated textures and switches that turned various lights on and off. But I am now far beyond where I was, with respect to the points above. But I am going to explain how these four points link together in one of my key locations – the Sparker Room.
The original plan:
The Sparker Room consists of a giant Tesla coil type of structure, surrounded by four smaller Tesla coils. The player must activate switched at the base of each small coil to turn on and off multiple small coils until all four are lit simultaneously. At this point the large coil lights and the door to exit the room opens so that the player can progress to the next stage of the level.
Kismet was needed to make all of the interactivity and logic within the room work. But in order to fully test what the logic was doing I needed objects, lights and textures to activate. I also needed to have these do something so that the player can see a change and thus the Matinees were needed. Finally I needed context relevant textures otherwise I would have shattered the illusion of the room and so I created the sparking effects.
How was it done?
To begin with I sat down with a Masters student, lets call him Jason (because that is his name), and he taught me the basics of taking a trigger, linking it to a toggle box and using it to turn a point light on and off. We then had a brief discussion about changing the properties of a material using panners, rotators and something called a material instance – which I thought I understood at the time.
When I got round to gearing up the Sparker Room that night I had completely forgotten how to do the interactive side. I remembered the key elements but not necessarily how to put them all together and after an hour or so I realised that I had created the wrong type of light: a pointlight not a pointlighttoggleable. Lesson learned!!! And I went about creating fancy on and off switches for the four towers.
Then I needed something to turn on and off, so I created a “cards” brush for my spark and a texture to go on it. This was done by drawing a simple, white “lightning” texture on a black background. A material was created and the lightning texture was loaded in – a few times. I used two panners to move the textures at different speeds and combined them with a multiply – this worked the same as an and function and meant that there was a broken randomness to the spark. I then connected this to the emissive and opacity connectors for the material and the spark was made. This was then applied to the cards brush and duplicated for each of the four small coils.
I tried to research animating materials and turning them on and off and while I hit upon material instances, I didn’t understand the terminology or videos enough to get them to work. So I halted their development and looked at the door that I wanted the player to open.
I created the door using as basic a model as possible with the aim of using normal maps to add the detail. I then created a texture for it and imported both into UDK. Once in, I set up my material, applied it to the model, enabled collision and placed it in the level. I then created my first matinee and it didn’t really work that well… in fact it didn’t work at all. I had created the key frames correctly and assigned the motion to the static mesh for the door, but I had added the mesh as the wrong type of actor…after half an hour of fiddling I realised that I needed to use the interpactor. At which point it worked.
I then linked this to my triggers and used an If condition linked to booleans for each trigger to effect an “and” control for two of the four switches. I set the true output to the “forward” input to my door matinee and the false to the “reverse” input. This meant that should both switches be activated then the door would open, but should one be deactivated the door would then close. But this was not good enough for me – I then linked in the other two switches so that they would stop the door from being activated or shut it if it was already opened. To do this I created two True boolean variables and linked them to the red light toggle boxes for the remaining two switched – this worked perfectly.
I also needed to create a way of showing that all of my coils were active – this was done by creating a spherical brush around the head of the coil and applying a spark material to it. This material was not “random” enough for me though and to make it different from the sparks going to the big coil I gave it an additional rotator so that part of the texture spun slowly. Finally I added a sine function to it which caused it to flash completely white in an almost random fashion.
Then I experimented with the lighting as I wasn’t happy with the way the room was lit: the coils were steeped in darkness. As I was going through the settings for the lighting I noticed the Create Light Shafts tick box… and ticked it. This had the effect of rendering light shafts from my emissive textures from the source of the light to its radius. I had a brain wave: if I could not work out how to get the textures to animate, I could turn these lights on and off and have the light shafts render in their place. This was done simply by adding the pointlighttoggleables to the triggers created before. But I was still not happy – I must sound really grumpy at this point.
With my previous experience at matinees I sat down to tackle the issue that I had with Material Instances and turning the main sparks on and off. I found this very useful tutorial from the World of Level Design. I followed it to the letter but for some reason it didn’t work.
Two nights ago I reread the material instance tutorial and noticed something – the texture was applied to a mesh. So I changed all of my electrical brushes to meshed using the Convert to Static Mesh option and it worked!!!! 😀
I needed to remap my logic and began to effectively recode and comment my Kismet. I struggled at first as there was a niggling suspicion that I could rewrite it more elegantly. So I planned out on paper exactly what I wanted.
I tested it out but had issues with the fact that two combinations A+C and B+D would both open the door this was overcome by setting switch D to also toggle bolt C thus ensuring that this could not be done.
In Kismet this looks like:
And it worked almost perfectly. I only had to change one thing – I needed the door to shut as soon as the test for all four sparks proved false – not for when the animations finished turning off the sparks. To do this I rerouted the reverse input on the door from the Rewound output of the Matinees to the false condition of the “If” comparison.The room is now done, bar some decoration.
So where does this leave my master plan?
Number 1 is done – my level design is complete and I am happy with how I see it working.
Number 2 is practically done – I need to finish the riverside, for this I need to understand how to use volumes to create water.
Number 3 – Facades – Started, but need to be rethought – more in a blog post later 😉
Number 4 – Textures – Well under-way. I can now produce photo-realistic textures relatively rapidly and with much less noticeable overlap.
Number 5 – Objects – Started – I now have pipes, beams and a big door, as well as interactive elements in the Sparker room. I still need a main door, which will probably consist of a housing and door element and levers to activate it.
Number 6 is done – I now have animated textures producing a rather pleasant sparking effect in the Sparker room.
Number 7 – I can now create more complex puzzles in Kismet. D
Number 8 – Matinees – I can now create both movement and material instance matinees.
Number 9 – Train passing through the level – Needs to be started
Number 10 – Low poly methodology – Will be done in unison with numbers 3,4,5 and 8. Will be talked about in a later blog post.
Number 11 – Fixed
So all in all I am feeling quite chuffed with myself 😀
See, not so grumpy after all 😉