Run lobbies' games on the server
The server now runs every lobby's sandbox and queued games as rooms, stepped at the tick rate on one thread. Players send controls ahead of time, late ones repeat their last, and everyone in a room gets back the controls it played, its events and checksums. Games start from sandbox queues, players return when they leave, and play-again moves them to a fresh room. Protocol version 3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9613e85706
commit
655332778c
5 files changed
+585
-97
No files matched your search
+18
@@ -73,6 +73,24 @@ void Sim::game_start(Match& lobby, const int* members, int count, const Rules& r
|
||||
match.start(*this);
|
||||
}
|
||||
|
||||
void Sim::event_apply(const RoomEvent& event)
|
||||
{
|
||||
if (event.type == ROOM_JOIN)
|
||||
match.member_join(*this, event.member, event.profile);
|
||||
if (event.type == ROOM_LEAVE)
|
||||
match.member_leave(*this, event.member);
|
||||
int index = match.fighter_find(*this, event.member);
|
||||
if (index < 0)
|
||||
return;
|
||||
if (event.type == ROOM_QUEUE)
|
||||
match.queue_open(*this, index, event.rules);
|
||||
if (event.type == ROOM_UNQUEUE)
|
||||
{
|
||||
match.queues[index].isActive = false;
|
||||
match.isQueueReady[index] = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Moves a level by a step within the levels there are, cueing whether it went up or down.
|
||||
void level_step(Sim& sim, int& level, int step)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user