Skip to content

Commit

Permalink
Remove Rivet code
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelOnFira committed Jan 26, 2024
1 parent 35bb459 commit ba5ef96
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 80 deletions.
21 changes: 0 additions & 21 deletions godot/bomber/Dockerfile

This file was deleted.

24 changes: 0 additions & 24 deletions godot/bomber/rivet.yaml

This file was deleted.

40 changes: 5 additions & 35 deletions godot/bomber/scripts/gamestate.gd
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ signal game_error(what)


func _ready():
RivetHelper.start_server.connect(start_server)
RivetHelper.setup_multiplayer()

multiplayer.peer_connected.connect(self._player_connected)
multiplayer.peer_disconnected.connect(self._player_disconnected)
multiplayer.connected_to_server.connect(self._connected_ok)
Expand All @@ -40,19 +37,10 @@ func start_server():
print("Starting server on %s" % DEFAULT_PORT)

peer = ENetMultiplayerPeer.new()
var error = peer.create_server(DEFAULT_PORT, MAX_PEERS)
RivetHelper._assert(!error, "Could not start server")
peer.create_server(DEFAULT_PORT, MAX_PEERS)

multiplayer.set_multiplayer_peer(peer)

var response = await Rivet.matchmaker.lobbies.ready({})

if response.result == OK:
RivetHelper.rivet_print("Lobby ready")
else:
RivetHelper.rivet_print("Lobby ready failed")
OS.crash("Lobby ready failed")


# Callback from SceneTree.
func _player_connected(id):
Expand Down Expand Up @@ -125,25 +113,10 @@ func load_world():
func join_game(new_player_name):
print("Joining game as %s" % new_player_name)
player_name = new_player_name

var response = await Rivet.matchmaker.lobbies.find({
"game_modes": ["default"]
})

if response.result == OK:
RivetHelper.set_player_token(response.body.player.token)

var port = response.body.ports.default
print("Connecting to ", port.host)

peer = ENetMultiplayerPeer.new()
var error = peer.create_client(port.hostname, port.port)
RivetHelper._assert(!error, "Could not start server")

multiplayer.set_multiplayer_peer(peer)
else:
print("Lobby find failed: ", response)
game_error.emit(response.body)

peer.create_client("127.0.0.1", DEFAULT_PORT)

multiplayer.set_multiplayer_peer(peer)


func get_player_list():
Expand All @@ -160,9 +133,6 @@ func begin_game():
if !multiplayer.is_server():
return

# Tell Rivet that this lobby is closed
await Rivet.matchmaker.lobbies.setClosed({})

load_world.rpc()

var world = get_tree().get_root().get_node("World")
Expand Down

0 comments on commit ba5ef96

Please sign in to comment.