Categories
Tutorials

Basic Tutorial : Packages

Preface

This tutorial assumes that you understand the basics of entering Crayta’s CREATE mode and have some experience building levels.

In this tutorial, you will look at how you can use the Packages that come with Crayta to add playful Entities to our game.

Creating your game

We are going to use an existing Blueprint to base our game off, a blueprint has the basic building blocks for you to expand into your own game!

Navigate to CREATE mode in the Crayta menu and under CREATE A NEW GAME select Basic Tutorial : Packages.

Create a new game using the Packages Blueprint.

Select CREATE A NEW GAME and then name it a suitable name, in my case I have chosen the name “Mine Mayhem” but it’s entirely up to you. Remember to choose an image and to continue until you’re loaded into the editor.

Name your game and complete the creation process.

You should now see your Game world. If any of that was confusing, head back to the Basic Workflow Tutorial which guides you through the process of creating and editing your own Game from the very beginning. 

Otherwise if you are still with me, great! Read on!

Crayta Packages

Our team have provided several packages that will help you get started in your development, the Blueprint already has three of these pre-installed, these are:

  • Inventory – Allows the player character to hold and store objects in their inventory.
  • Health – Adds a health bar and player character can be “killed” by losing all their health.
  • Auto-Respawn – Handles the respawning of players who may have been “killed” by something in the level.

You should once again have started in Basic Editor mode, now open your asset Library then you should see the Community tab that is at the very top-left of this window. Select the Community tab and then check the Crayta Packages filter option. If you then look through these packages you should see the packages listed above as installed.

Using Filters and Tags

Trying to find packages can be hard work, but you can use the filter to search for a specific package name. Try searching to easily find the package you want.

Better yet you can use tags to look for a specific group of items if you have a specific theme in mind!

Now we have understood that this is where we can install and see the installed packages we are already using, we should close this window.

Playing the Game

We should see what this Blueprint provides in terms of how the game currently functions, if we Preview the game by pressing and holding the menu button on controller or pressing F5 on keyboard.

Tech Tip: Preview Often

There are two modes in the Crayta CREATE mode. Edit mode and Preview mode. To change between them, press and hold the menu button on controller or pressing F5 on keyboard.

Edit mode: Here is where we can build our game world, add entities and change their properties. When you do anything in this mode it is saved. In this state, your game is not running, so entity behaviours such as movement won’t occur until we Preview or Run our game.

Preview mode: This is your game in action. Enter this mode to start any entity behaviours and test your game. When you do anything in this mode it is not saved. 

Regularly Editing and Previewing your game follows the same process that game developers use when they are building a game. Always remember to Preview your game, to see how the changes you make in the Edit mode impact your gameplay.

This should be a simple fetch quests mechanic, there should be a shiny coin spinning at the end of the mine tunnel, you need to get your character to run over to the coin and they should pick it up.

If you now take this back to the start point, which should be indicated by the starting line pattern on the floor, then your coin will be magically removed and you should see some effects and hear some celebratory sounds indicating your success!

Grab the coin and run it back to the checkpoint.

If we select the same button we select to start the preview to end the preview at this point, by now you might be a little underwhelmed by the difficulty of the task. We are going to add another package to spice this up a bit, and make it more of a challenge to retrieve this coin.

Increasing the difficulty

As we mentioned, there is no difficulty curve and we aren’t really using all the player mechanics afforded to us by our player character. Let’s try by adding an obstacle to make it not such a walk in the park… err cavern.

If we select the option to enter our Library and then go back into our Community tab to look at all our packages. If you then select the filter and then search for Death Collision and install it.

Search for and install the death collison package.

Next, if you stay in or reopen your Library and enter the Templates tab. The package has been installed you will see the Death Obstacle Template. Assign the Death Olbstacle to your Hotbar so that you can place it in your game, now close the Library window.

Once you have the entity in the hotbar then drop it in your level.

Place the new Death Obstacle between the player start point and the coin collectable. You may find that it’s positioned or rotated not quite how you would like it. To fix this, interact with the Death Obstacle and select E on the keyboard or X on the controller to Edit DeathObstacle1 so you open the Entity window on the right-hand side of the screen.

Tech Tip: Three Dimensions

3D games use three different numbers to determine a position in the world. The Crayta 3D coordinate system has values for LEFT and RIGHT (X), BACK and FORWARDS (Y), UP and DOWN (Z). 

You need to bare this in mind when think about the position(s) or rotation(s) of your entities within the world.

You can now edit the Position by highlighting one of the three values (X,Y,Z) and using left/right on the left-analogue stick on controller or holding left-mouse button and moving the mouse from left to right.

Adjust the position and rotation of the Obstacle as needed.

To rotate the Death Obstacle then highlight the Rotation options and do the same as how you changed the values for the position; if you want to rotate around the centre point then you will need to edit the middle (Y) value.

Creative Control: Increased Difficulty

It’s completely up to you if you want to increase the difficulty of the traversal of the level by adding more of the Death Obstacles. Place a few close together so players need to time their jumps, change the size of the voxel mesh, or apply the script on other mesh entirely.

Don’t forget to not make it too challenging, or you may put your players off and they may never come back; and who would want that!

With your new Death Obstacle setup in the level, it’s time for a bit of testing. You want to Preview your game and then try to collect the coin and bring it back to the start point. In my case the challenge is simple enough, jump over the obstacle to reach the coin and then repeat to bring it back to the finish.

Once you have finished play testing then you can exit out of the preview.

Rules of Motion

We have now got our simple obstacle in our level, and that is great to introduce our players to a challenge. But, we may want more than one challenge in our level. We are going to install another package that will quickly allow you to set up movement and rotation to any mesh object.

To get this additional package, you will need to open the Library and then the Community tab as you did before. We now want to make sure we have selected the Crayta Packages checkbox and then search for the “Rotate and Move” package and install it.

You can then close the Library and interact with your Death Obstacle. With the Death Obstacle highlighted, you will need to select the option to Edit DeathObstacle to open the Entity window.

Highlight and edit the death obstacle.

Scroll down in this Entity window and then select the Add to Entity button, then select Add > Script > rotateAndMoveScript to add the script.

Select Add to Entity to add the new rotate and move script.

With this installed you should see some properties that can be modified. Firstly, let’s check the Bounce property as this will stop the animation just snapping back at the end of the movement or rotation.

We can also highlight the middle value (Y) for the Rotation End and then set this to a value of 360. This should make the Death Obstacle do one complete rotation and then rotate back in the opposite direction, then keep doing this.

Adjust the rotate and move script properties to add motion to your obstacle.

If you want to Preview the game to see that the Death Obstacle is spinning correctly, and then exit the preview when you’re satisfied. Finally, let’s reopen the Entity window and set the Time value to 2 seconds so it’s more challenging and Preview our game again. The run is just that more perilous this time around!

Adding the moving obstacle makes the challenge much harder.

Recap

This tutorial was about taking you to the next level by adding packages and adjusting the properties of entities in your game. In this tutorial you have covered:

  • Packages in Crayta’s CREATE mode.
  • How we can install existing packages to make new gameplay experiences.
  • Adding existing Templates to our game.
  • Changing other Entity Properties including rotation and speed.

Adding Polish

You have the beginnings of a game, but there is no reason to stop there. Here are some suggestions how you could improve the experience and make some deeper gameplay mechanics:

  • Install another package like the Timer Widget to see how fast you can complete the course in.
  • Expand the mine tunnel and then add some additional traps and pitfalls to the Obby course.
  • Include more pickups for the player to collect and retrieve as they explore.