Skip to content

Stadium (.hbs) File

Mario Carbajal edited this page Jul 27, 2019 · 11 revisions

HaxBall Stadium File (.hbs)

A HaxBall stadium file is a text file with json5 format which contains a single StadiumObject.

StadiumObject

StadiumObjects are the root object of a stadium file.

name : string

The name of the stadium.

cameraWidth : float

The width of a rectangle centered in coordinates <0,0> in which the camera will be contained. The camera follows the player and ball until it reaches the bounds of this rectanngle.

cameraHeight : float

The height of a rectangle centered in coordinates <0,0> in which the camera will be contained. The camera follows the player and ball until it reaches the bounds of this rectanngle.

maxViewWidth : float

The maximum allowed width viewable width for the level. If the player screen were wide enough for him to see more width than maxViewWidth then the the game will zoom in to prevent that.

Setting maxViewWidth to 0 disables this feature.

Default value: 0

cameraFollow : string

Changes the camera following behaviour.

If set to "player" the camera will follow the player only, ignoring the ball.

If set to "ball" the camera will follow the average position between the player and the ball, the camera will prioritize the player in case player and ball are too far apart.

Default value: "ball"

spawnDistance : float

The distance from <0,0> at which the teams will spawn during kickoff.

canBeStored : Boolean

This value defines whether this stadium can be stored with the /store command.

Default value: true

bg : BackgroundObject

An object describing the background for the stadium.

traits : TraitsObject

A map of traits. See TraitsObject documentation for an explanation of usage.

vertexes : Vertex[]

List of vertexes.

segments : Segment[]

List of segments.

goals : Goal[]

List of goals.

discs : Disc[]

List of discs.

planes : Plane[]

List of planes.

playerPhysics : PlayerPhysics

Object describing the player physics.

If omitted player default player physics will be used.

ballPhysics : Disc

Disc used to create the ball.

If omitted default ball physics will be used.

BackgroundObject

type : string

The type of background to use for the stadium. Possible values are "grass", "hockey", and "none".

Default value: "none"

width : float

Width of the background rectangle.

Default value: 0

height : float

Height of the background rectangle.

Default value : 0

kickOffRadius : float

Radius of the kickoff circle.

Default value: 0

cornerRadius : float

Radius of the corners of the circle (creates rounded corners if > 0)

Default value: 0

goalLine : float

Horizontal distance to the goals from position <0,0>, used by "hockey" background only.

Default value: 0

color : Color

Background color for the stadium.

Default value: "718C5A"

Vertex

A vertex is a point which can collide with discs but cannot move and is not visible.

x : float

The x position for the vertex.

y : float

The y position for the vertex.

bCoef : float

The bouncing coefficient.

cMask : string[]

A list of flags that represent this object's collision mask.

Read more about collision flags here.

cGroup : string[]

A list of flags that represent this object's collision group.

Read more about collision flags here.

Segment

A segment is a line (curved or straight) that connects two vertexes. Discs can collide with segments and they can also be used as decoration.

v0 : int

Index of a vertex in the stadium vertex list to be used as first point of the segment.

v1 : int

Index of a vertex in the stadium vertex list to be used as the second point of the segment.

bCoef : float

The bouncing coefficient.

curve : float

The angle in degrees with which the segment will curve forming an arc between it's two vertexes.

Default value is 0 which makes the segment a straight line.

curveF : float

Alternative representation of the segment's curve. If this value is present the curve value will be ignored.

This value is only useful for exporting stadiums without precision loss, it is recommended to remove curveF and use only curve when editing an exported stadium.

bias : float

If set to 0 the segment will collide normally on both sides.

If greater or lower than 0 the bias determines the thickness of the segment. The segment also becomes a one-way segment that collides only in one of it's sides.

This property can be useful to create boundaries that small and fast moving balls are unable to pass through.

Default value: 0

cMask : string[]

A list of flags that represent this object's collision mask.

Read more about collision flags here.

cGroup : string[]

A list of flags that represent this object's collision group.

Read more about collision flags here.

vis : bool

If set to false the segment will be invisible.

Default value: true

color : Color

The color with which the segment will be drawn.

Default value: "000000" (black)

Goal

Goals are lines belonging to a team, when the ball crosses this line the opossite team scores a goal.

p0 : float[]

The coordinates of the fist point of the line in an array form [x, y].

p1 : float[]

The coordinates of the second point of the line in an array form [x, y].

team : string

The team the goal belongs to. Possible values: "red" or "blue"

Plane

Planes are collision objects that divide the map in two by an infinite line. They are useful for creating the boundaries of the stadium.

normal : float[]

The direction vector of the plane in an array form [x, y].

dist : float

The distance from coordinates [0,0] (in direction of the normal) in which the plane is located at.

bCoef : float

The bouncing coefficient.

cMask : string[]

A list of flags that represent this object's collision mask.

Read more about collision flags here.

cGroup : string[]

A list of flags that represent this object's collision group.

Read more about collision flags here.

Disc

Discs are circular physical objects that are placed in the stadium, they can move and collide with other discs.

pos : float[]

The starting position of the object in array form [x, y].

speed : float[]

The starting speed of the object in array form [x, y].

radius : float

The radius of the disc.

invMass : float

The inverse of the disc's mass.

damping : float

The damping factor of the disc.

color : Color

The disc fill color.

Default value: "FFFFFF"

bCoef : float

The bouncing coefficient.

cMask : string[]

A list of flags that represent this object's collision mask.

Read more about collision flags here.

cGroup : string[]

A list of flags that represent this object's collision group.

Read more about collision flags here.

PlayerPhysics

Player physics describes physical constants affecting the players.

bCoef : float

See Disc.bCoef

invMass : float

See Disc.invMAss

damping : float

See Disc.damping

acceleration : float

How fast a player accelerates when moving around with his keys.

kickingAcceleration : float

Replaces acceleration when the player is holding the kick button.

kickingDamping : float

Replaces damping when the player is holding the kick button.

kickStrength : float

How much force the player applies to the a ball when kicking.

Clone this wiki locally