Matchmaking Implementation Question
bglin opened this issue · 2 comments
Hello,
Is it possible to code a server on the world list that automatically matches players to 1 v 1 games?
I am still trying to understand the code but here are my initial thoughts:
I see that in gameserver.py
insert_test_data() function automatically creates some test rooms.
def insert_test_data(self):
# create lobby and channel test users
virtual_users = ["us", "jg", "admin"]
room_index = 0
for virtual_user in virtual_users:
virtual_session = Session(None, None)
virtual_session.user = User.get_user_by_name(self.world_user, virtual_user)
virtual_session.user.guild = "virtual"
virtual_session.channel_position = Session.find_channel_position(self.world_session)
self.world_session.append(virtual_session)
test_room = Room(room_index, virtual_session.user.username + " virtual", "", 0, bytes.fromhex("B2620C00"),
2)
test_room.player_sessions.append(virtual_session)
self.world_room.append(test_room)
room_index += 1
My thinking is that when a user enters the server, they could be sent to these pre-created rooms rather than the lobby. I see that the server receives this request from the client to join a room.
elif client_command == 0x2110:
print("RECV> SVC_ROOM_JOIN")
So could the client be manipulated to send this command on entry to the server?
I noticed a good amount of time is spent in game just trying to get a match going so I was curious to see if something like this would be feasible.
Thank you for starting this project!
Hi,
Implementing that at the world select will be tricky for a few reasons since the client will likely be connected to the broker server instead of a specific gameserver.
- When the client is not connected to a gameserver, it does not have a way to receive gameserver-related commands
- The player could double-click on the server entry to establish a connection, and let the gameserver hold them at the broker screen until a room is available, though I believe that the client enforces a timeout (and the user would feel like they are lagging)
On the upside, your idea will most likely work well at the channel page, since the client should happily respond to a 0x2111
packet even if it has not previously sent out a 0x2110
room join request.
A hypothetical matchmaking system could move a group of players from a specific channel directly into a room without any player intervention. As a bonus, you can even be creative with the 0x5101
packet to update players on their matchmaking status.
Your concept sounds fun and I hope it works out :^)
Thanks for the information! I'm definitely gonna play around with it and see what I can come up with.