Out of bounds map creation?

{
  "GameSettings": {
    "NumberOfPlayers": 1,
    "TickTimer": 150,
    "MaxTicks": 10000,
    "Collectables": [
      20,
      60,
      90,
      100
    ],
    "Levels": [
      {
        "Width": 100,
        "Height": 100,
        "Seed": 123
      },
      {
        "Width": 100,
        "Height": 100,
        "Seed": 449485603
      },
      {
        "Width": 100,
        "Height": 100,
        "Seed": 964753
      },
      {
        "Width": 100,
        "Height": 100,
        "Seed": 12345645
      }
    ]
  }
}

For the above game settings, I am getting an error when I try run the game. It fails whilst initialising. With additional logging, I got the following:

Exception type: System.IndexOutOfRangeException
Exception message: Index was outside the bounds of the array.
Stack trace:    at Domain.Objects.WorldObject.GenerateObjectsOnPath(Int32 level) in /app/Domain/Objects/WorldObject.cs:line 381

When I looked at the code I saw that we are adding 2 to one of the dimensions. 2023-Cy-Fi/2023-CyFi/Domain/Objects/WorldObject.cs at dd943970178bb87fb6b64c72f9391b28cc17de5c · EntelectChallenge/2023-Cy-Fi · GitHub

Is this intentional, considering the logic of the if statement just above that line 2023-Cy-Fi/2023-CyFi/Domain/Objects/WorldObject.cs at dd943970178bb87fb6b64c72f9391b28cc17de5c · EntelectChallenge/2023-Cy-Fi · GitHub

Not sure if this has been addressed elsewhere but the bug might occur during the tournament as well unless I did something wrong on my end?

Hi @jiro90 , the reason there are two is one is for generating hazards, and one is for collectibles.
Does this happen often ? Or was it a onetime thing?

@Laaiqah_Seedat I’ve seen it twice but it does not happen often. Depends on the seed mainly.
I’d probably just advice checking that the index is less than the width i.e to change the condition from

if (
    map[paths[i].Item1][paths[i].Item2] != (int)ObjectType.Ladder
     )

to

if (
      map[paths[i].Item1][paths[i].Item2] != (int)ObjectType.Ladder && paths[i].Item2 + 2 < width
       )

Edit: I see this was addressed in the latest release. Thanks.

Hi @jiro90, just to clarify, this was done to offset the collectable from the platform so it “floats” in the air. But the latest check will now check for that