Sites


Initiation à Godot

Project setup

Project setup

From a producer point of view, making a game is not just having a good idea, but also making it real. This will often involve several people (at least some who program and some that do the artwork). As the project grows, needs of organization is increasing. This will sometimes result in a director application or at least some practice accordance.

In Godot, the first organization concept is the Project. Here, a project is basically a configuration file that will hold some of the game properties. From there, a few commons steps will be needed to quickly get a running game that could be used as a first prototype of our idea.

In this section, we will try to keep hands on the keyboard as much as we can. To demonstrate the basics step of the game production, we will use a some Flappy Bird clone example. We will call it HappyBat, and it will then be up to you to adapt it to your own project. 

If you are impatient to see game samples, you can have a look at the demos provided with Godot for example this classical Pong in the Demos/2D/Pong folder. But for this, you’ll need to know how to run them in a project context. 

Download

Get a Godot binary for your desktop platform from http://www.godotengine.org/projects/godot-engine/documents

The Server variant is a headless version (without screen) meant for remote computing.

Create the project

So, once the idea is clearly defined and that we decided to use Godot, the first thing is to create the game project.

  1. When you launch Godot, the first window you'll see is the Project Manager. This will give you a quick access to all the projects you’re working on.
    Godot project manager
    The data of the Project Manager are stored in the editor_settings.xml file placed in the .godot folder of your home directory. You can share this file within your team to provide ready-to-go projects for all the team.
  2. In your file browser or command line, create a new folder for your project. All the ressources of your game will need to be added inside.
  3. To create one, click the New Project button and use the Browse button to select the folder you just created.
  4. Then give a project name which is completely free. It can simply be the name of the game and validate.
  5. Once this is done, the project appears in the list and the folder has been populated with some files : engine.cfg which contains default properties for the game, an icon.png file and an associated icon.png.flags that is used to visually identify the game.
  6. You can then select the project and clickEdit. You are directed to the editor.

At this first step, the engine.cfg just contains very few informations.

[application] 
name="HappyBat"
icon="icon.png"

At last, if you already know the kind of ressources your project will need, you can create subdirectories in your game folder right now. There could be a script one, as well as assets which could include textures, sounds, musics, backgrounds, sprites…depending of your needs. Your project will use the filesystem as it's main organization method, so use your preferred method and tools to organize your assets the way it works best for your team.

If your manager is overwhelmed with too many entries, you might want to find a quicker way than looking to each one by one. You can basically use two approaches :

  • use the search engine provided in the project list. It will select the project names or paths matching as you type
  • select the project you don’t need anymore (there will certainly be some in the few hours if you follow us), and click the Erasebutton on the right. This will clear it from the list but data and ressources will be kept, so that the project can be reopen later with the Import option of the Project Manager.
If you want to test a game, choose Scan in the Project Manager, choose the folder where it is stored and click Run.

Define game settings

Once the project is created, we can immediately work in the editor or begin by defining the game settings available in the  Scene > Project settings menu. Here, we will find many predefined properties. As you can see in the window title bar, this window is a graphical editor for the engine.cfg file so that changes made here will be saved into that file and inversely.

Actually, we can see only two properties activated : name and icon in the application category. But many other possibilities. Especially in the Display category, we could define if the game launches in fullscreen mode, its default orientation or sizes and so on. Just click on the box before the property name to activate it and change the value in the right column if necessary.

For example, to support fullscreen, do the following :

  1. enable fullscreen mode by clicking the box at the left of the fullscreen label. This will make fullscreen mode available.
  2. if you make it on in the Value column, it will be the default display mode in which the game will be launched.

This is what look our engine.cfg like in the first step

[application] 
name="HappyBat"
icon="icon.png"

[display]
fullscreen=false

and after second step

[application] 
name="HappyBat"
icon="icon.png"

[display]
fullscreen=true

Saving is automatically done as you close the window.

It’s important to keep options consistent with other options or design decisions. If you enable fullscreen, you may think of the way your game may adapt. If you enable touchscreen emulation, you should take care that make it easy to use for users…

We will need to come often to this window, for example to define runtime options and improve performance, but for more basic thing like the mandatory definition of a main scene, as we will see in the next chapters.

Godot is storing information in files when it is possible. That way, it makes it easier to maintain, and to share, even during production time, especially when using a version control system like subversion or git.

Il y a une erreur de communication avec le serveur Booktype. Nous ne savons pas actuellement où est le problème.

Vous devriez rafraîchir la page.