Tag Archives: godot

Quick Start Guide to Godot 3.1 on Windows 10 using C# & Jetbrains Rider

(Note: If you like this article you can support me by using my DigitalOcean.com referral link, and by using my referral link you are directly supporting my blogs that are hosted there. Also follow me on social media: @IMG4MR/G4MR)

Godot 3.1 was recently released and now is a good time to get more people trying it out. This version of godot makes it even easier to get up and running because it takes less work and this quick start is going to be an introductory guide on helping you do just that.

This guide expects you to understand how to install software, and a mild understanding of your editorial software/ide. For this quick start we’ll be using Jetbrains Rider, but the default preferred editor is Visual Studio Code because it’s just as easy to setup remote debugging with the mono runtime. You can use my guide here if you prefer to use Visual Studio Code. Then come back to this tutorial and we can get started.


  • Godot 3.1
  • MSBuild (via Visual Studio/Visual Studio Tools/Mono)

Godot 3.1 is more streamlined than before, requires less to get started. First and foremost it’s recommended that you download the latest godot stable from the website. Make sure you’re using the version listed under Mono version and install (move) it to your preferred folder location and create a shortcut of the exe if necessary. (note: the steam version does not include the mono build, I’m sure there will be a mono version released sometime in the future on steam)

(heed the note under the download buttons) Continue reading

Godot Tilemap Collision Detection & Finding the Corresponding Colliding Cell

So I’ve been working on a gamejam called the godot wild jam 5, and I will release source when I’m finish (hopefully I pull through, only have a few days left to get this done), and I ran into an issue with godot’s tilemaps. Basically the way godot’s tilemaps work from my understanding is in order for you to get collision detection you have to create your own tileset from nodes using staticbody2d’s with collisionshape2d’s as a child. That way you can in fact tell when you are colliding into other objects.

There were two issues I ran into, the first one being I couldn’t figure out how to deal with tilemaps that were scaled in a parent node up/down. The second issue was related to that and figuring out how to get the cell that my player touched. I have a solution to both.

