Game engine crash in DiffLog

Hi,

I get a crash almost every time i run a match, the engine logs an error like the following:

2024-04-27T12:58:08.4453810+02:00 Error - Game failed with exception: Object reference not set to an instance of an object.

I’ve tracked it down lines 162-166 of Sproutopia\Models\GameState.cs:

            foreach (var bot in botIds)
            {
                GardenManager.GetGardenCellsById(bot.Value).ToList().ForEach(c => territory[c] = bot.Key);
                GardenManager.GetTrailCellsById(bot.Value).ToList().ForEach(c => trails[c] = bot.Key);
            }

Adding debug prints in between those lines seems to make it go away, so it is probably timing related.

That function (“MapToDiffLog”) seems to only be used for logging, so I’ve just commented it out while I work on my bot.

Oof, that’s no bueno! Thanks for letting us know. Could you provide a little more info as to how you are running the Game engine, and how many and which bots you are connecting to it?

Hi,

Had not seen this for a while, so was beginning to wonder if it was finger trouble on my side, but with the latest version of my bot I can reproduce it pretty reliably at around tick 438.

I think it might have something to do with the fact that prunes often happen at that point, if I spin up 4 instances of my bot.

I’m running the engine and my bots natively (i.e. not with docker), i simply go dotnet run projectName.csproj. I’ve decreased the tick time to 125ms, this might only be happening because of that. But I guess we want to fix any issues like these even if generous tick times hide them.

I suspect most bots will show this (since my current one has changed quite a bit), but I can send you my current one. Is there an email address I can send it to?

1 Like

Thanks @japes , I’ve sent you a DM.

I have the same problem

The newer engine crashes under the below conditions

“2024-05-10T12:57:45.8984180+02:00 Error - Game failed with exception: Object reference not set to an instance of an object.”

So I replicated the behaviour somewhat:

Heres the first phase of the crash I am getting:

Blue Player is about to hit Yellow Player,
They do, and that happens perfectly fine…

Then a few rounds later we are on the following state:

The first error thats evident is you will see that 10 or so ticks in, The yellow player never got their home territory back.

And then the second the blue player connects to the claimed land, The engine crashes:

The map seemed to update correctly, IE: I did get the lands for completion,
But sometime after getting the land reward, The engine crashes,

I had a similar error happen without actually connecting the two territories,

Here is another case:

In this case player 1: (Maroon) Trimmed the red player, I got the lands,
And the second Maroon Player completed their trail, the game crashed,

So it seems to happen under those circumstances,

One Player trims another player,
The moment they then complete their trial, the game crashes.

It could also have to do with the fact that the other player never gets back their home base.
Uncertain

I’v encountered this too.

The problem goes away if the trimmed player manages to claim any land at all before the ‘trimmer’ completes their path.