Non interpreted language support (GOLANG)

Hello there,

A little background:
I’m developing on linux and have been able to run the precompiled release of the game engine successfully (along with 2 C# bots)

What I’m asking:
I’d like to build a Golang bot sample but it seems the game engine only supports csharp (CIL) based executables… (I am able to cross compile to a native windows target from linux + Go.)

In the code I see the following in the BotHarness:

           switch (meta.BotType)
        {
            case BotMeta.BotTypes.CSharp:
            case BotMeta.BotTypes.CPlusPlus:
            case BotMeta.BotTypes.FSharp:
                _botRunner = new DotNetRunner(this);
                break;
  ... etc

which in turn calls DotNetRunner which just tacks “mono” in front of the exe file:

   private string ConvertProcessName(string processName)
    {
        return Environment.OSVersion.Platform == PlatformID.Unix ? "mono" : processName;
    }

Which is fine for C# and F# cases but when I want something that doesnt build the Common Intermediate Language stuff of C# I get:

Cannot open assembly ‘gobot.exe’: File does not contain a valid CIL image.

Would you be against me adding another Runner for purely compiled (ie “no vm in the middle”) languages? I’m not sure how DotNet stuff compiles(or works even) but it seems like the exe might perhaps be thin wrapper around something that’s still being interpreted ?

Forgive me if I’m missing something here. C# not really my strong suit.

I appreciate the input. Or any better solution you may prefer. (I can show you a gist with the Gobot if you should be interested) This would probably also help those who want to build Rust, C++ or C targets. I’m not sure the DotNetRunner will work for those building gnu gcc code.

All the best,
Stephan

PS
here is how I compile the go stuff for windows:

GOOS=windows GOARCH=amd64 go build -o /home/stephan/source/entelect-2017/dls/Version\ 1.0.0/refbots/go/gobot.exe main.go

Here is my bot.json file:

{
"Author":"John Doe2",
"Email":"john.doe2@example.com",
"NickName" :"Goon",
"BotType": 0,
"ProjectLocation" : "",
"RunFile" : "gobot.exe"
}

Hi svanellewee,

We would like community contributions for additional languages and sample bots. If you feel up to it and want us to support your language please submit a pull request with the required game engine modifications and your sample bot. More details about the sample bot pull request can be found here.

Please also remember to include a read me on installation and set up instructions for your language and package manager so that we can make sure it is running correctly on the tournament servers.

Great! I managed to make a PR https://github.com/EntelectChallenge/2017-Battleships/pull/19

I also notice that there is unused compilation code in the GE. DotNetCompiler for example. Is the intention for the Game engine to build the bot before execution?

Also is someone going to test the go setup code to ensure that it works on your end? Is there some CI type setup we could consult to confirm things are on the up’n’up?

Hi Svanellewee,

Answer to your first question:

I will confirm on this, but the bot is started up before each round starts, so the game engine will start up the bot, but it requires the bot to be built and compiled before the game starts.

Answer to your second question:

So we require that before the PR is made, that you test the code and make sure it works, we will then test your branch on our side and see if it works with the master branch, if this is successful we will accept the PR.

If there is any confusion please ask.

Thanks Foamy

makes sense. I did test on my side, however since I’m running a Linux system I was just concerned that I am unable to test on a Windows machine.

Thanks for the feedback.
Stephan

Oh also, thanks for checking the Compilation question for me. I’d like to build once and not each time a round starts (which is what the GolangRunner does currently… not optimal)

I imagine the GE will run something like follows:

  • Submit sourcecode to server
  • compile sourcecode based on what the bot.json says it is using the <LANGUAGE>Compiler.cs class specified.
  • run code based on <LANGUAGE>Runner.cs class

At the moment I only have the Runner class, which should work, although not the best solution. Compiling once would mean me adding a GolangCompiler.cs I suspect.

If you can let me know if this is the case I will provide a PR.

Hi svanellewee,

That is correct.

Hello again Foamy

Created a PR https://github.com/EntelectChallenge/2017-Battleships/pull/25 to this effect. One can now supply a --forceRebuild switch to the game engine and it will rebuild your bot in the language of your choice.

So far it works for DotNet and Golang. Because the switch is optional it should not affect base functionality if not used.

Created issue here https://github.com/EntelectChallenge/2017-Battleships/issues/26