Skip to content

About

Godot 4 addon for player classes (health, speed, loadout, abilities) as a small document a dedicated server can check without loading content. Class changes apply on the next spawn so nobody swaps health or weapons mid-fight. Part of the GameSpice addon family.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Player Class - GameSpice addon

Player classes (health, speed, loadout, abilities) as a small document a dedicated server can check without loading any content.

A class change is recorded and applied on the next spawn, so nobody changes health or weapons mid-fight. A dead player gets the change immediately.

Install

  1. Copy addons/gs_player_class/, addons/gs_player/ and addons/gs_core/ into your project.
  2. Enable all three in Project > Project Settings > Plugins.

Needs Godot 4.7 or newer.

Use

var classes := GSPlayerClassManager.new()
classes.catalogue = GSPlayerClassCatalogue.team_shooter()
classes.rules     = GSPlayerClassRules.standard()
classes.team_fn   = func(key): return teams.team_of(key)
classes.alive_fn  = func(key): return roster.get_record(key).alive
add_child(classes)
classes.setup()

var res := classes.request("ada", &"sniper")
if not res.ok:
    hud.say(res.error.message)   # "Your side already has 2 Sniper."

classes.pending_of("ada")        # &"sniper", not active yet
classes.class_of("ada")          # still the old class
classes.apply_pending("ada")     # call on spawn

A class names its loadout, model, animation set and abilities; it does not contain them. A client resolves the ids to content through a catalogue.

Why a request is refused

Every refusal is a GSResult with a message for the player.

Rule Message
limit_per_team "Your side already has 2 Sniper."
teams "Breacher is not available to your side."
requires_entitlement "You do not have Heavy." The check is supplied by your game.
allow_midround_change "Classes are locked once the round has started."

options_for(key) lists every class with available, why, taken and limit, for a class-select screen.

Classes

Class Purpose
GSPlayerClassDef One class: health, armour and absorption, movement multipliers, mass, content ids, abilities, team restrictions, limits, entitlement.
GSPlayerClassCatalogue The set of classes. Presets: single, team_shooter (six classes), asymmetric.
GSPlayerClassRules When a choice may be made and when it lands. Presets: standard, instant, competitive, fixed. Layered like every GSConfig.
GSPlayerClassManager Current and pending class, limits, entitlements, and a mirror for clients.

Use single() for a game without classes, so health and speed come from the same place as in every other mode.

Armour: var hit := def.absorb(50.0, current_armour) returns health_damage and armour_left.

See docs/design.md.

Used by

These games vendor it:

The whole collection is at zeesgames.com.

Status and licence

Part of the GameSpice platform: a family of Godot addons, MIT licensed and built with Claude Code. res://examples/class_selftest.tscn is the headless suite. Classes are exercised in real matches: the games in Zee's Games are built on GameSpice addons and run on live servers. Found a bug? Open an issue.

MIT licence, see LICENSE. The only closed part of the GameSpice platform is the web back end; you can use your own instead of GameSpice's.

About

Godot 4 addon for player classes (health, speed, loadout, abilities) as a small document a dedicated server can check without loading content. Class changes apply on the next spawn so nobody swaps health or weapons mid-fight. Part of the GameSpice addon family.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages