Categories
Basic Tutorials

Basic Tutorials 4: Combat

Preface

There is a huge variety of games that aim to achieve a whole range of experiences and enjoyment. The idea of combat in games is a simple, primal addition, but in adding combat to a game a new element of choice is added, and a chance to outwit (and outgun) your friends. 

Combat is quite often a central aspect of gameplay for lots of different reasons, and isn’t always the run-and-gun style that it seems for non-gamers. It can be used to tell a story like in Last Of Us or it can present puzzles like in Legend Of Zelda or Shadow of the Colossus. Combat can also be delivered in lots of different ways as well. For example, Silent Hill’s creepy aesthetic and tense atmosphere or Call Of Duty’s action-packed warzones, or it can be made into a competitive team sport such as in Overwatch, CS:GO or Fortnite, each of which require a team to have excellent communication, teamwork and tactical skills.

Whatever the reason for including combat in your game, there are a few simple techniques that you can use to make your combat compelling and engaging, and to give your players something more in-depth than just point and shoot. Let’s get into it.

Introduction

This tutorial will look at leveraging some of the skills you’ve learned from the previous basic tutorials, and add a premade game type into the mix to put your own stamp on a tried-and-tested game mechanic. It will look at:

  • The “Capture The Flag” game type
  • Adding destructible and indestructible terrain
  • Level editing to create intense battles with guns and traps

Create Your Game

Under the CREATE A NEW GAME menu, find the Team CTF (Capture The Flag) game template. Select this template, and select the Start: Team CTF starter map. Notice that this time we will not be using the Empty Game. Give your game a name, choose a thumbnail image and enter the editor.

Use the Team CTF game template for this tutorial.

Welcome to Capture The Flag!

Before we make any changes, Preview the game by holding D-PAD DOWN. 

You will see that there are two flags, and two coloured zones. Players start in a “Lobby” as they wait for all Players to connect. When the Lobby time limit reaches 0, the game begins.

The object of the game is to capture the opposing team’s flag by running into it, and then bring it back to your team’s coloured zone. Each time you do this, your team will score one point. The team with the most points when the timer reaches 0 wins. If a Player dies, they will respawn at their team’s base. 

The game is quite simple at the moment, let’s mix things up.

End the game preview and ensure you are in Basic Editor mode.

Moving The Bases

This section concerns moving the bases to a different location on the map. If you don’t want to move the bases, and are happy with where they are, you can skip this step, but it’s good practice to fully configure your own game.

A base is comprised of the following Entities:

  1. A coloured floor – This indicates to the player which base is which. The red and blue plastic floors are not destructible, so that the flag is always accessible.
  2. A flag – The flag is a Prop Entity. When a Player collides with the flag they “pick it up” and carry it on their back. To “capture the flag”, the Player with the flag must collide with their own team’s flag in their own base. When they have captured the flag, it is immediately returned to their opponent’s base, ready to be captured again.
  3. A locator – The locator in the base is where Players are respawned when they die. 

To move a base will take three steps:

  1. Create a new floor area which will specify the new base area
  2. Move the flag and respawn locator to the new base
  3. Delete the old floor area

Let’s get started.

Look at the floor and press X to open the Entity Editor. This will show you the Entity Editor for your terrain, and it gives you a good opportunity to see an overview of your map.

You open the Entity Editor for the Terrain and this will give you a good overview of your level map.

Open the Entity Editor for the Terrain regularly, to get an overview of how your level is shaping up. For now, press B to exit the Entity Editor.

Press Y to open the Library. Navigate to the Voxels tab. Highlight the Plastic Dull voxel and press A. You will see that you have a choice of colours of Voxel to add to your Hotbar. This game has been setup to use Red and Blue, so stick to these colours for now. Highlight either the Red or Blue Plastic Dull Voxel and press A to add this Voxel to your Hotbar

Locate the Plastic (Dull) Voxel and press A.
Add the red or blue plastic Voxel to your Hotbar.

Use D-PAD UP to change the Voxel tool to a 1x1x1 block

Change your Voxel tool to a 1x1x1 block.

Press R2 to place a Voxel and create a new base somewhere else in the level by drawing a low platform. I have chosen to position the bases in each corner of the map. Do this for both the Red and Blue teams.

