No announcement yet.

Tutorial - Your really first game

  • Filter
  • Time
  • Show
Clear All
new posts

    Tutorial - Your really first game

    Author: Renan Lopes (Ayalaskin).

    Your really first game

    Kismet – Trigger - Matinee - Fog - Sounds - Emitters - Teleport

    All the basics of course.

    Am a Brazilian, so I ask sorry about my English in advance.

    Note: Because the 9 images per post, I'll have to divide the tutorial in 3 parts.

    A few days ago i was complaining about the lack of good documentation and tutorials about some aspects of the UDK, not the artistic creating content and level design, but in the functionality and gameplay aspect of the engine.

    So i’ve decided to make a few tutorials about what i’ve learned these days.
    I’am a programmer so my efforts are to make things to Work, not to Appeal.

    We will make a simple level with a locked door between two basic rooms.
    In the first room we will pick the key for the door, and we will make a simple matinee scene so the doors moves unblocking the way when the player touches it while having the key, and in the second room, you will be able to active a bomb and do some blowing effects, and to finish covering the basics aspects of the engine, we will make a teleport that ports the player from the room 2 to the room 1, and them i will show how to switch your levels, so you can divide your game in different kinds of scenarios.

    If you don’t know how to make the 2 rooms basic rooms with a passage between the rooms, refer to the Appendix A before this tutorial.

    We don’t have to setup any folder structure or .ini files.

    Lets start placing the door, open the Content Browser, in the Building Meshes chooses the door that is in there then close the Content Browser.

    Right click in the floor in select’Add Actor > Add InterpActor: Static Mesh ...‘

    The mesh MUST be placed with the InterpActor type, or we cant animate it later, if this option don’t shows for you, its because the mesh isn’t loaded, so first select ‘Add Actor > Load Static Mesh ...’.
    Place it someway that it blocks the player path.

    Now select that door and press F4, so a property window will pop.
    Expand ‘Collision’ and mark ‘Block Ridig Body’, and in the Collision Type choose ‘COLLIDE_BlockAll’, now the character can’t pass through this mesh while in play.

    We will hide the door key in one statue, so lets place it in the scene, open the Content Browser and in the Mesh Buildings choose the statue.

    Right click in the first room floor and selec ‘Add Actor > Add Static Mesh: Static Mesh...’, and put this mesh where you like, i will place it in a corner of the room.
    Now lets give a hint to the player that the key remains within the statue, we will add a glow effect, open the ‘Content Browser’ and in the’ Useful Particle Effects’ select one that you like and close the browser.
    Right click in the statue and choose ‘Add Actor > Add Emitter: ...’

    The player have to pick the key, so lets create a trigger, right click in the statue and choose ‘Add Actor > Add Trigger’.

    The trigger must be near the floor, or the player will have to jump to active it, make sure that the trigger is selected before going ahead.
    Its time to play with the Kismet Editor, open it by clicking in the green K.

    First of all, we will create a variable that will tell us if the player have the key for the door, so right click in the gray area and choose, ‘New Variable > Bool’, select the circle that represents the variable in the kismet, and in its properties give it a name like ‘PlayerKey’.

    Right click in the gray area again and choose ‘New Event Using Trigger_0 > Used’.
    We will make this event give the key to the player, right click in the grey area and choose ‘New Action > Set Variable > Bool’.
    Drag a wire from the slot ‘Used’ in the event trigger, and lik it to the ‘In’ slot of the set variable object. Link the ‘Target’ slot from the set variable with the PlayerKey variable.
    Right click the ‘Value’ red square slot in the set variable and choose ‘Create New Bool Variable’, select this new variable and set the property ‘b Value’ to 1.
    You should get something like this:

    And we also will disable the glow effect, indicating that the player have collected the Key.
    Right click and choose ‘New Action > Toggle > Toggle’. Link the ‘Out’ slot of the set bool to the ‘Turn Off’ of the toggle component.

    Now close the Kismet Editor and in select the Emitter in the Level Editor, then open again the Kismet Editor, right click the gray area and choose ‘New Object Var Using Emitter_0’, then drag the ‘Target’ slot of the toggle component to this new variable.

    It's a good practice to tell the player whats is happening in the environment.

    Right click in the gray area and choose ’ New Action > Misc > Log’ select it and mark the option ‘Output Object Comment to Screen’ and in the property ‘Obj Comment’ enter with the text ‘You got the door key !’, in the Taget Duration put the number 4. It is good to unselect the ‘Output to Screen’, because it will display some debug information, in this case it will just replicate your message.
    Link the ‘Used’ slot of the trigger in the ‘In’ slot of the log.

    Right click in the gray area and choose ‘New Variable > Player > Player’, then link the ‘Target’ slot of the target to the player variable.

    So whats happening at all? When the player press the key ‘E’ near the statue, the trigger triggers and set the variable PlayerKey to ‘true’ value and turns off the emitter effect in the scene, also tells a message to the player, telling him that the key is in his posses.

    Tip: The trigger placement is very trick, if the holy thing is not working, move the trigger along the level, and find a good place for it, you also can higher the trigger area of effect, select it and press ‘C’, the pink lines that appears is it collision area, press F4, and go to’ Collision > Collision Component > CyllinderComponent’ and higher the radius number;

    Time to make the door open.
    Place a trigger at the door, and make sure that the trigger area can be touched in the two sides of the door.
    With the trigger selected, open the Kismet Editor and right click ‘New Event Using Trigger_1 > Touch’, select this trigger and in its property set the ‘Max Trigger Count’ to 0, so the trigger can trigger infinite number of times.

    Right click the gray area and choose ‘New Matinee’, link the Touched slot of the trigger in the ‘Play’ slot of the matinee component, also link the ‘Untouched’ in the ‘Reverse’.
    Close the Kismet Editor, select the door in the Level Editor and reopen the Kismet Editor, then double click the matinee component you created in the last step, this will pop the Matinee Editor, if it dont show for you, just minimize the Kismet editor and you should see the Matinee Editor somewhere minimized.
    Right click in the grayest area an choose ‘Add New Empty Group’:

    Select the created group, it should go orange, right click it and choose ‘Add New Movement Track’, select the new track, it will go orange too.
    Now click in the 2.0 seconds (1) in the bottom of the editor, and then click in the Add key frame (2) (marked in purple).

    The door must be selected or this step will not work.

    Minimize the Matinee Editor, and in the Level Editor, move the door to the right side a little, so the gap between the rooms is unblocked, then close the Matinee Editor.

    With the kismet sequence in the picture above, the door will open every time the player touches the trigger, but we must add a condition, so the door opens only when that player has the key.

    Right click a gray area and choose ‘Add New Condition > Comparison > Compare Bool’
    Break the link with the ‘Touched’ event, by right clickin in its slot and choosing ‘Break All Links’, and link the ‘Touched’ to the ‘In’ slot of the compare bool component, also link the ‘True’ slot to the ‘Play’ slot of the matinee component.

    We will create an reference to the Playerkey variable we have created before, so right click in the gray area and choose ‘New Variable > Named Variable’, and in the properties of this new variable, select the field ‘Find Var Name’ and enter with ‘PlayerKey’.

    If everything is right, the door will only open if the player gots the key.
    In this part of this long tutorial, we will blow, lets place the bomb in the second room, open the Content Browser click in ‘All Assets’ then in the filter mark Particle Systems, them select a particle that appears like a bomb.

    Right click in the floor in the second room them ‘Add Actor: Add Emitter...’.
    Add too a new trigger in this location and select it, open the Kismet Editor and create a new ‘Used’ event with this trigger, and use it to toggle the our bomb off, the same way we did with our first emitter.

    We will add some sound too, right click the gray area an choose ‘New Action >Sound > Play Sound’, then close the Kismet and open the Content Browser, in click in all assets then now filter with ‘Sounds Cue’, select a cool sound for your explosion, reopen the Kismet and select the sound component you have created, in the property window click in the green arrow in the ‘Play Sound’ field.
    Create a new Player variable and link the sound target to the player.
    Lets add some smoke to the ambient, in the main menu choose ‘View > Browser Windows > Actor Classes’.
    Search for the section ‘Info > HeightFog’ and select it, close the actor browser.

    Right click in your scenario and choose ‘Add HeightFog’ Here, select the fog icon and press F4.
    Choose’ HeightFog > Component > HeightFogComponent’ and in the Density put the value: 0.007000.
    In the kismet, with the ‘Touched’ event from the last trigger, toggle the fog on, the same steps like we did with the emitters.
    The sad thing is that the fogs are on when the level begin, so lets toggle it off, right click in the Kismet and choose ‘New Event > Level StartUp’

    You can also add a bunch of emitters to make a more real effect.
    Lets put some final touches in out level, by adding the teleport feature.
    First open the Content Browser and find an emitter that is like a portal, and put it in the level and also put a trigger in the emitter, as we did before.
    In the main menu choose ‘View > Browser Windows > Actor Classes’, am fetch for the ‘NavigationPoint > Teleporter > UTTeleporterBase > Teleporter’, select it.

    Now zoom to the first room, click in the floor and select ‘Add UTTeleporter Here’
    Select the teleporter and in the kismet create a variable for it, select the trigger and create a touched event for it, and put the max trigger count to 0, also create a new player variable.
    In the kismet do ‘New Action > Actor > Teleport’, connect the stuff, and your teleport now will work.

    The last thing we will do to complete this tutorial, is add the possibility to change levels.
    This will be done by using a console command in the Kismet Editor.

    First, create a trigger at any location in the level, select it then open the Kismet Editor and create the event for it.
    Now click in the gray area and choose 'New Action > Misc > Console Command'.
    Select the Console Command component and in its properties, expand the field 'Commands' and add the following string:
    open MySecondLevel

    Replace MySecondLevel with your other level name.
    Create a new player variable 'New Variable > Player > Player'.
    Link the Target slot of the console command to the player variable, and link the desired trigger event in the 'In' slot of the console command.

    Note: The Open command will NOT WORK in the unreal editor, to test if it is working choose 'Build > Play Level > On Pc'.

    Final result:


      Appendix - A

      Lets start making the two rooms, in the main menu bar select ‘File > New’ and mark Additive in the geometry style.
      Select the the Cube Brush tool in the left menu bar (1), then enter the following properties:
      • X = 1024
      • Y = 1024
      • Z = 512
      • Hollow? -> Marked

      Then click in the Build button (2), and in the left menu click in the CSG Add button (3).

      With the mouse, fly through the cube and enter inside it, (the mouse wheel let you zoom the camera in).
      We will add some texture to it, so left click in the floor or at any wall and them press Shift+B so you will select all the faces of the current brush.
      In the main menu bar select ‘View > Browser Window > Content Browser’.

      In the Shared Collection click Cool Materials, and then select any material in the window, close the Content Browser.

      Now right click in the floor or any wall, while all the brushes are selected and choose Apply Material.

      Zoom out the room and select the Red Brush in the scenario, and move it to the right side of the room, make sure that it is aligned with our first room, you can check it looking at the other 3 visions.

      If you having trouble align the brush, you can set how many units it moves in one option at the bottom of the screen:

      Now just click the CSG Add button and apply a different material fot this room.
      We have to add the lights, so zoom inside the first room then click at any face of the brush the select Add Actor > Add Light (Point), then move the light a little up in the room.

      Do the same in the second room.
      Now we have to make a gap beetween these two room, so click in the Cube button the enter the properties:
      • X = 32
      • Y = 64
      • Z = 128
      • Tessellated? -> Marked
      Move the Red Brush and place it in a way that its became placed between the two room, make sure he is aligned along the floor, the click in the CSG Substract (right side of the CSG Add).

      Right click in the floor in the first room then select 'Add Actor > Player Start'.
      The player start actor tell the game where the player will spawn in the level, so place it where do you want.
      If you move it to an improper location, when you build all the level one error should pop.
      Let the player start be positioned little up from the floor

      In the main menu bar choose ‘Build > Build All’.
      Your level is done, right click in the floor the select ’ Play From Here’.


        Very Nice Tutorial


          At first glance this looks quite helpful... many thanks for taking the time to post it. I'll have a more indepth look when i get back to my dev machine.

          Best Regards,


            mean i cant use the trigger i have tried everything but when i press e close and very close the object happend nothing


              Try to put the trigger at same level as the floor, like its sprite touching the ground, or entering a little.
              Try to move it away from the walls and meshs to test if it works right.
              Try to move along the trigger radius pressing E and jumping, until you reach its touching area, then you can feel where it is and then adjust.


                I just kind of skimmed it, but it looks more like a 'my first level' rather than game


                  Its an entire game composed by just one level =)


                    If it's possible, can you add to the tutorial, how to change to the second level.


                      Added the possibility to change levels in the second post, and added the playerstart position in the appendix A.


                        Thanks ! (This forum lacks a Thank You button )


                          wow cool tutorial man.


                            Don't understand the title of that tutorial. You said it would be a one level game, but you didn't build a game. You just created a map, didn't you? Excuse me if i get something wrong, i am new to UDK too.


                              thank you so much for this tutorial. I have been through SO many tutorials on the web for unreal now and have had trouble grasping the bools concept. Your simple key tutorial was so direct and to the point I now get it instantly. It has opened up a new world of possibilities to my game.

                              Please post more kismet tutorials if you get chance! Thanks so much!