First and foremost for this example to work you need to have your player node be a kinematicbody2d. The reason for this is because KinematicBody2D allows you to get some collision data that other nodes won’t give you without using a raycaster which I have no experience with at this time. That collision data comes from a method called move_and_collide or (MoveAndCollide for c#). This returns a KinematicCollision2D that gives you basic information on the object you collided with and the position of the object that you just collided with.

From here it made sense to subtract my current players position from that colliders position to figure out the direction of where the collision was coming from and in our case we wanted to know if it was TR, TL, BR, BL, T, R, B, L (top right, top left, etc…) that way we could determine the exact cell location that tile is located from my current position.

You wouldn’t think it would be that simple, but it was and here is the code on how I did that and I’ll add an example project of me reproducing it using gdscript for the sake of having an example available online somewhere.

So to explain what’s happening here in this example. First we check every physics frame if we’re moving and attempt to get the collision data. Then if we have collided with something we call a handle collision function to figure out if we collided with a tilemap (you can get more specific when working with more tilemaps, like the name, etc…) then I create a temporary vector2 to store our collision cell location data in. We need to determine what side the collision was handled on from our current player cell’s position. This is when we say look, we have a 3×3 tile section that we need to figure out which of the 8 other tiles from the center position that we are touching and to do that we simply figure out if the touching tile is greater than or less than the x and y position and we either add or subtract from 0 to determine that. Or we leave it at zero and do nothing meaning we’re on the same cell row or column so it’ll either be directly T, L, B, or R.

Now after we’ve figured out the cell’s location from our player location (this works even when the data is scaled, it’s pretty nifty) – we need to say hey where the hell exactly is our player’s cell location on the tilemap’s grid. We use world_to_map to determine this information. Now we want to take our player’s position and convert it to the local coordinates of the tilemap. This is useful if our tilemap has been scaled down to fit inside of something. So we need to first convert the players position to local coordinates to get the proper map location that our player is located at inside of that tilemap. To do that we call to_local from the tilemap node. Only nodes that derive from a Node2D have these methods.

So we have the exact player cell location within that tilemap and we also know the location of our collision tilemap cell, all we have to do now is add it to the value we get from world_to_map and then use that data and pass it to get_cellv to get the exact cell index in the tilemap and you can do what ever you want with that data. Edit the tilemap by removing the cell block, it doesn’t matter.

Hope this helped you understand how to get the tilemap’s tile cell point when colliding with a tilemap using a kinematicbody2d 🙂

Download (godot project 3.1beta)

Debugging a Godot C# Project using Jetbrains RIder

Currently you know how to debug godot using vs code, but my personal favorite IDE is Jetbrains Rider because I know most of the hotkeys and I use their other IDE’s for work on a daily basis. Rider just made sense, plus nothing beats an IDE made for working with a language.

(We’ll be using this project for this example)

Setting up your godot project

So lets get right to it. The first process is similar to the vs code tutorial, we need to double check a few settings in your godot project. So first go to Project -> Project Settings -> Mono -> Debugger Agent and make sure “Wait For Debugger” is checked. Next we want to change the wait time, the time is set using milliseconds, I personally increased this value to 10 seconds because it gives you a little time to enable the debugger and let it set itself up before attaching itself to your godot project.

setup godot csharp jetbrains rider

Setting Remote Debugging in Jetbrains Rider

In order for jetbrains to connect to the mono debugger we need to setup our configuration. So first select the drop down below Tests and Tools menu and hit Edit Configuration. Next we want to add the new configuration by pressing the green plus symbol and selecting Mono Remote. From here we rename our remote debugger, I used “Godot” as the name, set our host and we want to share the remote debugger so check that option as well. We’ll leave the port default for now. Hit Apply then hit Okay.

jetbrains configuration godot 3 csharp remote debugging

Now we need to setup the port for Rider to match the debugger in Godot

First go back to your debugger settings in your godot project and copy the debugger port

copy port godot jetbrains remote debugger

Next we need to edit our configuration in jetbrains. So like we did before use the drop down and select edit configuration, find our remote mono configuration and paste the port we used in our godot project.

Lets Debug!

Now to debug it’s simple, I start by running the godot application either by individual scenes or the full game by pressing the play button either works. Wait for the window to popup then head over to jetbrains rider and hit the debug icon and wait a second. If successful you’ll see variables in the debugger and you should be able to do everything you could with the debugger such as step in, step out, etc… I will note that sometimes the debugger may not work, simply just repeat these steps and wait a second after the window launches before trying to debug and it should work normally.

jetbrains rider debug test godot csharp

Wait, I still can’t get debugging working in my current application!

There’s a chance that you have some unhandled exceptions in your application and the debugger by default does not catch them. Take a look here where I purposely add a NullReferenceException to my application.

exception jetbrains rider csharp

So how do you fix this you ask? It’s very simple. First click on the Run menu and go to the very bottom and select View Breakpoints or CTRL+Shift+F8 (on windows). Next check Any Exception under .NET Exception Breakpoints and try debugging again. (note: you can manually add specific exceptions if you highlight .NET Exception Breakpoints then hitting the Plus sign and typing in an exception name)

exception jetbrains rider csharp

And that’s about it. Happy Debugging!

Building Godot 3.1 Mono (C#) on Windows 10 using VS Build Tools 2017!

UPDATE: Added changes to reflect native tools for vs 2017 instead of 2015
UPDATE 2: Added general information to get 3.1 building
3: Updated title to reflect what’s going on in this article, this article is mostly for building godot mono from the source on windows 10 and I’ve written an article on vs code specifically: visual studio code setup. Also if you’re looking for a quick-start guide checkout my recent article.


Using this method doesn’t statically link mono into the export binary and requires you to ship the mono-sgen dll along side your executable. It’s recommended to use the official builds from the official website.


So recently I came across Godot from a reddit post because I got inspired to get back into gamedev. Problem was I couldn’t figured out a language to use because the languages I wanted to use is either not recommended for desktop game development (Java/Kotlin) or still in development without full windows support (Crystal). My friends been using unity lately and has been inspiring me, but I remember when Unity got it’s 2D support and I was excited to try it back then. When I thought about my experience I always had in the back of my mind how the latest C# support wasn’t really there yet, but it was improving and the scripting api was a mess (in my eyes).

I checked out godot’s website and skimmed the news and noticed oh cool 3.0 is almost out, what I failed to realize was 3.0 was already out I was just reading an old RC post and some how missed the announcement post and got really excited. I checked out the new docs for 3.0 and man does it look great. Although I do think getting things setup on windows could improve, everything else is spot on! Loving it guys, keep up the great work.

Fast Forward

So I bit the bullet and downloaded 3.0, had issues right away and then by the power of a lot of googling I came across two videos which saved me hours of stress (also please go check out their godot content and support those guys).

Now I didn’t know a lot of things regarding godot, like that I needed to rebuild it to make it properly work for me on my machine. So with a few guides (including the videos above) I ran into some common pitfalls and hopefully this guide should help you get EVERYTHING ready to make this go as smoothly as possible.


The following are things I used to build and get c# working with intellisense out of the box using visual studio code.

Alright, all the above is everything I needed to get godot compiling properly, and getting the scripts to work properly in visual studio code.

Setting up Scons

I had a little issue with scons when trying to figure out how to get it to work, but it looks like I just needed to make sure python and the python scripts path was added to my windows paths and I could call scons from the command line which should spit out some weird error instead of command doesn’t exist.

  • #:\Python27
  • #:\Python27\Scripts

Above paths where # is your Drive where python folder is installed because when you run the scons installer it’ll look for the python27 folder and install there. Simple enough.

Preparing for Godot 3.1

3.1 changes a lot in the build process. So I’m going to provide a few things to get you ready for building 3.1

Mono does not trust certifications by default. So we need to make sure we have them setup on windows by running the following commands in console (mozroots and certmgr should be provided by mono’s bin folder so make sure you have mono added to your path if it isn’t added automatically).

$ mozroots --import --sync
$ certmgr -ssl https://go.microsoft.com
$ certmgr -ssl https://nugetgallery.blob.core.windows.net
$ certmgr -ssl https://nuget.org

This should allow you to build without hitting any errors with nuget.

Building Godot 3

Firstly I’m going to direct you to the official docs regarding building in case my instructions aren’t clear. I didn’t use Pywin32, then again I have an i7 4790K cpu so the build speed wasn’t too  slow, but probably could’ve been faster if I followed the official docs instead of 3rd party sources. Pywin32 is completely optional though not needed for this tutorial.

So the first thing you need to do is open the visual studio build tools command line. This does some fancy stuff like properly finding environment variables to let scons properly compile godot. Read the docs for more information on that. Now open your windows search menu and type in x64 Native Tools and you should see a list of options that look like the following:

The one you want is x64 Native Tools Command Prompt for VS 2017 or x86 for 32bit version of godot and mono. Make sure your mono installation matches the version you’re building (64bit mono + 64 bit build tool and vice versa).

(Note: You could also open up the windows start menu and select “V” and look under Visual C++ Build Tools to find the same exe. Also you don’t need to run this as administrator)

Cloning the Repo

Now that the visual c++ command prompt is open travel to the drive’s home path so in my case it’s C:\. Create a temporary directory called temp and travel inside the directory.

Go to the git repo and find the clone path for the version of godot you’re trying to build, we’ll be building master for now.  Try other releases if master gives you problems.

Type git clone repo/link to clone the repo inside of the current temp directory. It’ll look something like this:

git clone https://github.com/godotengine/godot.git

Now travel inside of the repo path so you can build the project.

Building godot with mono support

This next part is pretty simple. If you’ve already installed Mono (which you should have), it’ll come with MSBuild 15.0 and you won’t have to deal with finding MSBuild yourself.  Mono should’ve already added itself to your paths and you’re already set for building the project.

We need to build godot twice, once without and once with mono glue. The first time allows us to get the mono modules to support C# scripting and the second build is to allow us to use C# scripts with mono support. So first lets build godot to generate our modules and to do that you need to run:

scons p=windows tools=yes module_mono_enabled=yes mono_glue=no

Now you have to wait a bit, check the docs if you want to speed up building with Pywin32. Could take upwards to 10-15 minutes depending on the speed of your cpu. Once the build is complete it’ll let you know and if you have any errors go back and make sure you didn’t miss installing any of the requirements I listed above and if you continue to have issues check the docs and let me know if I missed any steps as I’m a bit tired writing this as I just got done getting this to work perfectly for me.

Once that’s done go to the bin folder and get the exe name and copy it to your clipboard. In my case the exe is godot.windows.tools.64.mono.exe. Now we need go back to the root godot folder to generate the glue code so we can rebuild w/ modules supported. So type the following in the command prompt:

bin\godot.windows.tools.64.mono.exe --generate-mono-glue modules/mono/glue

If that doesn’t work go back to the bin folder and try:

godot.windows.tools.64.mono.exe --generate-mono-glue ../modules/mono/glue

Which should do the same thing. Once that’s finished we need to rebuild godot with mono support. So type the following command and we’re done with the editor:

scons p=windows target=release_debug tools=yes module_mono_enabled=yes

(Tip: You can bundle mono with the editor by providing copy_mono_root=yes to the build command above)

You may also need export templates so the follow commands will do just fine:

scons p=windows target=release tools=no module_mono_enabled=yes
scons p=windows target=debug tools=no module_mono_enabled=yes

3.1 introduces a new ‘data.mono.[PLATFORM].[32/64].[release/debug]’ folder

When building templates these new data folders need to be added to the godot templates folder because it includes new assembly files when exporting.

Now you should be set on the build process. Move the godot folder to wherever you want and you should be able to execute it without any issues.

Testing Visual Studio Code

(Here’s a tutorial on getting c# working with visual studio code)

If you’ve never started up visual studio code just start it up and keep it open. Then with godot create a new scene and save it. Now create a new Panel and save it. Create a sub Label node and rename it to “my_label” and edit the text to say anything really. Press the play button to make sure godot runs and shows the text.

Update: forgot one important note, make sure in editor settings under Mono -> Builds that you select MS Build (System) instead on windows. This worked wonders for me, thanks to this guy for the suggestion.

Go to editor -> editor settings and select Visual Studio Code from the External Editior drop down option. Now add a script to the label and select C# from the language drop down and hit create. This should open my_label.cs in visual studio code without any issue. Inside the _Ready() methods body add the following:


Don’t copy and paste the above because we want to make sure the intellisense/autocomplete works. When typing GD. you should see a bunch of methods after the period and Print should be one of the methods in the list as you type. If you see that you have completed the setup of Godot and I hope you have fun going through the Step By Step tutorial and learn about the editor and scripting to start making your first game!