Release 2022.3.7 · EntelectChallenge/2022-Arctica

How’s it going? Are you winning? We hope so!

Following the general trend of this week, we have just released another patch for the game.
It’s nothing major, but we have fixed two identified bugs, and one that we suspect is there but hasn’t reared its ugly head yet.

A quick summary of the issues:

  • Fixed the duplication of units when removing the OccupyLand and LeaveLand actions after they have been completed. Thanks @kobus-v-schoor for reporting this bug!
  • Fixed the root of the occasional null pointer reference when occupying land (thanks @kobus-v-schoor for identifying the cause)
  • Added some extra validation when adding buildings:
    • ensuring that the building is placed in the bot’s territory
    • ensuring that available nodes can’t be reused accidentally
  • When distributing resource node space, actions that have their units set to zero are removed. Included a log for this.

@kobus-v-schoor Let us know if the fix for the null pointer reference is all good :raised_hands:

Sorry we don’t have any bigger news. I’m sure a lot of you wouldn’t mind another extension :stuck_out_tongue_winking_eye:

With less than a week remaining, it’s probably getting pretty intense! Let us know how you’re feeling in the comments!

Once again, thanks for all the feedback so far! It’s been really helpful (as you can see by the frequency at which we are releasing patches!)

With love, the EC team! :heart:

2 Likes

Thanks for the new release! A change made in 2022.3.6 is currently stopping me from running the engine though, not sure if anyone else is experiencing the same issue?

Looks to me like the if (!bot.Territory.Contains(building.Position)) return; check added in AddBuilding fails when initially setting up the game when adding the base, because the bot doesn’t have any territory registered yet (since it doesn’t have a base yet).

Yeah I think I have the same, my bot isnt starting up and connecting properly to the runner for 2022.3.6 and 2022.3.7 - works with 2022.3.5

just replace that line with
if (!bot.Territory.Contains(building.Position) && building.Type != BuildingType.Base) return;

and it starts up fine

I have a random question, I haven’t tested it yet, When your population starts going down because the resources are finished, does the units stationed at nodes get less or will they magically just live there in a new free country?

What I’ve seen is, once your population starts declining your available units are also decremented by the same amount. Once your population sinks below your currently allocated units your available units just starts going negative :sweat_smile: So while you technically have the units allocated, since your available units are negative you won’t be able to send a unit to leave the nodes so your bot will become stuck, unable to perform any actions.

At least anybody can use this as advantage or as a burden, so the playing field is still even. But negative available will cause food to drop causing a score decrease so guess it should be ok

Yeah, as you mentioned negative units means you cant do anything.

As long as the final score check goes by total units alive we should be fine.

Imagine your units get to a node and before they can apply pressure they need to first burry all the dead units that didn’t get food and was forgotten about

That would be awesome as well…

Army starved on their way to their destination

I ran into two different errors after attempting to claim land with the latest release (2022.3.7, but with a patch to get the runner to start), I’ll see what I can find out about the triggers:

[ERROR] [Core]: Failed to run GameRunLoop with error: Object reference not set to an instance of an object.
[DEBUG] [Core]:    at Engine.Services.TerritoryService.CreateNewLand(BotObject bot, Position position) in /home/runner/work/2022-Arctica/2022-Arctica/game-engine/Engine/Services/TerritoryService.cs:line 138
   at Engine.Services.TerritoryService.<>c__DisplayClass15_0.<AddBuildingTerritory>b__0(Position position) in /home/runner/work/2022-Arctica/2022-Arctica/game-engine/Engine/Services/TerritoryService.cs:line 118
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Engine.Handlers.Actions.BuildActionHandler.ProcessActionComplete(Node node, List`1 playerActions) in /home/runner/work/2022-Arctica/2022-Arctica/game-engine/Engine/Handlers/Actions/BuildActionHandler.cs:line 93
   at Engine.Services.EngineService.SimulateTickForBots(IList`1 bots) in /home/runner/work/2022-Arctica/2022-Arctica/game-engine/Engine/Services/EngineService.cs:line 438
   at Engine.Services.EngineService.ProcessGameTick() in /home/runner/work/2022-Arctica/2022-Arctica/game-engine/Engine/Services/EngineService.cs:line 193
   at Engine.Services.EngineService.GameRunLoop() in /home/runner/work/2022-Arctica/2022-Arctica/game-engine/Engine/Services/EngineService.cs:line 83
   at Engine.Services.SignalRService.<Startup>b__8_1(Task task) in /home/runner/work/2022-Arctica/2022-Arctica/game-engine/Engine/Services/SignalRService.cs:line 122
