HOME

GOBLIN SCHOOL

a valley of goblins who can only hear each other up close

a work in progress co-op game in godot 4. you and a few friends are goblins in a valley ringed by mountains, and the only way to get anything done is to talk, except you can only talk to whoever is standing near you. it runs on a small private server you start for your friends, and people can drop in and out without ending the game

Figure 1 - a flight over the valley, recorded from the game

✦ 8

goblins per private server, dropping in and out while the world keeps running

✦ 240 m

of valley ringed by mountains, built from a fixed seed so every player generates the same one

✦ 25 / 80 m

how far talking carries, and how far a shout carries if you keep it to two words

WHAT IS THIS?

it started as goblin school, a little test yard where i built the goblin, its interactions and the networking: a cannon you climb into and get fired out of, spears, a trampoline, a campfire. the valley is where those goblins live now. it's built around one idea, that a co-op game gets interesting when talking is a skill: the world is big, voices don't carry, and the puzzles are made of information that only one of you can see at a time

you only hear goblins near you

there's no global chat. what you type shows up over your goblin's head and in the chat of anyone within 25 meters. start a message with ! and it's a shout that carries 80 meters and tells everyone which way it came from, but a shout only fits two words. Q is a wordless yell for finding each other and F plants a flare beam anyone can see across the valley

a yellow goblin standing in front of a wooden palisade and four stone dials that all read MOSS, with WHAT WORDS?! floating over its head and a pink flare beam on a far hill
Figure 2 - the rune gate, and someone who doesn't know the words

a lock you can't open alone

the old hoard is walled in behind four stone dials. the four words that open it are carved on a tall stone up on the north hill, and you can only read them from a few steps away. so somebody climbs the hill, reads them, and shouts them back down two at a time while somebody else turns the stones. the words change every session

a dark stone pillar on a grassy hill with the words GRUB FANG MUD MOSS carved on two faces, the valley with the walled hoard and the village behind it
Figure 3 - the totem on the north hill

your own private server

one command starts a headless server that loads the valley and waits. friends join with its address and the password, and anyone who doesn't send the right password in five seconds gets dropped. the server has no goblin of its own, so the world stays up while people come and go. you can still host from the title screen and play on the same machine like before

# start a private server on any box with an open udp port
godot --headless --path . -- --server --port=10567 --password=SECRET
the whole valley from high above: snowy mountain rim, swamps, pine forest, the village in the middle and the walled hoard to the right

Figure 4 - the valley from the mountains

HOW IT'S BUILT

godot 4 and gdscript, with godot's high level multiplayer over enet. every player's machine builds the same valley from the same seed, so the only things sent over the network are the goblins, what they say and the state of the gate

nothing is sent before your world exists

joining a world that's already running is where this kind of game usually breaks: the server sends the other goblins before the newcomer has a level to put them in. the server keeps a list of who has finished loading and every synchronizer is filtered on it. the catch, found by reading godot's replication source, is that spawns ignore filters on synchronizers a client owns, so each goblin carries a tiny server-owned synchronizer just to gate its own spawn

# level.gd
var _in_world_filter := func(id: int) -> bool: return NetworkManager.is_in_world(id)

for sync in find_children("*", "MultiplayerSynchronizer", true, false):
    _gate_sync(sync)

# player.gd
func _enter_tree() -> void:
    set_multiplayer_authority(name.to_int())
    # SpawnGate is server-owned on purpose: Godot only honors spawn visibility
    # filters on synchronizers the spawner's owner controls (level.gd).
    $SpawnGate.set_multiplayer_authority(1)

every machine decides what it heard

a message goes to everyone, and each player's machine checks how far it is from the speaker before it shows up in their chat. the speaking goblin owns the call, so nobody can talk for someone else, and the text is trimmed on the way in

# player.gd
# A message starting with "!" is shouted: it carries YELL_RADIUS instead of
# HEAR_RADIUS, but a shout only fits MAX_SHOUT_WORDS words.
@rpc("authority", "call_local", "reliable")
func say(text: String) -> void:
    text = text.strip_edges().left(MAX_CHAT_LENGTH)
    var shouting := text.begins_with("!")
    ...
    var me := _local_player()
    if me and me.global_position.distance_to(global_position) <= radius:
        if shouting and me != self:
            text += "  (from the %s)" % compass_direction(me.global_position, global_position)
        UiSignalBus.chat_message.emit(display_name(), text, COLORS[color_index])

TESTED HOW

a script boots a headless server and four headless clients. two join together, one drops in late, one has the wrong password. each prints the goblins it sees, where they are, the gate's dials and the chat it heard. a second script runs the same check on the old host-from-the-title-screen flow, and a third fires a few hundred rays at the terrain to check the ground the props sit on is the ground you walk on

THE MODELS

the goblin came over from goblin school, rigged and animated through mixamo. the terrain, swamp, gate stones and totem are generated in code. the trees, huts and props are free CC0 models, which don't require credit, but here it is

  • Kenney - pine trees, rocks, mushrooms, the tent and the logs, from the Nature Kit
  • Quaternius - the huts, the watch tower and the palisade walls, from Ultimate Fantasy RTS

BUILT WITH:

godot 4gdscriptenetkenney + quaternius CC0 models

NOT DONE YET

  • voice. talking is text for now. proximity voice through steam is the plan once the steam transport is switched on
  • the spears from the old test level have no network sync yet, so every player sees their own copies wherever their physics left them
  • the village interactables (cannon, campfire, trampoline, sign) came over from the old test level and don't send their state to players who join late
  • the valley is one puzzle and a village. the rest is room to fill