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
Modify the current state of all players’ balls according to the action (including acceleration, instantaneous state after splitting/spitting)
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
Adjust all balls in each player (rigid body collision + ball-ball fusion)
- For each ball moved in this tick (already sorted by priority):
We will know which balls he collided with (there will be repetitions)
- Category discussion
- One of the balls is the player ball
Another is another player’s ball, the bigger one eats the smaller one
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.
Another is food/spores, player ball eat it
- Another is the thornball
Do not touch the center of the circle, continue
- Hit the center of the circle
- player ball is older than thornball
number of player’s avatar reaches the upper limit, thornball will be eaten
number of player’s avatar doesn’t reache the upper limit, player ball eat thornball and blow up
player ball is younger than thornball, nothing happened
- One of the balls is a thornball
- Another is the player ball
- hit the center of a circle
- player ball is older than thornball
number of player’s avatar reaches the upper limit, thornball will be eaten
number of player’s avatar doesn’t reache the upper limit, player ball eat thornball and blow up
player ball is younger than thornball, nothing happened
Do not touch the center of the circle, continue,
The another is the spore, thornball eat it and add a speed and acceleration
- One of the balls is Spore
Another is the player ball, Spore was eaten
Another is the thorn ball, Spore was eaten
After each tick, check if you want to update food, thorns, and player rebirth