Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon
23. February 2016


We mentioned a few weeks back that Godot 2.0 Beta was released.  Today we can remove the beta moniker from the release, the full blown release of Godot 2 is now here.  Major new features from the release include:


While for 2.0 core changes were not a priority, there are some nice improvements on this release!

Improved scene instancing

Instancing is one of Godot's best features. For this version it has been further improved. Previously, only the root node of a scene was editable. Changes to sub-nodes would result in data loss.

It is now possible to edit any children node of the instanced scene and have the changes persist. Even sub-instances of instances can be edited with persistent modifications.

Scene inheritance

Begining Godot 2.0 scenes can not only be instanced but also inherited. This allows many interesting use cases such as:

  • Having a base scene (ie, enemy, collectable, obstacle, etc.) with a node hierarchy common to all (like explosions, shines, indicators, etc), and then extend it for each class.
  • Making non-destructive changes to a scene that was imported (ie a 3D scene, etc.)
  • Making non-destructive changes to a scene created by another team member.

New text-based scene format

Godot supports the XML format for saving scenes and resources, but we had problems with it:

  • Scenes are saved packed in xml, so the content is uncomprehensible.
  • The format is not efficient to parse.
  • It is not friendly to VCS (Git, SVN).
  • XML is not easy to write manually, and it's easy to make mistakes.

Having this in consideration, Godot 2.0 adds a new text file format inspired by TOML. This new format is descriptive (human friendly) when saving scenes, and Git/SVN friendly:

For 3.0, this format will be the only text based format supported, and XML will be deprecated.

onready & singletons

Initializing class member variables can be quite of a hassle, code such as this is common in GDScript:

The 'onready' keyword allows initialization of class member variables at the same time when _ready is called, saving some code:

But doing this for autoloaded scenes can still be a hassle, as it has to be done every time a script is created. To ease on this, it's possible to make an autoloaded scene or script a singleton variable (accessible at global scope) in the project settings:

All this, of course, working together perfectly with code completion.

Other new core features

Smaller new core features were also added:

  • Support for ZIP packs on export instead of PCK
  • Support for OPUS Audio Format
  • Changed to a more compatible JPG decoder.
  • Very improved gamepad support


The Editor part of Godot 2.0 is where most of the work was focused. The priority was to improve tools and make the workflow more efficient.


Godot 2.0 sports a new theme courtesy of Andreas Esau. It looks more professional and less confusing than the previous one. Many unneccesary icons, margins, arrows, etc. were removed to further clean up the visuals.

As a plus, dock panels (which were previously fixed on the right) can now be moved and rearranged.

New file dialog

One of the common hurdles with Godot was the overly simple file dialog:

For 2.0 we have created a new one, which supports:

  • Navigation History
  • Favorites
  • Recent Folders
  • Thumbnail Previews (and list view compatibility mode)

New filesystem dock

Godot used to have a primitive tree dock panel view with all the project resources. This was replaced by a more modern filesystem dock:

This new panel can show resources in both thumbnail and icon view (similar to File Dialog), but it also includes several tools.

By popular request, Godot's new filesystem dock has tools to allow the user to:

  • Rename and move files and fix all resource/scene dependencies automatically.
  • Warn when files being deleted are referenced by other resources.
  • Use a heuristic to search for broken dependencies within the project.
  • Visually explore and reassign dependencies for a given resource.
  • Explore the owners for a given file.
  • Explore which resources might be orphan, for easier clean up.
Multiple scene editing

Godot's divide and conquer approach to making games relies on subdividing scenes in several sub-scenes, each with an identity or function.

Godot 2.0 improves upon this with multiple scene editing support, allowing several scenes to be open at the same time. Switching between them is painless and Godot also automatically reloads scenes when a dependency (instance or inheritance) has changed.

New tool layout

In Godot, tools appear contextually when a given node or resource is selected. This makes the UI flow fast and removes large part of the need to maually organize panel layouts.

