Volleyball Script Rules, Stamina & AI

4 min read

View Volleyball Script in the WXMAPS store

Rules, Stamina & AI

Formats

1v1, 2v2 and 3v3. The format is a property of the court, not of the server: you choose players-per-side when you build it, and it is stored with that court. One server can have a 1v1 court on the pier and a 3v3 court on the beach.

"Only one AI showed up" is almost always a 1v1 court. The seat count comes from the court you are standing on, not from the AI. /vbsolo prints the format it resolved (3v3, 5 AI) so you can tell at a glance. To change it for good, re-open the court in /volleyballcreator and change Players per side.

Config.Rules.teamSizes decides which of the three formats your server offers at all.

Scoring

Rally scoring: every rally is a point, whoever served it.

SettingDefaultMeaning
pointsToWin15Points to win a set
winBy2Must win by this margin…
cap21…but never past this. 0 removes the cap
sets1Sets to win the match (best-of = sets × 2 - 1)
serveSeconds15Time the server has to put the ball in play

The referee desk's Rules card reads these live from the config, so what a player is shown and what the server enforces cannot disagree.

Touches

maxTouches = 3 is real volleyball: three touches per side before it must cross, and the same player may never take two in a row. That single rule is what produces receive, set, attack instead of one player keeping it up alone.

Set maxTouches = 0 for arcade rules: unlimited touches, no sequence restriction.

Stamina

With stamina = true (the default) there is a bar, and it is an economy rather than a punishment:

  • Lunges and sprinting drain it, and it regenerates between rallies.
  • A lunge you cannot pay for degrades instead of failing, a dig you are too tired for becomes a bump. The prompt tells you before you commit.
  • It prices the serve without ever blocking one. See Serving.
  • Drinks bend it. The three cans from the cool box change regeneration, sprint drain, lunge cost, move speed and serve cost for a set number of seconds. See Beach circle & drinks.

Turn the whole thing off with stamina = false, or keep the bar and free the serve with serveStamina = false.

The AI

Empty seats fill with NPCs on both halves: team-mates beside you as well as opponents, so a 3v3 court plays 3v3 with one human on it. fillWithAI = false makes matches strict PvP, which on a 3v3 court means waiting for six real players.

What the AI actually does:

  • It plays the sport. A side that receives passes to its setter, who sets to an attacker at the net, who hits it across. Nothing scripts those three names: the AI only decides where to deliver the ball, and the same rule you play by decides what that ball becomes when it arrives.
  • It plays your shot vocabulary: spike near the net above the tape, set in the setter's zone, bump from the back, asked of its own position exactly as it is asked of yours.
  • A beaten defender still plays it. When it loses the roll it reaches for the ball and misses, instead of standing and watching it land.
  • It never touches the ball twice in a row, same as you.
  • It never steals your ball. When a ball is yours, nobody on your side plays it, and you can always steal a team-mate's by getting there first.
  • Serving goes to a human whenever that side has one, so the serve minigame is never taken away from you by your own team.
  • It degrades instead of stalling. When it cannot place a delivery, it simply hits the ball across the net and the rally continues.

Where each slot stands is a formation written as fractions of the court's own dimensions, so resizing a court repositions everybody with no configuration change.

The end of a match

The result screen shows the final score, sets taken and rallies won, and offers a rematch.

  • Everyone has to accept, and nobody is charged for one: the score simply starts again.
  • It is a ceiling, not a wait. Everyone accepting ends it early and starts the next match; anyone declining ends it the other way. The full rematchSeconds window (20 by default) only elapses if somebody walked away from the keyboard.
  • A match against AI gets the result without the button, because there is no lobby to go back to.
  • rematchSeconds = 0 takes the screen out entirely: one toast, then the lobby or free roam.

Who can watch

Anyone within 100 m of a live court sees the match (the ball, the players and the rally) whether they are in it or not. It is not a setting: a court where the ball is invisible to the people standing around it is not a configuration, it is a bug. The two numbers behind it (radius and max) are bounds on something that always happens, not permission for it to happen.