How to Add C# Assemblies to a Godot Engine Project

With the release of version 3.0 of the Godot Engine, C# was added as a supported programming language. Due to other engines like Unity, there is a large number of C# assemblies which can help in developing a game. However, there isn’t an easy way to add assemblies in the editor. Therefore, this tutorial was created to help with that problem.

In this tutorial, we’ll use the Godot Engine, version 3.0, along with the assembly for Rant. Note that while a C# assembly can be added to the editor, the assembly cannot be exported to a self-contained executable just yet.

1. Create project as normal. Where necessary, add a C# script. At first, the engine will generate the necessary C# files (i.e. the “*.csproj” and “*.sln” files).

2. Add in the C# code. After this, close the editor for the moment.

3. Ensure that the correct assembly is in the Godot project working directory.

4. Go into a desirable IDE and open up the “*.csproj” file which was created when the C# script was added. Monodevelop will be used in this tutorial. At this point, ensure that the Godot editor isn’t running. Otherwise, key files may be overwritten.

5. In Monodevelop, right-click on the References node in the tree view for the project and click on Edit References... Be sure to first expand the project so as to reveal References. Then click on the .NET assembly tab and click “Browse…”.

6. Select the desired assembly for the project and then click “Open”.

7. It should then be added as a reference for the project. Click “OK” and save the project (“Ctrl + S” or “File -> Save”). Exit out of the IDE and go back into the Godot editor.

8. Add in a GDscript which makes use of the assembly.

9. If all goes well, the engine should use the assembly in the resulting game.

If you have any comments or questions, please ask them below, or get in touch with me.

Using Rant in my Python program because I’m a glutton for punishment

Over the past few months, I have been researching and developing a little procedurally generated game which will eventually be created in the Godot engine. This game will have a story that’s procedurally generated for the players. A part of this game is the dialogue, which will also be procedurally generated. To accomplish this, I set out to find a library of some kind which can create procedurally generated dialogue (or at least the dialogue that I want) and is written in my programming language of choice, Python. From the looks of it, there isn’t one, and so I had to look elsewhere. That’s when I stumbled upon something called Rant. This is billed as a library which can procedurally generate dialogue. At first I thought I had found what I was searching for. Sadly, though, it is written in  the least open source-friendly language I have ever seen: C#. This can be used on Linux (with the Mono runtime). But I’m looking for a solution where I don’t have to use a bunch of programming languages to achieve what I want.

At first, I tried making some kind of dialogue scheme that would suit my needs. I threw in some sentences of what may define the NPC, and mashed it all together. From the looks of it, though, the scheme is getting out of hand. I have several lines of dialogue, and I’m not even finished. I don’t entirely know how I’ll fit it all together, considering this is just for a simple demo of the full game. It looks like I’m going to have to get creative.

I went digging and searching around I came upon several possible ways of integrating C# code into Python code. There’s IronPython, a fully implemented version of Python in C#. The big problem with this was that it didn’t look very portable to me, as I would have to bundle the .NET libraries with the game for each platform, and that’s a royal pain the ass. Then I looked at Python.NET, which looked very promising: you can call some C# code from Python, and you can call some Python code from C#. It looked like the best of both worlds. Now, actually making it work is a bigger problem.

When I tried to use the Rant.dll assembly in my Python program, I found that I can’t do that because, well, it’s C# code, and the regular old CPython (which comes with many Linux distributions) can only import C or C++ code. Then I looked into using the clr module from Python.NET, but I couldn’t find a version built for Linux. Through a lot of hand wringing, brow beating, and code cracking, I found that I had to use the latest version of Mono (version 5.0.1) along with an unstable version of Python.NET. This one built with the suggested command: python build_ext --inplace. The built shared object library file, “”, and the “clr” module load in Python.  Heck, I was even able to load the pre-built “Rant.dll”. But this is nothing compared what I must do now: actually making some procedurally generated dialogue with Rant. And I don’t know where to begin with that.

Trying My Hand at Making a System for Procedurally Generating Stories

Last year, I got the idea of making a game where a group of friends could get together, have a game scenario generated for them, and they could start playing.  This is something called procedural generation, wherein game settings, mechanics, assets, and other components are created from an alogorthim, and a bit of randomness.  I thought I would just research this, since creating any sort of video game takes a lot of time and skill.  In this case, I was looking into a system for creating stories.

