Csharp testing on Windows 11 version 23606 with Dot net 8.0.100 and Godot engine 4.2.1 : hello world
Dot net 8 Csharp testing with Godot : hello world
About the author...
since 2001, Insider since 2014.
Thanks to Microsoft EMEA GBS to let me participate in the year 2014 to the Insider project during my work. Then, This Windows test project, here in version 11, is based on the cycle of the insider Preview Builds, now in the Dev Channel: it is fun to test the new features. I can learn new features, validate them and share them with you :-)
This tutorial is made in a test environment, for pleasure and not to earn money. It is a non-profit project. It shows that the concept is possible, for a demontration, artistic, or educational purposes, school learning course. Don't test in a real environment in production.
Csharp testing on Windows 11 version 23606 with Dot net 8.0.100 and Godot engine 4.2.1 : os testing in the last article
The Windows 11 Operating System version 23606 was tested in the last article. Check article version 23606 here . Now that operating system is ready, i can test an application.
Csharp testing on Windows 11 version 23606 with Dot net 8.0.100 and Godot engine 4.2.1 : application testing
Now, OS Windows 11 version 23606 is ready, so i can test the middleware apps, frameworks...
Recently, i saw a cool session by Michael Hawker at .NET Conf 2023 about creating a game with C# and a middleware called "Godot engine".
Next, i read this cool article from Natalia Dalomba: "Using signal emitters to access C# scripts" with Unity game engine. I thought Unity was a good application to test because we can develop with C#. C# to create games? It could be so fun! Natalia write plenty of great articles and tutorials on Unity. Each day she writes a new article and i'm glad to read it, and think about the next article that will be greater!
But, meanwhile, i read this very interesting article from Mina Pêcheux : "Goodbye, Unity. After 15 years, I’m sadly forced to stop working with Unity." . Mina has written plenty fantastics tutorials about games engines. I enjoy reading them. Then, by reading this article, i discovered that plenty of games developers are quitting Unity because of license restrictions. What a pity, what a mess...
By browsing others C# resources on Mina Pêcheux website, I found this great book “L’ALMANACH – UNLOCK YOUR GODOT 4/C# POWER: GETTING STARTED” . So, what about testing Godot framework using C# ?
“Who is this book for?” “…using C#...”Or even just any curious mind willing to take a few hours to discover some fun tips…”
Oh! Perfect! C#, and i’m the curious mind
Now I can install Godot application.
Because I’m testing this on Windows 11, I go to download the Windows 11 version:
https://godotengine.org/download/windows/
Download for Windows - Godot Engine
Windows 11 version 23606 Dot net 8 Csharp testing with Godot download Godot engine -v2.jpg
So cool: there is a 12 december 2023 version with C# support and .net ! :) I know already that, else I wouldn’t be here :)
Let’s download it.
Edge downloads Godot_v4.2.1-stable_mono_win64.zip 57.3 mb file in my download folder.
Note: only 57223 KB for a game engine, that is so cool.
Csharp testing on Windows 11 version 23606 with Dot net 8.0.100 and Godot engine 4.2.1: unzip the godot engine package
Right clic and “extract all”
I found a “ Godot_v4.2.1-stable_mono_win64.exe” and I launch it.
Csharp testing on Windows 11 version 23606 with Dot net 8.0.100 and Godot engine 4.2.1: launch godot engine
Good job! The user interface of the "project manager" is launching.
Now it’s time to create a new project in Godot engine: I hit the “+ new” button…
I need to choose a renderer... Renderer options: “Forward+” or ”mobile” or “Compatibility”, each renderer contains its pros and cons attributes.
I choose "Forward+" because it supports desktop platfoms only, advanced 3D graphics available, can scale to large complex scenes, uses renderingDevice backend. Slower rendering of simple dcenes. The renderer can be changed later, but scenes may need to be adjusted.
By default, the version control metadata is Git.
I hit the “Create & Edit” button and i get this message "unable to initialize Vulkan video driver"…
Csharp testing on Windows 11 version 23606 with Dot net 8.0.100 and Godot engine 4.2.1: updating NVIDIA video driver version 537.99
I go to donwload the new driver on Nvidia website:
NVIDIA RTX / Driver Release 535 | R535 U9 (537.99) | Windows 10 64-bit, Windows 11 | NVIDIA
https://www.nvidia.com/Download/
Before installing the new drivers, i must read the Nvidia software license agreement and clic "agree and continue". Maybe i can call my lawyer if i don't understand some complicated words in english... Remember, it is a non profit project. This is not a commercial use of the product. So i can agree and continue.
I try to create a new project again and...
Csharp testing on Windows 11 version 23606 with Dot net 8.0.100 and Godot engine 4.2.1: ready!
I get the user interface of the godot application engine. The application is ready now. good job!
Csharp testing on Windows 11 version 23606 with Dot net 8.0.100 and Godot engine 4.2.1: preparing the scene.
I see the label: "Create a root node". In the guide of Mina Pêcheux, i read that the node was the basic thing in which we will add objects to create a complete scene. There is three categories of nodes: blue for 2D scene, red node for 3D scene, green node for UI user interface.
I click on the red node to create a 3D Scene. I understand that it is my first object who will contain child objects.
Csharp testing on Windows 11 version 23606 with Dot net 8.0.100 and Godot engine 4.2.1: create child node
So i create a child node by left clicking on the Node3D and +Add Child Node..
I create the child node by calling it "MeshInstance3D". In this new node, i attached a new sphereMesh. I can edit the new sphere object with the inspector. by opening the surface material override, NewStandardMaterial, albedo, i change his color to red.
Now it's time to create a new scene. I push the scene menu/New scene button.
I create the ground, with a MeshInstance3D node, and a PlaneMesh shape.
I add the ball to the scene by dragging it from the FileSystem dock.
A Camera3D and a DirectionalLight3D nodes are needed, so i add them.
I change the FOV value for the camera from 75 to 30.
I add physics, gravity, RigidBody3D, CollisionShape3D and so and so...
Bouncing ball done! That's fun. Thank you Mina :-)
Csharp testing on Windows 11 version 23606 with Dot net 8.0.100 and Godot engine 4.2.1: download and install Visual Studio Code
https://code.visualstudio.com/docs/?dv=win64user
I configure godot editor to use visual studio code in editor/editor settings/general/dot net editor / external editor: visual studio code.
C# script is now opened in Visual Studio Code editor, that's cool.
I add Visual studio code C# dev kit extension.
Enable auto complete : go to VScode settings panel, look for "omnisharp" and enable omnisharp.
Csharp testing on Windows 11 version 23606 with Dot net 8.0.100 and Godot engine 4.2.1: resources
Godot engine uses Gdscript base API, but the C# API is added so that we can use C#. Check out the differences here:
https://docs.godotengine.org/en/4.1/tutorials/scripting/c_sharp/c_sharp_differences.html
Checkout theses resources i read to understand how C# is used in godot:
https://godotengine.org/article/introducing-csharp-godot/
https://godot.community/topic/48/implementing-c-within-the-godot-engine
https://giulianob.svbtle.com/godot-csharp-setup
https://docs.godotengine.org/en/stable/getting_started/step_by_step/scripting_first_script.html
https://docs.godotengine.org/en/stable/tutorials/scripting/c_sharp/c_sharp_basics.html
Csharp testing on Windows 11 version 23606 with Dot net 8.0.100 and Godot engine 4.2.1: hello world
I want to create a simple hello world script with C# to see if it is possible.
Start a new project called ConsultingITHelloWorld
C:/Users/loicb/OneDrive/Documents/ConsultingITHelloWorld
This time i choose the renderer type "mobile":
-Support desktop + mobile platforms.
-Less advanced 3D graphics.
-Less scalable for complex scenes.
-Uses RenderingDevice backend.
-Fast rendering or simple scenes.
Create a root node: Node3D
Attach a new script to this node, i right-click on Node3D in the scene dock and i select "Attach Script". language: C#
I add in the ConsultingITHelloWorld.cs this script:
using Godot;
using System;
public partial class ConsultingITHelloWorld : Node3D
{
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
GD.Print("ConsultingIT: Hello World from C# to Godot :)");
}
In Godot, i hit the "Run project" button (F5)
Building .Net project... And... I get this message in the console:
Godot Engine v4.2.1.stable.mono.official.b09f793f5 - https://godotengine.org
Vulkan API 1.3.242 - Forward Mobile - Using Vulkan Device #0: NVIDIA - Quadro M620
ConsultingIT: Hello World from C# to Godot :)
Done! We can use C# in Godot 4.2.1 on windows 11 version 23606.
Csharp testing on Windows 11 version 23606 with Dot net 8.0.100 and Godot engine 4.2.1: need help ?
Need help to install godot engine on Windows 11 or write C# code? Send an email on loic @consultingit.fr