Author Archives: Lamonte

Building Android Templates For your Godot C# (Mono) Project on Linux

Hi so this tutorial is going to be very precise, no shortcuts and it expects that you know how to use linux terminal and build things from command. When you’re building, you might see warnings which can be ignored, sometimes you may see an error and if rerunning the scons build doesn’t fix that error that means you either did something wrong or there is an issue that needs to be solved and it’s best to report it on the godot github issue tracker.

Requirements

  • Terminal (because you’ll be doing all this from terminal)
  • Python 2.7 or 3 (not sure if it matters, as long as scons runs)
  • Scons 3.0
  • Git
  • Android Studio (For installing SDK AND NDK-Bundle AND cmake)
  • Mono (I’m using 6.0.0 stable – editor & templates must be built from the same mono version and exporting must use the same mono version) [install specific version of mono]
  • Java (OpenJDK 1.8) [Scroll down to ‘Installing Specific Versions of OpenJDK‘ and follow those steps]
  • Distro specific one liners [to save you some time this will trying to install every build requirement such scons, libx11-develop, etc..]

Make sure you setup all these requirements first or you’ll end up being told what tools you’re missing when trying to build.

Continue reading

[FIX] Datagrip could not verify ssh-rsa host with fingerprint to Vagrant

So you’ve upgraded your datagrip or tools license and now want to use all the new fancy changes in the latest version of your database manager; and then you find out that you can no longer connect to your vagrant server? Well I have a solution for you.

Check your ~/.ssh/known_hosts (or c:/Users/USERNAME/.ssh/known_hosts) file on your development pc (not your VM) and you should find any entries regarding 127.0.0.1:2222 or []::2222 which are the default hosts for vagrant.

Remove those then try reconnecting and you should be good to go.

Hope that helps!

Source

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.

Requirements

  • 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)

Creating a Golang 1.11 local project and using local packages (vgo)

So I’ve been googling for a few weeks now trying to understand how to create a simple local application using vgo because it seemed fairly interesting to me. I’ve come across a few stackoverflow questions and the best answer was this one even though it wasn’t fully answering my question.

So if you want to create a local application without the need of using a local repository to create an application which uses other peoples modules then this is the article you’ve been waiting for which is odd how simple it is to accomplish and yet there’s little to no information available online.

So lets get started. First you should Download Golang 1.11 (latest) and make sure golang’s bin is set in your environment.

(Note: You also still need GOPATH to be set for packages to be cached else they will be stored in your user folder, so set a user environment variable for GOPATH to the path where you want your cache to be stored)

Next lets create a new goland vgo project. It’s very simple, load up goland, click New Project, select Go Module (vgo), make sure the project path is where you want your application to be stored and make sure the sdk (path to vgo is select, should be selected by default). I named my project “awesomevgo”.

This will create a go.mod file for you with the name of the module set for you.

(Note: Now if you want to create 3rd party modules, you’d probably want to create it normally then rename the module (so it doesn’t create unnecessary long folder name like ‘z:\blah\bitbucket.com\name’ gotta love vgo because of not needing to do that) to the repo path where it’s hosted like “bitbucket.org/name/reponame”. Then you’d write your module packages specifically for that repo like you would normally)

Creating the application example

Now this section is pretty straight forward. I’m going to show you a visual of what I’m doing, but also type it out for those that will come across this site and my images corrupt or something.

  • Create a subpackage, I called mine ‘example’
  • Create a subpackage file, name it anything you want with a go extension
  • Add the package name to the top of the file (goland does this for you)
  • Create a simple function that’s exported (starts with a capital)
  • Create a main.go file and add package main to the top – goland might try giving it the module name (default package name), ignore that since we want an executable
  • Add your `func main(){}` in there and then start typing out your function name and allow GoLand to auto complete it.
  • If you’re using a different editor or ide that doesn’t understand vgo just add the following import to the type `import “modulename/subpackagename”` then call your subpackage function (subpackage.FunctionName()) inside the main function then build the main script by calling `go build` or `go build main.go` which ever works for you. Or run it using go run ./

Below is a visualization of this which should be easy to distinguish 🙂

Hope this helps you create your local applications!