When you have finished, press RB to select an empty Hotbar slot. Look at the floor and press X to open the Terrain Entity Editor again. You should see you now have two bases on your map – the original two, and two new ones.

You should now see 4 bases marked on the map. The old ones, and the new ones you have added.

Press X to close the Entity Editor.

Now you need to move the flags onto your new bases.

Move towards a flag and, whilst looking at it, press X to open the Entity Editor.

You should see that the flag entity has a flagSpawnerScript attached to it. Each flag has a different team. By default, Team 1 is on the Blue floor, Team 2 is on the Red floor.

You have two options to move the flag. You can pick the one that suits your style of level making:

Option 1: Numerically Move The Flag

You can edit the position data in the Entity Editor for the flag. This method is better for level designers who like to be very precise.

To do this, ensure the Entity Editor for the flag is open. Use the D-PAD to navigate to the “position” property box. These three numbers represent the coordinates of the flag, and specify its position in the world. Adjusting the first two boxes will move it’s position on the ground, whilst the third box changes it’s vertical position.

Use the position property boxes on each flag to move them to the corresponding team base. To do this, highlight one of the first two position property boxes and press A. Use D-PAD LEFT/RIGHT to change the numbers and move the flag.

If you hold RB whilst pressing D-PAD LEFT/RIGHT you can increment the numbers in multiples of 10, and move the flag faster.

Move the flags to the new team bases.

Press A to finish editing a property box. Press X to close the Entity Editor when you are happy with the flags position.

Option 2: Pickup The Flag

Alternatively, you can pickup the flag and move it to a different location. This method is better for freeform level designers.

Look at the flag with the Entity Editor closed, and press RT to pickup the flag. Head over to your new base location, and place the flag by pressing RT again. If you want to cancel the move and return the flag to it’s original position you can press RB (this also selects an empty slot on your Hotbar).

Once you have moved the flags to new bases, the last Entity to move is the Locator, which is the spawn point for the Players on each of the teams. Use the same technique you used to move the flags to move this Locator.

Open the Entity Editor for each flag and make sure that Team 1 is on the Blue floor, Team 2 is on the Red floor. Close the Entity Editor.

The last step is remove the old bases. To do this, you can paint the red outline of the base with the Technical Grid Voxel.

Press Y to open the Library. Navigate to the Voxels tab and add the Technical Grid Voxel to add it to your Hotbar. Close the Library.

Press D-PAD UP to cycle through the Voxel tools until you see the Fill tool. Press R2 to use the Fill tool on the previous base outlines.

Use the fill tool on the old bases to remove them.
Once you have moved your bases you will have a larger combat area.

Adding Walls

To make a more compelling level it is a good idea to add some walls so that the opposing teams can’t just stand and shoot each other. You can use Voxels to create obstacles on your map, which players can use to hide behind, or which cut off certain routes to the opponents flag. This “cover” also creates opportunities for teams to outflank (and outwit) each other. 

Choose a Voxel to be your walls. The walls are destructable by default, so select a Voxel that is usually considered destructable in shooting games. Press D-PAD UP to increase the size of the Voxel tool, and use large blocks to create a general shape to your level. You might find it easier if you double jump to enter flying / non-clip mode. 

Try to compose a variety of spaces. Create some wide corridors and some narrow corridors, some small areas, and some bigger areas.

You can choose if you want to surround your level perimeter with a wall. If you choose not to have a wall then if your players fall off the side they will fall to their doom.

Mark out your level and create a variety of cover with the Voxel tools. Don’t worry about detail for now.

Remember you can get an overview of your level by opening the Entity Editor for the Terrain.

Creative Control: Combat Situations

Your level should offer rich opportunities for players to battle in a variety of ways You could choose between short, medium and long-range combat situations or a mixture of all three. 

Creative Control: Level Design

There are lots of ways to design a level. You could use a pen and paper to sketch some ideas for your level, or build structures freeform in Crayta’s EDIT mode, and devise a level bit-by-bit. It’s your choice! 

Think about how your level could be structured. Make sure to include points which might be suitable to spawn resources such as different guns.

Also consider whether there might be perilous areas of your level, traps that either team can take advantage of to gain the upper hand. 