This aspect of Godot was also improved in 2.0 with the introduction of a new bottom panel. On it, contextual editors can make a tidy appareance. Some of the editors are also always shown with persistent buttons:

  • Output console
  • Debugger
  • Animation editor

New code editor

Godot has the code editor integrated to the rest of the editors. Until Godot 1.1, scripts were opened contextually to the scene being edited but, as multiple scenes can now be edited, this is no longer possible.

To compensate, the new code editor now works more similar to an IDE, where scripts are just opened all the time. Switching to a scene will also automatically switch to it's dominant script (script in the root node, where it's most commonly placed), making the programming experience smoother.

The code editor also has many new features:

  • List of opened scripts, as using tabs would mean running out of space quickly.
  • Temperature indicator for each script, with most commonly used scripts being shown closer to red.
  • Script history: It is now possible to go back and forward in history of edited scripts easily.
  • Documentation pages show as documents. This allows having multiple pages open together with scripts.
  • Quick access to tutorials, class list and help search.
  • Improved code completion

Improved debugger

The debugger has seen many improvements too. A new addition is the reporting of run-time errors with proper notifications.

Godot is designed from the ground to attempt handling common crash situations by recovering and reporting an error. This is helpful in production games, as unexpected bugs that might commonly cause a crash will not make it fail. These errors, however, were silently being reported to stdout, so it was not easy to spot them. Added to that, given the debugger does not stop for them, having some context to understand their origin was difficult.

A new section "Errors" was now added which turns red when run time errors occur. Selecting or hovering the error will display a backtrace of script files that led to this situation.

Video memory debugger

Another new, useful feature is a new Video Memory debugger. This allows to see how much video memory is in use, as well as to discern which resources take up the most amount of video RAM.

Debug on hardware devices

It is also now now possible to debug a game running on an actual devices. Make sure to enable "Deploy Remote Debug" option in the remote options menu. If you have a device with Android 5.0+, Godot can take advantage and debug over the USB cable directly.

Collision and navigation debugging

We added support for debugging collision shapes and navigation polygons, both in 2D and 3D, in run-time. Just select the "Visible Collision Shapes" and/or "Visible Navigation" options in the above menu to enable this.

Live scene editing

In the vein of larger game engines, Godot has now live editing support. The way it implements this feature is different though. Godot uses IPC to synchronize the editor state with the running game. This means that any change made to the scene being edited is reflected automatically on the running game.

While this approach to live editing does not allow easy inspecting into the game from different editor cameras (something it might be implemented eventually anyway), it has the huge advantage of allowing the possibility of editing a level while it's being played (and avoid the edited state from being lost when the game stops). Just add enemies, move them around, change their properties, add colliders, platforms, tiles, etc. and everything is reflected instantly on the running game.

To enable live editing, just toggle it at any time from the remote options menu.

Video of live editing in action:

It is also possible to do live editing on an actual device! Just select "Deploy Remote Debug" together with "Live Editing" in the remote options menu:

New color picker

There is a new color picker courtesy of Mariano Suligoy, supporting visual HSV, raw mode, screen picking, favorite colors, and more!

Smaller new additions

Godot 2.0 brings several smaller new additions to aid in usability:

  • Visible history for property editor
  • Selection for overlapping objects in 2D and 3D
  • Categorized project and editor settings
  • Inline documentation as property tooltips
  • Array / Dictionary property editing
  • Multiple node editing
  • New Animation Editor Layout
  • Improved anchoring tool
  • SpinBoxes (both controls and in property list) can be dragged to change value.
  • Many more small additions.


We know the weakest part of Godot is still the 3D engine and we plan to fully work on modernizing it. However, we feel there are several more urgent issues that need to be improved usability wise. Godot 2.1 will continue in the same vein as 2.0 and keep adding usability improvements. (Feel free to check the Roadmap ).

The full text of the release notes are available here.  There is an even more complete change log available here.  The Godot team have also launched a Stack Overflow style question and answer site available here.  Of course, if you are interested in learning Godot Engine we have a comprehensive tutorial series available here on GameFromScratch.

GameDev News

26. January 2016


I’ve been waiting on this one for a while, Godot 2.0 has finally been released in beta form.

Never one for ...  lengthy release notes, this release is not exception:

After a long, long time in development Godot 2.0 is now in beta!

Godot 2.0 Beta features a new interface , and huge amounts of usability improvements.
It is also more stable than ever, with hundreds of bug fixes and small enhacements.
Give it a test in the Downloads section!

Due to the lack of details of what is in this release (EDIT—Actually, read below, author contacted me via twitter with WIP change log), I instead leave you with a screenshot of the new 2.0 UI in action:


EDIT – The change log is still a work in progress, but here are it’s contents at present:

Useful links:

Related GH issue:

Closed issues against 2.0:

Closed PRs against 2.0:

Closed PRs since 1.1-stable:

Remember to compare between the current status and 1.1-stable, we don't need to mention changes that were done in between, like fixing regressions added after 1.1-stable.



- INI-style `.tscn` and `.tres` file formats for scenes and resources

- Haiku platform support

- Scene inheritance: scenes can be based on another one and save only changes relative to the base scene

- Support for Opus audio codec

- Godot icon for Windows editor using `pe_bliss` (GH-2195)

- Added ability to export current scene to a .zip file // what is this feature?

- Option to keep collision shapes at run-time (GH-1045)

- ConfigFile.get() now has an optional "default" value to return in case the value is not found

- Alt+Right click to pick layered nodes (GH-837)

- Z-position in Node2D to specify draw order (GH-405)

- GUI node (Control) rotation and scaling

- Building on Windows now works with Visual Studio 2015

- Improved joystick support


- Option to convert .tscn format scenes to binary .scn format on export

- Option for zip-compressed resources (rather than binary pck)

- Option to export resources only


- Live scene editing

- Open several scenes at once

- Dockable UI windows

- Revamped script editor; recently viewed scripts appear in a red color, whereas less recent ones appear in a blue color

- Merged Script and Help tabs, help is now viewable from the Script tab

- Alt+Right click to pick layered nodes (GH-837)

- Improved "Project Settings" and "Editor Settings" dialogs (sections)


- Option for  visible collision shapes, navigation, joints and paths at run-time (GH-934) (GH-2439) // clarify what is visible in 3D

- GDScript keyword `breakpoint` for persistent breakpoints (GH-3165)


- Custom signal syntax `signal my_signal(parameter_a, parameter_b)` at class level

- Constructor `Color8(r, g, b, a)` and members `r8`, `g8`, `b8`, `a8` for `Color` type to define colors using 8-bit (0-255) values (GH-2339)

- GDScript export hints

  • - `int, FLAGS` — full range of bit flags (GH-2282)
  • - `int, FLAGS, "Flag 1", "Flag 2"` —set of  named bit flags (GH-2988)
  • - `float, EXP` — float edited with exponential slider (GH-2988)
  • - `float, EASE` —  float edited with easing functions display (GH-2403)
  • - `String, MULTILINE` —  string edited with multiline editor (GH-2323)
  • - Global filesystem hints restricted to tool scripts
  • - `String, FILE, GLOBAL` — File in global filesystem (GH-2988)
  • - `String, DIR, GLOBAL` —Directory in global filesystem (GH-2988)

- Extend directly from `Object` type (GH-2776)


- New default theme by Andreas Esau (@ndee85)

- Replaced JPEG decoding library with a new one, supporting progressive JPEG

// don't think we should mention that - Removed some extraneous prints in console

- Updated to libpng 1.5.26, fixing various upstream security issues

- SpinBoxes now repeatedly increase/decrease value when the up/down button is held

- Improved text selection in TextEdit

