Still figuring out initial matchmaking hang (FROSTBITE). Lots of other changes.
- Added missing room images
- Removed internal rooms and disallow cloning some rooms
- License fixes
- Switched target to 20200306
- Socket header fixes
- Sockets are closed upon shutdown
* Sockets persist after being destroyed, fix
- Config changes for 20200306
- Settings initialized
- Name generation words cannot be longer than 9 characters
- Dorm generation changes and fixes
- Added some settings keys
- Matchmaking additions
* Instances are not yet updated to be or not to be in-progress
- Instance fixes and logging
- Image operation fixes
- DisplayName route start
- Challenge route start
- Default Amplitude key (i can see althe Amplitude requests are ignored
- Rate limiting ease
- GameConfigs properly queried and sent
- Many 'bulk' endpoints were added in or around 20200306
- Objective routes started
- DormRoom redirection in v2/name
- Client doesn't care if it gets 200 when setting prefs
- Balance/storefronts started
- Matchmaking goto/room timer and fixes
- Selfhosted Photon addition on the client sends matchmaking /photonregionpings, ignore since Photon is only one server in one region
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/* Galvanic Corrosion - Rec Room custom server for communities.
|
||||
<https://gitea.proxnet.dev/zombieb-galvanic-corrosion>
|
||||
<https://gitea.proxnet.dev/zombieb/galvanic-corrosion>
|
||||
Copyright (C) 2025 @zombieb (Discord / proxnet Gitea)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -66,6 +66,7 @@ class MatchmakingBase {
|
||||
else if (instance.isPrivate) return { errorCode: MatchmakingErrorCode.RoomInstanceIsPrivate };
|
||||
|
||||
await Instances.setPlayerInstance(options.profile, instance);
|
||||
Instances.clearAllRoomEmptyInstances(instance.roomId);
|
||||
return { errorCode: MatchmakingErrorCode.Success, roomInstance: instance };
|
||||
}
|
||||
|
||||
@@ -73,35 +74,76 @@ class MatchmakingBase {
|
||||
|
||||
} else {
|
||||
|
||||
// check to make sure room exists, is not private, and is active
|
||||
const targetRoom = options.roomName !== 'DormRoom' ? await Rooms.getByName(options.roomName) : await Rooms.getProfileDormDefault(options.profile);
|
||||
if (!targetRoom) return { errorCode: MatchmakingErrorCode.NoSuchRoom };
|
||||
if (targetRoom.Room.Accessibility == RoomAccessibility.Private) return { errorCode: MatchmakingErrorCode.RoomIsPrivate };
|
||||
if (targetRoom.Room.Accessibility == RoomAccessibility.Private && targetRoom.Room.CreatorPlayerId !== options.profile.getId())
|
||||
return { errorCode: MatchmakingErrorCode.RoomIsPrivate };
|
||||
if (targetRoom.Room.State !== RoomState.Active) return { errorCode: MatchmakingErrorCode.RoomIsNotActive };
|
||||
const roomId = targetRoom.Room.RoomId;
|
||||
|
||||
Instances.clearAllRoomEmptyInstances(roomId);
|
||||
|
||||
// get all available instance
|
||||
let allInstances = Instances.getAllRoomInstances(roomId).values().toArray().filter(instance => !instance.isPrivate && !instance.isFull);
|
||||
const subroomId = targetRoom.Scenes.find(scene => scene.Name == options.subRoomName)?.RoomSceneId;
|
||||
if (subroomId) allInstances = allInstances.filter(instance => instance.subRoomId == subroomId);
|
||||
|
||||
const foundInstance = allInstances[Math.floor(Math.random() * allInstances.length)];
|
||||
// filter instances that do not support join in progress and are in progress
|
||||
const builtinRooms = Rooms.getAllBuiltinRooms();
|
||||
const joinInProgressSubrooms = builtinRooms.map(room =>
|
||||
({Name: room.Name, Scenes: room.Scenes.map(scene =>
|
||||
({Name: scene.Name, Supported: scene.SupportsJoinInProgress})
|
||||
)})
|
||||
);
|
||||
allInstances = allInstances.filter(instance => {
|
||||
const subroomName = Rooms.getSubroomNameFromId(targetRoom, instance.subRoomId);
|
||||
if (!subroomName) return false;
|
||||
const subrooms = joinInProgressSubrooms.find(room => room.Name == targetRoom.Room.Name);
|
||||
if (!subrooms) return false;
|
||||
const supportsJoinInProgress = subrooms.Scenes.find(subroom => subroom.Name == subroomName)?.Supported;
|
||||
if (supportsJoinInProgress) return true;
|
||||
else if (!instance.isInProgress) return true;
|
||||
else return false;
|
||||
});
|
||||
|
||||
allInstances = allInstances.sort((a, b) => {
|
||||
const pidsA = Instances.getInstancePlayers(a);
|
||||
const pidsB = Instances.getInstancePlayers(b);
|
||||
return pidsA.size - pidsB.size;
|
||||
}).reverse(); // Largest instances first
|
||||
|
||||
const foundInstance = allInstances[0];
|
||||
if (!foundInstance) {
|
||||
|
||||
const matchmakeableSubrooms = targetRoom.Scenes.filter(scene => scene.CanMatchmakeInto);
|
||||
const newInstance = Instances.createInstance({
|
||||
const newInstance = await Instances.createInstance({
|
||||
Room: targetRoom,
|
||||
SceneIndex: Math.floor(Math.random() * matchmakeableSubrooms.length),
|
||||
FirstPlayer: options.profile
|
||||
FirstPlayer: options.profile,
|
||||
Private: options.private,
|
||||
IsDorm: options.roomName == 'DormRoom'
|
||||
});
|
||||
|
||||
Instances.clearAllRoomEmptyInstances(roomId);
|
||||
return { errorCode: MatchmakingErrorCode.Success, roomInstance: newInstance };
|
||||
|
||||
} else {
|
||||
|
||||
const currentInstance = options.profile.getInstance();
|
||||
if (currentInstance?.roomInstanceId == foundInstance.roomInstanceId)
|
||||
return { errorCode: MatchmakingErrorCode.AlreadyInBestInstance };
|
||||
|
||||
await Instances.setPlayerInstance(options.profile, foundInstance);
|
||||
|
||||
Instances.clearAllRoomEmptyInstances(roomId);
|
||||
|
||||
return { errorCode: MatchmakingErrorCode.Success, roomInstance: foundInstance };
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user