Skip to content

HaxBall Stadium File

Mario Carbajal edited this page Jan 26, 2019 · 5 revisions

This page is not yet complete, it will be finished soon.

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

y : float

bCoef : float

cMask : string[]

cGroup : string[]

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

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[]

cGroup : string[]

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[]

dist : float

bCoef : float

cMask : string[]

cGroup : string[]

Disc

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

pos : float[]

speed : float[]

radius : float

invMass : float

damping : float

color : Color

bCoef : float

cMask : string[]

cGroup : string[]

PlayerPhysics

Player physics describes physical constants affecting the players.

bCoef : float

invMass : float

damping : float

acceleration : float

kickingAcceleration : float

kickingDamping : float

kickStrength : float

You can’t perform that action at this time.