Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/booth-runbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,13 @@ tools/booth/macos/setup.sh --undo --apply
```

`--undo` puts back the settings the first setup recorded on that Mac. Then turn off automatic login and Do Not Disturb, and copy the session logs.

## Four-controller co-op

On the hub or in any of the six games, click the left stick **(L3)** on each DualSense to join. The order sets P1 through P4. A visitor already playing solo with a controller keeps P1 when a second visitor joins. Each player's numbered, colored badge follows their Hoppy. The team shares the score.

- In the platformers, any teammate can collect a pickup, fight the boss or activate MERGE. Trailing players catch up when the leader lands. Reaching the boss rallies fallen teammates.
- In both brawlers, each fighter controls their own combos and weapon. A cleared room's exit gathers the team and brings back fallen fighters with one heart.
- In Endless Runner, players share three lanes in a staggered formation. Each can dodge, collect power-ups and hit hazards. Health, shields and pursuit belong to the team.

If a controller drops, the game holds the team's places. Reconnect it to continue. When several identical pads are missing, use the face button beside **your player number** on the recovery screen. A spare can reclaim a seat the same way. Returning to the hub clears the team for the next visitors. At an unattended booth the idle timer does this automatically, including while a pad is missing.
Binary file added docs/previews/four-player-coop.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion hoppys-adventure-arcade/app/app_router.gd
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func go(route: String, reason := "menu") -> bool:
if session_log:
session_log.route_changed(route, reason)
if route == ATTRACT_ROUTE:
LocalParty.reset()
game_overs = 0
how_to_play_seen.clear()
if wants_how_to_play(route):
Expand Down Expand Up @@ -308,7 +309,7 @@ func _process(delta: float) -> void:
return
idle_seconds = 0.0
var scene := get_tree().current_scene
if scene == null or scene.scene_file_path != ROUTES[ATTRACT_ROUTE]:
if scene == null or scene.scene_file_path != ROUTES[ATTRACT_ROUTE] or LocalParty.size > 0:
go(ATTRACT_ROUTE, "idle")

func smoke_routes() -> void:
Expand Down
64 changes: 64 additions & 0 deletions hoppys-adventure-arcade/app/arcade_team.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
extends Node
## A stage owns its actors. The party owns their seat numbers across stage changes and retries.
var members: Array[CharacterBody2D] = []
var _badges: Array[Label] = []
var _shown_hp: Array[int] = []
var _spawn: Callable
var _badge_height: float


func setup(first: CharacterBody2D, spawn: Callable, badge_height: float) -> void:
members.assign([first])
_badges.clear()
_shown_hp.clear()
_spawn = spawn
_badge_height = badge_height
if not LocalParty.changed.is_connected(sync):
LocalParty.changed.connect(sync)
sync()


func sync() -> void:
if not is_inside_tree() or members.is_empty(): return
while members.size() < LocalParty.size:
var seat := members.size()
var actor: CharacterBody2D = _spawn.call(seat)
actor.seat = seat
actor.reset_physics_interpolation()
members.append(actor)
if LocalParty.size > 0:
for actor in members:
actor.controls.names = LocalParty.bindings(actor.seat)
while _badges.size() < members.size():
var seat := _badges.size()
_badges.append(LocalParty.decorate(members[seat], seat, _badge_height))
_shown_hp.append(-1)
update_health()


func update_health() -> void:
for i in _badges.size():
var hp: int = members[i].hp
if hp == _shown_hp[i]: continue
_shown_hp[i] = hp
_badges[i].text = "P%d %s" % [i + 1, "♥".repeat(hp) if hp > 0 else "OUT"]


func nearest(point: Vector2) -> CharacterBody2D:
var closest := members[0]
var best := INF
for actor in members:
if actor.hp <= 0: continue
var distance := actor.position.distance_squared_to(point)
if distance < best:
best = distance
closest = actor
return closest


func front() -> CharacterBody2D:
var leader := members[0]
for actor in members:
if actor.hp > 0 and (leader.hp <= 0 or actor.position.x > leader.position.x):
leader = actor
return leader
1 change: 1 addition & 0 deletions hoppys-adventure-arcade/app/arcade_team.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://dj1x2v8c8crmq
21 changes: 13 additions & 8 deletions hoppys-adventure-arcade/app/controller_service.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ extends Node
## Which controller the player is using, what its buttons are called, and what happens when it
## disconnects.
##
## Every pad binding answers every controller (device -1), so any pad on the table can play. The
## In solo play every pad binding answers every controller (device -1), so any pad on the table can play. The
## pad that last sent input is player one: prompts name its buttons ("Cross", "A" or "B" for the
## same bottom button). If that pad disconnects during a game, the game pauses through its own
## pause menu and a banner asks for it back; the game resumes when the pad reconnects. Start on
Expand Down Expand Up @@ -55,7 +55,7 @@ func use_hardware(hardware: RefCounted) -> void:
roster.role_restored.connect(_on_role_restored)
_set_paused_for_controller(false)
roster.refresh()
_update_family()
update_family()


## The label of an action's first pad binding for the current controller, or "" without one.
Expand Down Expand Up @@ -86,6 +86,7 @@ func _input(event: InputEvent) -> void:
## Lets a pad's press make it player one. _input calls this; so does the how-to-play card, which
## swallows input before this autoload would see it.
func observe(event: InputEvent) -> void:
if LocalParty.size > 0: return
var device := _gameplay_device(event)
if device < 0 or roster.role_of(device) == PLAYER:
return
Expand Down Expand Up @@ -119,26 +120,26 @@ func _on_joy_connection_changed(device: int, connected: bool) -> void:


func _on_role_assigned(_role: StringName, _device: int) -> void:
_update_family()
update_family()


func _on_role_lost(_role: StringName, _device: int) -> void:
_update_family()
if not _in_gameplay():
update_family()
if LocalParty.size > 0 or not _in_gameplay():
roster.release(PLAYER)
else:
# Connection callbacks can arrive while Input is dispatching; pause once it is idle.
_pause_for_controller.call_deferred()


func _on_role_restored(_role: StringName, _device: int) -> void:
_update_family()
update_family()
_resume_for_controller.call_deferred()


func _pause_for_controller() -> void:
# A game already paused by its player stays paused, and a reconnect won't resume it.
if roster.is_waiting(PLAYER) and _in_gameplay() and not get_tree().paused:
if LocalParty.size == 0 and roster.is_waiting(PLAYER) and _in_gameplay() and not get_tree().paused:
_toggle_pause()
_set_paused_for_controller(get_tree().paused)

Expand All @@ -154,9 +155,13 @@ func _set_paused_for_controller(value: bool) -> void:
banner.visible = value


func _update_family() -> void:
func update_family() -> void:
var device: int = roster.device_for(PLAYER)
var current: String = roster.family(device) if device >= 0 else ""
var party := get_node_or_null("/root/LocalParty")
if party and party.size > 0:
var host: int = party.roster.device_for(PLAYER)
if host >= 0: current = party.roster.family(host)
if current != family:
family = current
family_changed.emit(family)
Expand Down
2 changes: 1 addition & 1 deletion hoppys-adventure-arcade/app/how_to_play.gd
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func close() -> void:
var router := tree.root.get_node_or_null(^"AppRouter")
var leaving: bool = router != null and router.busy
var self_paused: bool = scene != null and scene.has_method("is_player_paused") and scene.is_player_paused()
if tree.current_scene == scene and not leaving and not self_paused:
if tree.current_scene == scene and not leaving and not self_paused and not tree.root.get_node("LocalParty").hold_for_reconnect():
tree.paused = false
elif is_instance_valid(return_focus) and return_focus.is_visible_in_tree():
return_focus.grab_focus()
Expand Down
Loading
Loading