I’ve read a few things about procedurally generating stories (for instance, Tail-Spin and Minstrel) and I stumbled upon one that may be in my reach.  From a paper titled “Random Word Retrieval for Automatic Story Generation” I found out about something called ConceptNet.  This is a commonsense knowledge database for finding the relations between concepts via semantics.  So you can find one concept (like “dog”) and find corresponding concepts for it (such as “animal”).  The paper talks about the intent of making a system for using ConceptNet to find the relations between words (in a process called “Concept Correlation”) and make a story out of it.  Sadly, they haven’t yet implemented the system.  So what I’m trying to do is make something that will, uh, sort of make a story.

In the paper, they talk about how the system requires a Knowledge-Based System.  Unfortunately, this system is quite tedious and difficult to create (or so the paper says).  So I’m just trying to find the connections between words and concepts.  All that I’ve been able to do, though, is mess with the Python interface to the ConceptNet website, and maybe find some related terms.  Finding the connection between two dis-similar terms is difficult, because the concepts have many branching nodes which connect to other nodes.  Finding the right nodes which connect the two concepts would take a while, because the system would have to iterate over the nodes until they find a match.

The examples I’ve been using have been “dog” and “snow”.  So the system would have to go through each node in the “dog” concept until it found a node which connects to “snow”.  It could be any connection from “dog” -> hasA-> “nose”  -> RelatedTo-> “wet” -> PropertyOf -> “snow”.  Please note that these aren’t actual connections in ConceptNet, but something like this can be found in the database.

So I don’t know how I’m going to tackle this monster, let alone make a story out of it.

Made My Own NES Classic Console

It looks like the NES Classic is sold out every where, and there are scalpers on eBay trying to bilk old fans out of their hard-earned coins.  Now, I don’t want to get an NES Classic on account of owning a couple of the featured games, as well as owning them on the Virtual Console.  But since the lack of want doesn’t stop me from tinkering, I made my own.

It’s quite easy to make a tiny device which can emulate and play NES games; it’s already been a reality for a long time.  In my case, I took a Raspberry Pi 3, got the official Raspberry Pi touchscreen, a case to contain these parts, an old SD card with an install of RetroPie on it, and a Classic USB NES controller.  And just for shits and giggles, I also hooked up the whole thing to a 20Ah battery so that I can play it on the go.

Frankenstein’s fun machine

This was a fun little project, but it does have its setbacks.  The Raspberry Pi, along with the other attachments, draws a good amount of current, and so has a problem with voltage (that’s the reason it has two USB connectors).  Also, if you want good sound, you’ll have to use a different sound output; the on-board audio jack is terrible.  Then there’s the price: this little beauty set me back around $200.  So while the NES Classic will set you back $60, at least that’s an official machine, and has a few bells and whistles.  Still, this device is easily configurable, and I can add as many games as I want.  So it not just plays NES games, but also SNES games.

The Nintendo Switch™: Is this the success Nintendo needs?

So Nintendo has shown off their next console: the Nintendo Switch™.
This machine is a touchscreen with detachable controllers called Joy-Cons.  What a user can do is either play it while the device is connected to the TV, or take it out of the dock, and play games on the go.  The device has a number of controller options, including using the Joy-Con controllers, using a Nintendo Switch Pro controller, and just using the touchscreen.  The whole display will  be in full high-definition, and will probably support multi-touch capabilities.  It has been reported that the device has an nVidia Tegra GPU in it, so Nintendo has switched (no pun intended) to a new graphics card maker, and has moved on from ATI/AMD. It also looks as though the device supports cards similar to those used in the 3DS, but I’m sure it has on-board storage, as well. Now I need to ask the question: why should I care about this device?  I already have a PC which can play a number of games quite easily (maybe not the most recent games at the highest settings), as well as a good mobile phone and tablet. So for the most part, I’m not interested. There is a good number of publishers who are saying they will support the Switch. But what will they actually release on the device?  My guess is that, at first, they will release ports for the device (or games that have been remastered). But then what?  Would Bethesda release the next Elder Scrolls game on the Switch? It’s unlikely, considering that they’ll probably release it for the PS4 and Xbone, and of course they’ll have a PC version.  Maybe they’ll make a smaller version, or perhaps they’ll release the mobile version on the Switch.  If that were to happen, though, why would anyone care?  Couldn’t a user just play the mobile version on their phones or tablets?  How would that version be different? Bethesda may release an Elder Scrolls game on the Switch, but it won’t be a version that’ll be found on the other consoles, that’s for certain.

How about other parts of the device?  Will it have specs comparable to the PS4 and the Xbone?  Probably, however those two consoles already have upgraded versions on the way.  It’s true that they won’t be huge improvements over the originals (supposedly, the PS4k will have support for 4k televisions and be capable of running most games at 60FPS.  But that’s it), but they still have
specs that some big developers will like.  How about the development environment for the Nintendo Switch?  Can one easily take their Steam game and port it over to the Switch?  There were a big number of indie developers who really wanted to port their games over to the Wii U.  But the hardware was just too foreign from their familiar hardware to justify a port.  Thankfully, a number of games (such as Axiom Verge) did make it to the Wii U.  But is this enough to keep the new console afloat?

Among other big developers who have pledged support include the old vanguard of Sega, Capcom, and Square-Enix.  These three are laughable, as they have been hemorrhaging money for years.  Sega has lost millions over the past few years (though more recently they have rebound), Capcom has only been kept afloat by Street Fighter, as well as old re-releases of Mega Man and Resident Evil, and Square-Enix has seen marginal return on their mobile phone offerings (don’t even get me started on Final Fantasy).  What are they going to release on the Nintendo Switch?  How are they going to take advantage of the device?  Probably in the same way as the Wii: release only a small number of games, some re-releases, as well as “test” games, and see whether they are a success.  So it’s unlikely we’ll see some big games from these developers (although the remake of Final Fantasy 7 does not seem far-fetched.  Twenty years too late, is what I think).  Other developers include Konami, Activision, and Electronic Arts, but I really doubt they will release anything worthwhile on the Switch.

There are other developers who do look promising.  Platinum Games is making something, and with their track record with Nintendo, they’ll probably make some great content.  Others include From Software, but my guess is that they’ll port over Dark Souls or Bloodborne, so nothing new there.  Another developer on the list is Nippon Ichi, most famous for their Disgaea games.  What they’ll have is anyone’s guess.  Then there’s Epic Games.  That one is a bit of an enigma: why would they develop for the device?  Why would they care?  I have not a clue what they would make for the Nintendo Switch.

All of this information is wonderful, but the public needs to know other things. As I have mentioned, it needs to have specs similar to the competition, so what the final specs will be is unknown.  How will the games be played on it?  Will they all use cards, or will discs be supported?  What are the online capabilities for the Switch?  Since this is Nintendo we’re dealing with, we know it won’t be as good as the competition (probably little voice support, a gimped messaging system, and no online friends group support).  I’m sure the Switch will be region-free (even Iwata talked about this), so that will be a welcomed addition. But all of this will mean nothing if the software and feature support is solid.

We’ve seen the list of developers who are supporting the Switch, but what other features will it have?  In time, those will be revealed.  But is this something that Nintendo is showing that they are different, that they will listen to their fans, and possibly make the games that some of their fans want?  It’s impossible to please all of the fans, but there has been huge criticism for major Nintendo games over the past year.  Star Fox Zero was critically panned and Super Paper Mario: Color Splash was also criticized.  Let’s not forget how different Metroid Prime: Federation Force is from other Metroid games. So how is management going to be different for the Switch?  Will they be more willing to support third party developers (and I’m talking about actually throwing
money at them to develop exclusive content for the Switch, as well as helping them with developing the games)?  Will they make their online system more open to those consumers who just want to freely converse and play with other, different users? Will they allow for the users a little bit of freedom in Miiverse, to show content that may be a bit more grown-up?  Of course, there will still be moderators. It is doubtful, as Nintendo’s management has changed little since Iwata’s passing.

I feel that, if Nintendo really wants to recapture the consumers they lost to the competition, they will have to change some of the leadership at the top.  Even though they got a new president, mostly what has changed was what departments the current management looks over (most of the titles changed to “deputy <title>”, so they have a deputy director of marketing.  I guess they became deputies when they got a new sheriff in town).  It’s true that Nintendo has been getting younger developers into their company, and did try to find a younger president.  But their leadership cannot be made up of people who haven’t not been able to turn around their sales over the past few years. “A problem cannot be solved with the same level of thinking that created it,” as Einstein once said.

Is it too early to say whether this will be a big-selling machine?  Possibly.  But if Nintendo’s track record, their current corporate structure, and the list of developers is anything to go by, it’s doubtful that the Switch will be a best-selling machine five years down the line.