Once you have given your level a general shape, you can tweak some of the spaces by adding and removing smaller Voxels to give opportunities for more or less cover in certain areas. Experiment with different sizes of the Voxel tools.

Start to add detail with smaller groups of Voxels, and give your level some interesting spaces.

Creative Control: Game Balance

Remember there are two teams on the field of battle at once, so try to keep in mind how to make sure that the game is fair for both sides. Try to give each time an equal number of good positions, and build in weaknesses to dominant areas of the map to encourage teamwork and tactical thinking.

Indestructible walls

Preview your game. If you shoot any of the Voxels you placed then you will see they are destroyed. If you shoot either the Red or Blue team floors, you will notice that they are indestructible. This is a good thing, because otherwise a team could destroy their own floor and the flag would no longer be accessible, ruining the game.

You can turn off destructable voxels by looking at the floor anywhere and unchecking the “damageEnabled” property.

As you will be adding a mixture of destructable and indestructable cover you should leave damageEnabled checked.

Creative Control: Destructible Environments

Having destructible cover is great for forcing players to think on their feet, and adjust their tactics in the middle of a gunfight, but having indestructible areas can make map control more important to achieve victory.

You can create your own indestructible Voxels.

Press Y to open the Library and choose a Voxel that is unlikely to be damaged, for this tutorial we have used Metal Steel. Build some cover in your game using the Metal Steel Voxel.

Build some metal walls that will be indestructible cover.

Once you are happy with your indestructible cover, open the Entity Editor for the Terrain.

Look at the floor and press X to open the Entity Editor for the Terrain.

At the bottom of the Entity Editor is a button “Add to Entity”. You can use this button to add Scripts and UI Widgets to an Entity. Highlight Add to Entity and press A.

Click the Add to Entity button add the bottom of the Terrain Entity Editor.

Select Add > Script > voxelHealthScript.

Select Add > Script > voxelHealthScript.

The voxelHealthScript allows you to tell Crayta how much damage different Voxels can take before they are eliminated. You can also set a default value here.

Now, use the Add to Entity button again to add the voxelHealthValueScript.

This Script enables you to determine the health of a specific voxel (how much damage it can take before it is eliminated). Once you have added it to the Entity Editor select Metal (Steel) Voxel in the voxel dropdown, and set the health to 0 (use LEFT D-PAD to reduce the value).

Select Metal (Steel) and set the health value to 0.000.

Press X to close the Entity Editor. Hold D-PAD DOWN to preview the game and test that your Metal Steel is indestructible by shooting it.

Try shooting the Metal (Steel) Voxels. Notice how the steel voxels do not get damaged by bullets.

Edit your level so that you have a mixture of destructible and indestructible cover and remember to play test it regularly so that you can see how your level editing changes the dynamic of the game.

Creative Control: Voxel Health

A voxel doesn’t have to be destroyed in one shot. Just like we decreased the Voxel Health to 0.000 to make it indestructible, you can increase the Voxel Health to take 2 bullets, or 10 bullets! The Automatic Rifle default damage is around 150, so a Voxel Health of 150 or less would take one shot (1 bullet x 150 damage = 150), 300 or less would take 2 shots (2 bullets x 150 damage = 300) and so on.

More Guns Please

You can find many different weapon packs by visiting the Store in the Library.

Press Y to open the Library. Press Y again to open the Community tab. Find the Shotgun Package within the store, highlight Install and press A to install the Package.

Return to the Library by navigating back to the Library tab, and open the Templates.

You should see a new template has been added to your Templates, called Shotgun. Select the Shotgun Template from the Library and place it in your scene.

Open the Shotgun Entity Editor and find the pickupSpawnerScript Properties. Chane the Properties to match the following:

Change the highlighted Properties on the pickupSpawnScript attached to your Shotgun.

After making these changes, navigate to the top of this Entity Editor and make sure to select Copy To Template.

Copy To Template means that when you place another Shotgun somewhere else in your game it will keep the same pickupSpawnerScript Properties.

Preview the level to try the Shotgun. Walk over the gun to pick it up.

Preview the level. Pickup the Shotgun and blast some stuff.

Return to the game editor.

You can switch between the guns in-game by pressing RB and LB.