[ERROR] [Shutdown]: Shutting down due to a critical error
[INFO] [ActionService]: Invalid action received
[ERROR] [Core]: Failed to run GameRunLoop with error: Destination array was not long enough. Check the destination index, length, and the array's lower bounds. (Parameter 'destinationArray')
[DEBUG] [Core]:    at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Domain.Models.BotObject.GetNewActions() in /home/runner/work/2022-Arctica/2022-Arctica/game-engine/Domain/Models/BotObject.cs:line 129
   at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Lookup`2.Create(IEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer)
   at System.Linq.GroupedEnumerable`2.GetEnumerator()
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at Engine.Services.EngineService.DistributeHarvestingActionSlots(IList`1 bots) in /home/runner/work/2022-Arctica/2022-Arctica/game-engine/Engine/Services/EngineService.cs:line 224
   at Engine.Services.EngineService.ProcessGameTick() in /home/runner/work/2022-Arctica/2022-Arctica/game-engine/Engine/Services/EngineService.cs:line 192
   at Engine.Services.EngineService.GameRunLoop() in /home/runner/work/2022-Arctica/2022-Arctica/game-engine/Engine/Services/EngineService.cs:line 83
   at Engine.Services.SignalRService.<Startup>b__8_1(Task task) in /home/runner/work/2022-Arctica/2022-Arctica/game-engine/Engine/Services/SignalRService.cs:line 122
[ERROR] [Shutdown]: Shutting down due to a critical error

Failed to run GameRunLoop with error: Destination array was not long enough....

I think this is a race condition, PendingActions (the variable on which ToList() is being called and which throws the error), is locked in GetNewActions, but in AddAction in the Bot object where it is modified it is not being locked, so it could lead to a race condition where a new action is being added (I’m guessing async) while the PendingActions list is being copied, leading to the copy failing.

Unfortunately since it’s (possibly) a race condition the error is hard to reproduce and I can’t confirm whether that is indeed the case

@kobus-v-schoor Which lines of code in the TerritoryService are breaking? Your patch has moved things up so I’m not sure what’s breaking.

@kobus-v-schoor
Yeah, this is what I was thinking as well. I’m pretty sure it’s only the PendingActions variable that has this issue, not the Actions one, but I’ve added locks onto the main areas where both of them get accessed to make sure.

If it is a race condition, then it’s been around for a while and has probably come up before but gone mostly unnoticed.

1 Like

Sorry forgot about my patch moving things round a bit, everything was moved 2 lines down so the Territory Service error was thrown here: https://github.com/EntelectChallenge/2022-Arctica/blob/da519fb7ba4888fbe9b58f7f83746f6622697b5a/game-engine/Engine/Services/TerritoryService.cs#L136

How on earth does return land; cause a null pointer ?? I am very confused :joy:

I think it’s the same as that other bug where the return was “triggering” the exception, but the issue was actually a few lines up - I think dotnet is doing some weird optimization, which causes the null ptr exception only to trigger when the function returns. I think containedNode might be null again (similar to the bug where I was attempting to claim a scout tower position IIRC). I haven’t been able to trigger it again unfortunately, once I get it to trigger consistently I’ll try to do some debugging

Does this happen every time you claim land @kobus-v-schoor ? Just double checking.

No not every time, I’ve been able to play full matches (with building + claiming) without running into the error so it’s probably some corner case.

1 Like

I got the same exception ( Failed to run GameRunLoop with error: Object reference not set to an instance of an object.) in 2022.3.5 when adding a building. First three lines of the stack trace basically identical @Jordan