Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

1. February 2018


As part of the Godot 3 release, Godot got official support for VR headsets using Cardboard, SteamVR and OpenHMD interfaces implemented using the new GDNative functionality in Godot.  Today I decided to test it using my Samsung Odyssey HMD a Windows Mixed Reality headset that has beta compatibility with SteamVR.  I personally had very little hope for things to go smoothly… boy was I wrong.  What follows is a step by step guide to using VR in Godot.  This whole process is made possible by the hard work of Bastiaan Olij, his Godot 3 OpenVR project is available here.


First, we assume that you are using Godot 3 or higher.  If you havent already installed Godot 3 or higher, go do so now.

Next, create a new project, the specifics really don’t matter.  There are a few requirements, every scene must have a ARVRCamera and the camera must have an ARVROrigin as it’s parent.  I start with the following setup:

image


The ARVROrigin only has one property, the world scale.  The ARVRCamera has several more options such as FoV, an Environment and more.  For now the defaults are fine.  Next we need to do a small bit of code to run the VR server.  Attach a script to the root node and add the following code to _ready:

func _ready():
	var vr = ARVRServer.find_interface("OpenVR")
	if(vr and vr.initialize()):
		get_viewport().arvr = true
		get_viewport().hdr = false


And… done!  Really, that’s it.  Add a few objects to your scene under the ARVROrigin.  Plugin in your headset and press play.  At this point in time your scene should render on your headset and you should already have head tracking enabled!


Next up, let’s go ahead and install the OpenVR functionality.  First select the AssetLib tab:

image


Now search for VR and select OpenVR module:

image


Click the install button.  Then once downloaded, click install again:

image


Now click Install once again and addons will be copied to your project including all of the dlls and scenes we need.


Next it’s time to implement some controller logic.  You could implement them yourself using ARVRController, or you can let someone else do the hard work!  With ARVROrigin selected, right click and select Instance Child Scene…

image


Navigate into the module we installed earlier into the folder addons/godot-openvr/scenes and select ovr_controller.tscn.

image



Next you can add default behavior to the controller you just created.  Right click the newly created controller node, instance child scene and this time select Function_Pointer.tscn.  Your scene should now look like:

image


At this point you now have a 3D game with full head tracking, a single controller with pointer functionality.  Pretty awesome!  For even more functionality you can implement another controller, attach teleport controls to it and you will have the ability to move around.  Next replace your camera with a ovr_first_person scene and presto, you’ve got a VR game!


If you’d prefer the video version check here (or embedded below):

Programming ,

30. January 2018


Godot 3.0 is finally here!  Godot is an open source 2D/3D game engine and the 3.0 release brings a massive number of new features including a new 3D renderer, Bullet physics,Godot3Released C# support, OpenVR and Cardboard support, GDNative plugins and much more!  Stay tuned to GameFromScratch for some great new Godot 3 tutorials and more.  Our existing tutorial series is still about 90% valid if you are looking to get started today.


New features of this release taken from the Godot announcement blog:


You can get more detail in our hands on video available here and embedded below.

GameDev News

21. December 2017


With the release of C# support in Godot people are naturally going to want to use Visual Studio Code for their development.  This guide is going to walk step by step through the process.  It’s important to note that debugging is currently not supported.


Before continuing it is assumed that you are running Godot 3 Beta for Mono (or newer).  Also be sure to have a most recent version of Visual Studio Code installed.


If you haven’t already, be sure to install the C# extension in Visual Studio.

image


Next in Godot, let’s configured Visual Studio Code as our external editor.  Select Editor –> Editor Settings

image


Select Mono->Editor, then drop down External Editor and select Visual Studio Code.

image


Now when you edit a CS file in Godot, it will automatically open in Visual Studio Code.  Assuming you did the C# extension, you should get full intellisene, code completion, etc.


You now have two options, you can simply edit your code save it, then run from within Godot.  Or you can run directly from the terminal within VS Code.  In the terminal ( Ctrl + ‘ ) enter first the path to your Godot executable, as well as the scene you wish to run.  In my case:

D:\dev\Godot_v3.0-beta1_mono_win64\Godot_v3.0-beta1_mono_win64.exe Node.tscn

This should then execute your scene.


Of course, doing this over and over is going to get old quick, so why don’t we define it instead as a Task.  In Visual Studio Code select Tasks->Configure Task:

image


Next select Open tasks.json file

image


Now enter the following:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "run Godot",
            "type": "shell",
            "command": "D:\\dev\\Godot_v3.0-beta1_mono_win64\\Godot_v3.0-beta1_mono_win64.exe Node.tscn",
            "problemMatcher": []
        }
    ]
}


Be sure of course to set the path to your directory in the command setting.  Also notice the slashes are escaped using double slashes \\.  You can now run this via the palette.  Ctrl + Shift + P then enter Run Task

image


You should now have your newly created task available:

image


Again, doing this over and over again also gets old, so lets define a hotkey.  Choose File->Preferences->Keyboard Short Cuts.  Click the keybindings.json link:

image


Now enter

// Place your key bindings in this file to overwrite the defaults
[
    {
		"key": "ctrl+G",
		"command": "workbench.action.tasks.runTask",
		"args": "run Godot"
	}
]

This will cause your scene to run when you hit the Ctrl + G hotkey.


Programming ,

30. November 2017


Following on the heels of Alpha 2 released the end of October, we are one step closer to a full Godot 3.0 release with today’s release of Godot 3image Beta 1.  The major difference between beta and the earlier alpha releases is beta is now feature complete.  No new functionality will be added between now and Godot 3.0, only bug fixes and refinements.  This is important to me as it means I can get to work on new tutorials and content targeting Godot!

The beta release also contains several new features since the last alpha including Bullet as the new physics engine for 3D physics, onion skinning support for animations, improved remote debugging and auto tiling for tilemaps.

Details of the release from the Godot blog:

Godot 3.0's development officially entered the beta stage last week, which coincides for us with what we name the feature freeze: from now on, no new features will be merged in the master branch, as the focus will be fully on fixing existing issues to stabilize the current feature set. Don't worry though, Godot 3.1 will arrive soon after the 3.0 release to bring all the nice features that contributors are already working on.

To get broader testing of the feature-frozen branch, we're releasing an official build, Godot 3.0 beta 1, just one month after the previous alpha 2.

It notably includes Bullet as the new 3D physics engine, onion skinning, autotiling for 2D tilemaps, an enhanced debugger with remote SceneTree edit, and nice usability improvements such as code folding in the script editor, PascalCase builtins for C#, and many others.

But more importantly, it also brings tons of bug fixes compared to alpha 2, and we will continue to hunt down the remaining issues to guarantee a nice experience with Godot 3.0 stable. The documentation and translation have also been updated thanks to the work of our many contributors.


Downloads are not on the download page, instead available via the following links:


GameDev News

7. November 2017


With the upcoming Godot 3.0 release, there is a pretty major change to the physics system within the engine.  They have decided to replace the in-house physics engine with the open source Bullet physics engine.  Bullet is a well established open source project and has been used in such games as Rocket League, Grand Theft Auto 4 and DiRT as well as powering applications such as Blender and Cinema4D.  This change will not affect 2D physics in the Godot engine.


From the Godot announcement:

Introducing Bullet

Godot always supported an abstract physics interface, so Andrea Catania (Odino) volunteered to add Bullet support as a backend. I initially though it would not be possible to replicate Godot's API in Bullet faithfully, but Andrea proved me wrong and did a fantastic job. He also finished before the Beta deadline, so his work was just merged and will be present in Godot 3.0.

Physics should work just like before, and no code should change, except Bullet is being used internally. Godot's old physics engine is provided for compatibility and can be selected in the project settings, but will likely be removed by the time 3.1 is out.


In an unrelated but similarly timed announcement VR support was also added to Godot in the recently released Alpha 2.  You can read more about VR support here.  I did a hands-on video about both physics and VR in Godot available here or embedded below.

GameDev News ,

Month List

Popular Comments