- PI is now a constant (GH-2134)


- KP5 now toggles between orthogonal and perspective mode as expected in 3D view

< and > not longer get swapped in .xscn/.xml format (note that this might break some logic in 1.1-stable games that relied on the buggy behaviour) (GH-2649)

- Fix uniform scaling of non-square CanvasItem nodes (GH-3224)


- Undocumented GDScript aliases `vec2`, `mat32`, `vec3`, `mat3`, `trn`, `dict` and `function`


(things that might be integrated in some categories above, once sorted)

Node-specific stuff:

    - VideoPlayer:

        o add possibility to set the audio stream (GH-158)

GameDev News

8. December 2015


This tutorial came about as a result of a question on my YouTube channel, although it is one of those things that you are going to need to know before long in 3D game programming, so I have made the answer part of the official Godot Engine tutorial series.  The question was:

I am making a 3d game and I want to use a sort [of] top down style camera.

I want it so that if an object gets between the player and the camera, that same object will become transparent. For that ( I think ) I can use the "Use Alpha" function in the fixed material settings.
So I think I need a raycast shooting rays ( between the player and the camera ) and if it hits something it needs to "find' which object was hit en change the material settings so it becomes transparent.

Now, the problem is that I don't know how to set this up;
-how can I get which object is hit by the ray and how to change the material?
-do I need to create a separate layer for this?

This is one of those things even the most simple 3D game is going to encounter, but the solution isn’t obvious, although the questioner was extremely close in his guess.  You can solve this using Ray casting, it’s probably just the how of it all that is difficult to figure out.


As always there is a video version of this tutorial available here.


If you have a situation like the above, where you want to determine if something is in the way of your camera, it’s exactly RayCasting that you want.  Let’s take a look at how.


Setting Up The Scene


First you need your scene to be set up correctly.  This means that each entity in your scene that can be collided with has to be a physics object of some kind.  I created the following scene arrangement:



As you can see, I have a camera and two Rigid Body objects, each with a CollisionShape (Cube) and a Test Cube child.  Additionally I created a RayCast object as a child of my camera.  Be sure to create the RayCast child before you transform your camera, so it is positioned properly.  For my RayCast I use the following settings:



My scene ends up looking like this:



The Code


As you can see, the Ray extends from my camera and through both objects in the scene.  In this example we want to see if we hit the first cube (“RigidBody 2”) and if we do, we want to hide it.  Time to look at some code, the following script was attached to the camera:

extends Camera

var ray = null

func _ready():
	ray = get_node("RayCast")

func _process(delta):
	if(ray.is_enabled() and ray.is_colliding()):
		var collidedWithObject = ray.get_collider()
		if(collidedWithObject.get_name() == "RigidBody 2"):
		get_parent().get_node("RigidBody 2").show()


… and that’s it.  We check to see that our ray is enabled and if it is currently colliding with something.  If it is, the first collided object is returned by the call get_collider().  In a bit of a hard coded hack, we check the name of that object, and if its our second cube, we hide the entire hierarchy.  In the event that no collision occurs, we make sure that RIgid Body 2 is visible with a call to Show().  You will notice that there is code in there to move the camera on press of the Up and Down arrow keys.  As you will see, as you move the camera, when the ray isn’t colliding, the second cube is shown, otherwise it is, like so:




It is also possible to create the ray programmatically using the PhysicsServer, like so:

extends Camera

func _ready():

func _fixed_process(delta):

	var directState = PhysicsServer.space_get_direct_state(self.get_world().get_space())
	var collisions = directState.intersect_ray(get_translation(),Vector3(0,0,0))
	if(collisions.size() and collisions["collider"].get_name() == "RigidBody 2"):
		get_parent().get_node("RigidBody 2").show()


Note that _process what changed to _fixed_process().  This is because space_get_direct_state() is only valid during _fixed_process or _integrate_forces() calls.  Otherwise we crate an intersect_ray() between the camera position and the origin, which in turn returns if there is a collision between those two points.  If there is, we hide the collided objects, otherwise we call show().