You may disagree with some of the values of the Shotgun (does it cause too much damage? Is it too accurate?). You can fully customise each gun to behave differently by using the Entity Editor and changing the Properties on the gunScript. Remember to press Copy To Template after making any changes.

Press Copy to Template to update the template of this gun and make the changes take effect.

Creative Control: Risk and Reward

Based on your experience with the new guns, consider where might be a suitable place to put them in a level. You may decide that the base of each team has a library of weapons available, or that one team has only shotguns whilst the other have only handguns. 

Alternatively, you could put less powerful guns in easy to reach places, and more powerful guns in dangerous places, such as the middle of a crossfire, or somewhere requiring serious parkour skills. 

Adding this risk and reward can give the game more depth, as the teams will need to weigh up arsenal resources versus the risks to team members, and ultimately decide which will help them win the game.

Level Peril

What’s more exciting than two factions battling it out in intense combat? When that combat takes place in a hostile environment. Sometimes, it’s the situation that can turn the tides of battle, and teams can use natural dangers to their advantage, as distractions or as danger themselves.

Open the Library and press Y to navigate to the Community. Find and install the Basic Combat Traps Package. Return to the Library and add the Laser Spikes Template to your Hotbar.

Place the Laser Spikes somewhere in the level. Remember, you can rotate the Entity to make laser walls also.

You can also try placing multiple Laser Spikes, and creating no-go areas or dangerous corridors that are asking for escalating gun battles. Players can shoot through the Laser Spikes, but can’t get past them, so they can offer some exciting advantages to clever Players. 

Players can shoot through Laser Spikes, but can’t travel through them.

Preview your game. Test the traps. You should find that they cause your player damage. 

Return to the EDIT mode.

Touching the Laser Spikes will cause players damage, and knock the player back. You can change the amount of damage and knockback that the traps have. In EDIT mode, open the Laser Spikes Entity Editor. The properties that can change the damage that the Laser Spikes cause can be found in the passiveDamageScript properties. 

Using the Entity Editor, you can change the amount of damage caused to the player, how much it knocks the player back, and what Sound effect will play when a player collides with the trap. 

Experiment with the properties of the Laser Spikes, and adjust them to suit your game. You can make a trap deadly, by increasing the localDamage to 1000! You can also change the Mesh Asset to suit your theme. Maybe your game features a highly lethal coffee table, or a not very dangerous banana which launches players across the map.

Turn your laser spikes into a dangerous art-deco coffee table if you like.

Recap

Congratulations on completing the last of the Basic tutorials. In this tutorial, you have discovered:

  • Remixing your own version of a Capture The Flag game
  • Designing a level for exciting and dynamic combat
  • Adding destructible and indestructible terrain
  • Adding guns to a level
  • Adding traps to a level

Adding Polish

You have started designing a level for combat, but there are endless opportunities for changing the environment in your game, and making a really exciting and challenging level with plenty of opportunities for strategy.

Using the level you have started, you could try and include some of the following ideas:

  1. Improve the theme of the game to start building a sense of story. Why are these teams fighting? Why do they need to capture the flag? Even the most combat focused shooting games have some kind of narrative.
  2. Try making your level have high areas and low areas, and experiment with three dimensional tactical advantages.
  3. Install the Super Smash ‘n’ Grab package, and place the flags in Bank Vaults, with their own key. Now Players will need to find the key, or blow open the doors before they can start to win points.
  4. Give your game level more variation by adding some of the premade Mesh Assets that fit your theme. You can also turn on physics on the Mesh Assets, which means that players can move them around and give themselves more cover or hiding spots.

Next up: Advanced Editor Mode

Congratulations on completing all of the Basic tutorials. Hopefully you feel inspired to experiment with some of the other game modes, and get creative with the tools at your disposal.

To really take things to the next level, you can try the Level Editor in Crayta with a keyboard and mouse. In the Advanced Level Editor you will have an opportunity to code within Crayta and use scripts to customise the interactions in your game.

 There are a variety of guides which you can use as a reference point for using some of the Advanced tools in Crayta.

Familiarise yourself with the Advanced Level Editor in the Advanced Workflow Tutorial.

Learn some basic scripting in the step-by-step Code Tutorials.