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.
- Copy
addons/gs_player_class/,addons/gs_player/andaddons/gs_core/into your project. - Enable all three in Project > Project Settings > Plugins.
Needs Godot 4.7 or newer.
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 spawnA class names its loadout, model, animation set and abilities; it does not contain them. A client resolves the ids to content through a catalogue.
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.
| 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.
These games vendor it:
- Fatal Contact
- Airdrift
- Playlot
- Hungario
- Buses From Hell
- Smash Copter
- Zombie Zone
- Hide n Seek
- Prop Hunt
- Murder Mystery
- Deathrun
- Dangerous Delivery
- Look At Me
The whole collection is at zeesgames.com.
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.