The Video


28. September 2015


Now that we have covered 3D basics and loading and creating static meshes now it’s time to move on to loading and using animated models.  Godot currently supports animation only in COLLADA format, which is supported with varying degrees of success in all popular 3D modelling applications.  If you are exporting from Blender, consider using the Godot Blender exporter plugin instead of the built in exporter.


As always there is an HD video of this tutorial available here.


In the video I show the entire process of creating the animated mesh in Blender.  If you want to see how it is done, I recommend you watch the video.  Unfortunately I could not get COLLADA to export multiple named animations, so I had to create all the animations along a single timeline.  If you work in Maya or Max it may be possible to get named animation clips to work correctly.

EDIT – I was mistaken about how to export multiple animations using the Better Collada plugin.  It does in fact work and the process is demonstrated in this video.  Sorry for that.


Here is the model and animation we are working with:


It’s 100 frames of animation in length driven by 3 bones.


Importing a 3D Model


First let’s start with the process of importing a 3D model.   In Godot a 3D Model is imported as a scene.  This means it will also have all of the miscellaneous things included in your scene, such as lights and cameras.  Be sure to remove those or not export them if you do not want them as part of the hierarchy.  Also be sure to save your existing scene before importing a new model, as unsaved changes will be discarded.


Godot only supports dae (COLLADA format) models.  Import by selecting Import->3D Scene.



In the resulting dialog, you have to select a file, as well as a location to put it.  There are several other things we can set controlling how the mesh is imported, how textures work and even defining animation clips, but the defaults will work for now.



Again, be certain to save your scene before you click Import and Open!


Now your model will load in a new scene.  It will default oriented about the origin and there is a good chance your camera will be inside your model, simply use the scroll wheel to zoom out.




Note that the scene has the same name as your model by default.  Notice also the hierarchy of nodes it created.  At the top is a Spatial, and if you have a skeleton attached and Armature exists with the Mesh(es) as children.  If there are animations, there will also be an AnimationPlayer node created.  This is what we are going to focus on next.


Splitting Animations


We want to split our single long animation into a pair of smaller animations.  Note that in the import that default FPS of the animation was set to 15FPS ( you can change it if you wish ).  Select the AnimationPlayer Node and look in inspector.  If you didn’t specify any clips in the import process you will have simple “Default”.  If you go to Play you can set the animation that plays on start up:



With the AnimationPlayer selected you will also see that the animation editor is shown at the bottom:



Using this tool, you can duplicate the default animation twice and then crop each animation accordingly.  We actually already covered using the AnimationPlayer editor in this post so I wont be covering it again.  If you struggle with the process however, simply watch the video and it is shown in detail.  I created two animations, BendForward and BendUp by copying and halving the default timeline.


Creating a Model Instance


Now that we’ve got a model to work with, let’s flip back to our original scene and put it to use.  Save your scene, then in Godot select Scene->Go To Previous Scene, or simply load the .scn file.



Now we add an instance of our scene to our scenegraph.  Click the + icon:



In the file dialog, select your recently created scene.  Your scene graph should now look like this:



And your model should now appear in your scene.  Not the drop down icon beside the node, this can be used to open that scene or to toggle the visibly of child nodes in your parent scene:



Playing Animation


Now that we’ve got our model in our scene and our animations defined, let’s play them in code.  The process is remarkably simple.  Attach a script to the root of your scene and add the following code:



As you can see, you access the nodes just like any other in Godot.  There is even autocompletion on the available animations in the play() method!  That’s all you need to do to play the animation.  If you refer to the earlier animation tutorial, all the same logic can be used to create extremely complex animation systems.


The Video


25. September 2015


Building on the previous 3D Godot Engine tutorial, today we are going to look at dealing with static meshes in Godot.  That is, meshes that don’t change and do not contain animations.  We will look first at loading a 3D model in OBJ format, apply a texture, then finally look at programmatic mesh creation.  Then in the follow up tutorial, we will look at importing and using animated (COLLADA) meshes.


As always there is an HD video version of this post available here.


Importing a 3D Static Mesh


For simple non-animated models you can import them using the OBJ format which is supported by just about every single content creation tool available, but is very limited in functionality.  First of course you are going to need a 3D model in OBJ format to work with. If you are incapable of creating one yourself, there are plenty available on  Personally I just opened Blender and textured mapped a simple cube with a test pattern like so:



Be sure to save your texture externally if you go this route!  Another thing to notice is that the up axis in Blender is Z, while the up axis in Godot is Y.  Notice the orientation of the texture in the above image.  When you export your OBJ file from Blender, you can select the UP axis:



It beats rotating everything by hand, no?


Importing your Model into Godot

Importing a OBJ format model is trivial in Godot.  Simply select Import->3D Mesh.



The following dialog will appear:



For the most part you will keep the defaults as they are, however if you made use of smoothing in your DCC, you may want to enable it here.


Instancing a Mesh


Now that we have our model loaded, we can create an instance of it.  As you may be able to guess, we use the node MeshInstance, which of course is a Spatial.



You can have multiple instances of the same mesh.  However if you are going to have several instances of the same mesh, and they are relatively close together instead use MultiMeshInstance.  It’s a Node for optimizing performance.  If you have several instances of the same mesh, MultiMeshInstance will batch them all together into a single draw call.  For now though let’s focus on MeshInstance.  Create a new one in your scene like so:



Now in the Inspector select the Mesh and pick the mesh you just imported:



You should now see your imported object in your scene:



But UGH, no texture.  Let’s fix that.  Select Material Override and choose New FixedMaterial:



Next import your image into Godot as 2D Texture:



Now select the fixed material  again and edit:



Scroll down and locate Textures->Diffuse, then Load:



Select your texture map.  Now you should see:


Woot, textured 3D object.


Now there was a TON of stuff we just glossed over.  There are dozens of settings you can set on the FixedMaterial, then there was the ShaderMaterial, which enables you to use a GLSL shader on your 3D object.  We will cover these at a later point in time.


Dynamic Geometry


Sometimes you may find need to create your geometry dynamically.  Godot fully supports this, in fact there are two way to go about it.  The first is using an ImmediateGeometry node.  This provides an OpenGL 1.1 like fixed pipeline interface for creating geometry.  It’s intended for geometry that is going to change often.  I added an ImmediateGeometry node to my scene, then attached the following script:

extends ImmediateGeometry

func _ready():

When run:



You can also generate a mesh dynamically using SurfaceTool.  A more expensive process, so not something you are going to want to change on a frame by frame basis.  In this case we use MeshInstance just like we did when we loaded the Obj file, but in this case we create the mesh instead of loading it from file.


Here is the script to create a triangle, this time with UV information specified so it can be textured:

extends MeshInstance

#export(FixedMaterial)    var material    = null

func _ready():
  var surfTool =
  var mesh =
  var material =


Now when you run it:



Explaining how to generate a mesh, what UV coordinates are, etc are way beyond the scope of this tutorial.  Most introductory OpenGL or Direct3D tutorials will give you the knowledge you need to create geometry programmatically.


Notice in the example above the line that is commented out?


export(FixedMaterial)    var material    = null

This is an EXTREMELY powerful feature of Godot, enabling you to use built in editors to set values of your game objects.  Uncomment that line and comment out the line and look at your object in Inspector:



By simply exporting a var from your node you get editor access.  Very cool.


That’s it for now.  In the next tutorial we will look at loading more complex COLLADA models with animations.  By the way, if you are looking for a great primitive library, or a more indepth procedural mesh example, be sure to check out this project.


The Video



GFS On YouTube

See More Tutorials on!

Month List