-
Notifications
You must be signed in to change notification settings - Fork 43
Stadium (.hbs) File
A HaxBall stadium file is a text file with json5 format which contains a single StadiumObject.
StadiumObjects are the root object of a stadium file.
The name of the stadium.
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.
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.
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
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"
The distance from <0,0> at which the teams will spawn during kickoff. This value is ignored if redSpawnPoints
or blueSpawnPoints
are not empty.
This value defines whether this stadium can be stored with the /store command.
Default value: true
Can be set to either "full"
or "partial"
.
When set to "partial"
only the ball and player discs are reset for the kickoff.
When set to "full"
all discs will be reset for the kickoff.
Default value: "partial"
An object describing the background for the stadium.
A map of named traits. TraitValues is an object that will define the default values of any object that references that trait with it's "trait" property.
This is useful when manually writing a stadium file to avoid repeating yourself.
The traits applied while loading the stadium and are not preserved internally, it does not make the stadium data smaller over the network for example.
Example:
"traits" : {
"ballArea" : { "vis" : false, "bCoef" : 1, "cMask" : ["ball"] },
"goalPost" : { "radius" : 8, "invMass" : 0, "bCoef" : 0.5 },
"goalNet" : { "vis" : true, "bCoef" : 0.1, "cMask" : ["ball"] },
"kickOffBarrier" : { "vis" : false, "bCoef" : 0.1, "cGroup" : ["redKO", "blueKO"], "cMask" : ["red", "blue"] },
}
It can then be referenced by other objects by using the "trait" property.
"segments" : [
{ "v0" : 0, "v1" : 1, "trait" : "ballArea" },
{ "v0" : 2, "v1" : 3, "trait" : "ballArea" },
{ "v0" : 4, "v1" : 5, "trait" : "ballArea" },
{ "v0" : 6, "v1" : 7, "trait" : "ballArea" },
// ...
]
List of vertexes.
List of segments.
List of goals.
List of discs.
List of planes.
List of joints.
List of spawn points used for the red team kickoff.
If the list is empty then the default spawn behaviour is employed.
When a player is moved into a team after a game has started he will be positioned in the last point in this list. (Unless the list is empty in which case the old spawn behaviour is employed)
Example: "redSpawnPoints" : [[100, 0], [100, 30], [100, -30], [100, 60], [100, -60], [130,0]]
Default value: []
Same as redSpawnPoints
but for the blue team.
Object describing the player physics.
If omitted player default player physics will be used.
The Disc used to create the ball. The collision flags "kick" and "score" will be automatically added.
Setting ballPhysics to the string "disc0" will instead use the first disc as the ball. In this case the cGroup will be left unmodified.
If omitted default ball physics will be used.
The type of background to use for the stadium. Possible values are "grass", "hockey", and "none".
Default value: "none"
Width of the background rectangle.
Default value: 0
Height of the background rectangle.
Default value : 0
Radius of the kickoff circle.
Default value: 0
Radius of the corners of the circle (creates rounded corners if > 0)
Default value: 0
Horizontal distance to the goals from position <0,0>, used by "hockey" background only.
Default value: 0
Background color for the stadium.
Default value: "718C5A"
A vertex is a point which can collide with discs but cannot move and is not visible.
The x position for the vertex.
The y position for the vertex.
The bouncing coefficient.
A list of flags that represent this object's collision mask.
Read more about collision flags here.
A list of flags that represent this object's collision group.
Read more about collision flags here.
A trait to use as default values for this object. See StadiumObject
traits
property for more info.
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.
Index of a vertex in the stadium vertex list to be used as first point of the segment.
Index of a vertex in the stadium vertex list to be used as the second point of the segment.
The bouncing coefficient.
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.
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.
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
A list of flags that represent this object's collision mask.
Read more about collision flags here.
A list of flags that represent this object's collision group.
Read more about collision flags here.
If set to false the segment will be invisible.
Default value: true
The color with which the segment will be drawn.
Default value: "000000" (black)
A trait to use as default values for this object. See StadiumObject
traits
property for more info.
Goals are lines belonging to a team, when the ball crosses this line the opossite team scores a goal.
The coordinates of the fist point of the line in an array form [x, y].
The coordinates of the second point of the line in an array form [x, y].
The team the goal belongs to. Possible values: "red" or "blue"
A trait to use as default values for this object. See StadiumObject
traits
property for more info.
Planes are collision objects that divide the map in two by an infinite line. They are useful for creating the boundaries of the stadium.
The direction vector of the plane in an array form [x, y].
The distance from coordinates [0,0] (in direction of the normal) in which the plane is located at.
The bouncing coefficient.
A list of flags that represent this object's collision mask.
Read more about collision flags here.
A list of flags that represent this object's collision group.
Read more about collision flags here.
A trait to use as default values for this object. See StadiumObject
traits
property for more info.
Discs are circular physical objects that are placed in the stadium, they can move and collide with other discs.
The starting position of the object in array form [x, y].
The starting speed of the object in array form [x, y].
The gravity vector of the object in array form [x, y].
The radius of the disc.
The inverse of the disc's mass.
The damping factor of the disc.
The disc fill color. Supports "transparent" color.
Default value: "FFFFFF"
The bouncing coefficient.
A list of flags that represent this object's collision mask.
Read more about collision flags here.
A list of flags that represent this object's collision group.
Read more about collision flags here.
A trait to use as default values for this object. See StadiumObject
traits
property for more info.
PlayerPhysics describes physical constants affecting the players.
See Disc.gravity
See Disc.radius
See Disc.invMAss
See Disc.bCoef
See Disc.damping
See Disc.cGroup
How fast a player accelerates when moving around with his keys.
Replaces acceleration when the player is holding the kick button.
Replaces damping when the player is holding the kick button.
How much force the player applies to the a ball when kicking.
Much like kickStrength but it's applied to the kicking player instead.
Joints are physical connections between two Discs.
Index of one of the two discs connected by the joint.
Note: Index 0 will be used by the ball disc if StadiumObject.ballPhysics
is not set to "disc0"
.
Index of one of the two discs connected by the joint.
Note: Index 0 will be used by the ball disc if StadiumObject.ballPhysics
is not set to "disc0"
.
If set to null then the length will be automatically computed to match the distance between the two discs connected by the joint.
If set to a float value then the join will use that as length.
If set to a 2 elements array [min, max] then the joint will have a min length and max length. The joint will apply no forces if the distance between the discs is inside of that range.
Default value: null
If set to "rigid"
then the joint acts like a solid.
If set to a float value then the joint will act like a spring.
Default value: "rigid"
The color of the joint. Supports "transparent" color.
Default value: "000000"
(black)
A trait to use as default values for this object. See StadiumObject
traits
property for more info.
A color can be either "transparent"
, a string with hex values "RRGGBB"
or an array of integer values [Red,Green,Blue]
.
Examples:
"color": "transparent" // Make color invisible / transparent
"color": "FF0000" // Make color red
"color": [0,200,0] // Make color green.