server

Server

class gobigger.server.server.Server(cfg=None, seed=None)[source]
Overview:

Server is responsible for the management of the entire game environment, including the status of all balls in the environment, and the status update after the action is entered The main logic when updating is as follows: 0 tick -> input action -> update the state of the player’s ball -> update the state of all balls after the current state continues for 1 tick

-> detect collision and eating (update status) -> 0 tick end/1 tick start

The details are as follows: 1. Generate all balls (food, thorns, players) 2. Single step

  1. Modify the current state of all players’ balls according to the action (including acceleration, instantaneous state after splitting/spitting)

  2. Continue a tick for the current state of all balls, that is, update the acceleration/velocity/position of each ball after a tick, and at the same time the ball that is in the moving state in this tick

  3. Adjust all balls in each player (rigid body collision + ball-ball fusion)

  4. For each ball moved in this tick (already sorted by priority):
    1. We will know which balls he collided with (there will be repetitions)

    2. Category discussion
      1. One of the balls is the player ball
        1. Another is another player’s ball, the bigger one eats the smaller one

        2. The other side is your own clone, in fact, you don’t need to deal with it if you have already dealt with it before.

        3. Another is food/spores, player ball eat it

        4. Another is the thornball
          1. Do not touch the center of the circle, continue

          2. Hit the center of the circle
            1. player ball is older than thornball
              1. number of player’s avatar reaches the upper limit, thornball will be eaten

              2. number of player’s avatar doesn’t reache the upper limit, player ball eat thornball and blow up

            2. player ball is younger than thornball, nothing happened

      2. One of the balls is a thornball
        1. Another is the player ball
          1. hit the center of a circle
            1. player ball is older than thornball
              1. number of player’s avatar reaches the upper limit, thornball will be eaten

              2. number of player’s avatar doesn’t reache the upper limit, player ball eat thornball and blow up

            2. player ball is younger than thornball, nothing happened

          2. Do not touch the center of the circle, continue,

        2. The another is the spore, thornball eat it and add a speed and acceleration

      3. One of the balls is Spore
        1. Another is the player ball, Spore was eaten

        2. Another is the thorn ball, Spore was eaten

  1. After each tick, check if you want to update food, thorns, and player rebirth

spawn_balls()[source]
Overview:

Initialize all balls. If self.custom_init is set, initialize all balls based on it.