Author Topic: Shared hatches/exits, e.g., for race maps  (Read 179 times)

0 Members and 1 Guest are viewing this topic.

Offline Simon

  • Administrator
  • Posts: 3089
    • View Profile
    • Lix
Shared hatches/exits, e.g., for race maps
« on: February 08, 2021, 05:00:48 AM »
Flopsy in IRC while I was sleeping:

Quote from: Flopsy
I'm planning on making a race map for the first time, how does the entrances and exits work for race maps?

Most race maps have one hatch and one exit, with 0 overtime.
Here, everybody will spawn from that hatch at the same time. The single exit will be shared among everybody. If you save any lix at all, only you score a point, the 0 overtime will trigger, and the exit will immediately close.

General rules below.

An exit can be shared among a subset of the colors. When a lix of a matching color enters, only this color scores a point; no other color will score a point, not even the other colors shown on that exit. When a lix of a non-matching color enters, all the colors of the exit will score a point each.

This way, exits shared among all colors will act as race goals: The winning lix will always be of a matching color, therefore only the winner will get a point. Also, the rule specializes to the common case where each goal shows only one color: No matter what enters, the shown color gets a point per entered lix.

At the start of the game, the engine will ensure that the number of colors is divisible by the number of hatches, or that the number of hatches is divisible by the number of colors. Usually, this is fulfilled because we pick matching maps. If it's not fulfilled, the game will remove hatches from the end of the hatch list until it's fulfilled.

Then the engine will ensure that the number of goals fits the number of players (i.e., again, that either divides the other) and will remove goals from the end of the goal list until it's fulfilled.

If this leaves us with fewer exits than colors, the colors will be allocated to the exits by going around the exit list several times. E.g, we have six colors A, B, C, D, E, F, three hatches h0, h1, h2, and two exits e0, e1. This generates the associations (A, h0, e0), (B, h1, e1), (C, h2, e0), (D, h0, e1), (E, h1, e0), (F, h2, e1). As a result, the exit e0 will be shared among A, C, E. This is completely deterministic; in this example with 6 colors, 3 hatches, and 2 goals, each goal will always be assigned exactly one of the colors from each hatch.

To be ultimately clear, all the mentions of color in the hatch/exit reduction/association algorithm should really be replaced by starting positions. For each game, the server generates a random permutation of the picked colors, so that the fixed starting positions A, C, E may be given to the colors red, green, white in the first game, and then to red, orange, blue in the second game.

-- Simon