field

package
v2.0.0-alpha.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2020 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BaseUnit is used to increase the integer units scale and improve the precision when the integer numbers
	// come from float  calculations. Some units have to be integer to avoid infinite intervals (e.g. a point in the field)
	BaseUnit = 100

	// PlayerSize is the size of each player
	PlayerSize = 4 * BaseUnit

	// PlayerReconnectionWaitTime is a penalty time imposed to the player that needs to reconnect during the match.
	// this interval ensure players won't drop connection in purpose to be reallocated to their initial position.
	PlayerReconnectionWaitTime = 20 * time.Second

	// max number of players in a team by mach
	MaxPlayers = 11

	// min number of players in a team by mach, if a team gets to have less to this number, the team loses by W.O.
	MinPlayers = 6

	// PlayerMaxSpeed is the max speed that a play may move  by frame
	PlayerMaxSpeed = 100.0

	// FieldWidth is the width of the field (horizontal view)
	FieldWidth = 200 * BaseUnit

	// FieldHeight is the height of the field (horizontal view)
	FieldHeight = 100 * BaseUnit

	// FieldNeutralCenter is the radius of the neutral circle on the center of the field
	FieldNeutralCenter = 100

	// BallSize size of the element ball
	BallSize = 2 * BaseUnit

	// BallDeceleration is the deceleration rate of the ball speed  by frame
	BallDeceleration = 10.0

	// BallMaxSpeed is the max speed of the ball by frame
	BallMaxSpeed = 4.0 * BaseUnit

	// BallMinSpeed is the minimal speed of the ball  by frame. When the ball was at this speed or slower, it will be considered stopped.
	BallMinSpeed = 2

	// BallTimeInGoalZone is the max number of turns that the ball may be in a goal zone. After that, the ball will be auto kicked
	// towards the center of the field.
	BallTimeInGoalZone = 40 // 40 / 20 fps = 2 seconds

	// GoalWidth is the goal width
	GoalWidth = 30 * BaseUnit

	// GoalMinY is the coordinate Y of the lower pole of the goals
	GoalMinY = (FieldHeight - GoalWidth) / 2

	// GoalMaxY is the coordinate Y of the upper pole of the goals
	GoalMaxY = GoalMinY + GoalWidth

	// GoalZoneRange is the minimal distance that a player can stay from the opponent goal
	GoalZoneRange = 14 * BaseUnit

	// GoalKeeperJumpDuration is the number of turns that the jump takes. A jump cannot be interrupted after has been requested
	GoalKeeperJumpDuration = 3

	// GoalKeeperJumpSpeed is the max speed of the goalkeeper during the jump
	GoalKeeperJumpSpeed = 2 * PlayerMaxSpeed

	// GoalkeeperNumber defines the goalkeeper number
	GoalkeeperNumber = uint32(1)
)

Variables

This section is empty.

Functions

func FieldCenter

func FieldCenter() proto.Point

FieldCenter works as a constant value to help to retrieve a Point struct with the values of the center of the court

func GetOpponentSide

func GetOpponentSide(side proto.Team_Side) proto.Team_Side

func GetPlayer

func GetPlayer(s *proto.GameSnapshot, side proto.Team_Side, number uint32) *proto.Player

func GetTeam

func GetTeam(s *proto.GameSnapshot, side proto.Team_Side) *proto.Team

func IsBallHolder

func IsBallHolder(s *proto.GameSnapshot, player *proto.Player) bool

func MakeOrderCatch

func MakeOrderCatch() *proto.Order_Catch

func MakeOrderJump

func MakeOrderJump(origin, target proto.Point, speed float64) (*proto.Order_Jump, error)

func MakeOrderKick

func MakeOrderKick(ball proto.Ball, target proto.Point, speed float64) (*proto.Order_Kick, error)

func MakeOrderMove

func MakeOrderMove(origin, target proto.Point, speed float64) (*proto.Order_Move, error)

func MakeOrderMoveMaxSpeed

func MakeOrderMoveMaxSpeed(origin, target proto.Point) (*proto.Order_Move, error)

Types

type Goal

type Goal struct {
	// Center the is coordinate of the center of the goal
	Center proto.Point
	// Place identifies the team of this goal (the team that should defend this goal)
	Place proto.Team_Side
	// TopPole is the coordinates of the pole with a higher Y coordinate
	TopPole proto.Point
	// BottomPole is the coordinates of the pole  with a lower Y coordinate
	BottomPole proto.Point
}

Goal is a set of value about a goal from a team

func AwayTeamGoal

func AwayTeamGoal() Goal

AwayTeamGoal works as a constant value to help to retrieve a Goal struct with the values of the Away team goal

func GetOpponentGoal

func GetOpponentGoal(mySide proto.Team_Side) Goal

func GetTeamsGoal

func GetTeamsGoal(side proto.Team_Side) Goal

Returns the goal struct to the team side passed as argument

func HomeTeamGoal

func HomeTeamGoal() Goal

HomeTeamGoal works as a constant value to help to retrieve a Goal struct with the values of the Home team goal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL