Lesson 5 – Godot Introduction

Learning Objectives

  • To understand the purpose of Godot Game Engine
  • To create a new project
  • To add our character to the game

Learning Outcomes

All must Create a basic project in the Godot engine. (Level 5)

Most should Import the character into the engine, scale the character appropriately. (Level 6)

Some could Run the “empty” game, understand the effect of gravity in the game engine. (Level 7)

Keywords

Words to learn: Game Engine, Sprite, Bounding Box.

Starter

Look at the following video showing different games created with the Godot engine:

Now it’s time to make your own!

Main – Understanding Godot

This link takes you to the Godot website.  Godot is a Game Engine.   This is a type of software designed specifically to help you create video games.  Modern Game creation is not just about sitting down and writing code.  We need tools to lay out levels, place characters in the correct positions, decide on game logic and much much more.
Many big game development companies use engines like CryEngine, Unreal or Unity.  These are all quite expensive tools to use.  We will be using Godot.

Godot is very useful for three reasons:

  • It is Free Open Source Software (FOSS)  It will never cost you money to install or use.
  • It is cross-platform.  You can use it on Windows/Mac/Linux,  and you can make games with it for Windows/Mac/Linux Ubuntu/Android/IOS/HTML5 (websites).  Yes – you can make phone games!
  • It lets you make 2D and 3D games very easily.

Preparing for our game:

First, we need to make sure we have our file structure perfect.  This will save us trouble later!

Make sure you make a folder for your game (with the name of the game!) as below.  This will be called your root folder:

Now, inside the  game “root” folder, you’ll need an assets folder, with at least your character and platform images (saved as png!) inside:

 

Now Your teacher will show you how to create a project in Godot.  This video will help…

Adding Your Character:

Don’t be alarmed by technical names:-  this is all quite logical.

First we make a 2D Node… this holds the scene (or level) together.
We make sure the node is highlighted and add a rigid body 2d (the main object for our character as he/she will be solid!).

This is a bit like scratch… Our main character is a collection of code and assets… all bundled together.

Next we add a sprite to the rigid body (make sure it has been clicked on first).  The sprite is just the image we are attaching to our character.

At this point it makes sense to save the scene.

Clicking back on the rigid body 2d, we add a collision shape 2d.  This is a bounding box, which will let us control how our character touches the other objects in the game.

Finally, we add a raycast 2d to the rigid body.  The raycast “Predicts” when our character will hit something (a bullet, ground etc).

It is important, finally, to make sure the collision shape is set to rectangle (in the settings box), and the character image is set for the sprite.

This video will show you these steps in Godot:

 

Setting The Scene.

Now we need to specify the starting scene for our game…  The scene viewer in the centre of the Godot window will contain a “map” of our level, showing where platforms, baddies, characters, power-ups etc are found in the game.  Your game can contain as many scenes as you like.  Normally the main menu, credits, etc would also be scenes.  We’ll have to say which our main scene is.

Now, we’ll have to use the pointer (arrow) to resize our character…. remember the mouse wheel lets you zoom in and out in the scene editor.

You’ll imagine there will soon be lots of objects present in the game, so it makes sense to take a moment to rename things.

Finally, with all this done, we save, and “play” our game….  This video shows the steps up to that point.

If all has gone well, you’ll see your character tumble down the screen…

Task.

Remember we started to look at what a game engine does, by creating the game environment.  Why do you think your character just falls this way?

 

Plenary

Now we have our (falling) character, we’ll need somewhere for him to land.  You’ll need to work on level design, and sketch a layout of platforms for your character to jump around!