Game Type System

The Game Type system allows Universal Friend List to work seamlessly with different game architectures. Whether your game uses discrete rooms/lobbies or seamless open worlds, the system adapts to handle friend invitations and joining appropriately.

Why Game Types Matter

Different games handle multiplayer sessions differently:

  • Room-Based Games: Players join specific rooms with codes/names, stay until the match ends
  • Open-World Games: Players move seamlessly between areas without discrete rooms

The Game Type system ensures invitations and "join friend" features work correctly for both models.

Available Game Types

TypeHandler ClassBest For
RoomBasedRoomBasedGameTypeHandlerLobbies, matches, round-based games, FPS, party games
OpenWorldOpenWorldGameTypeHandlerSeamless worlds, MMOs, persistent worlds, survival games

How It Works

Each game type has a handler that implements IGameTypeHandler:

MethodPurpose
Initialize()Set up the handler with user ID and backend
CreateSession()Create a new game session/room
JoinSession()Join an existing session/room
PrepareInvitation()Create an invitation with game-specific data
SupportsRoomCreationCan this game type create rooms?
SupportsDirectJoinCan players directly join friends?

Choosing a Game Type

For Non-Developers

Set the Default Game Type on FriendManager in the Inspector to match your game:

  • Most online multiplayer games → RoomBased
  • MMO, open world, seamless → OpenWorld

For Developers

You can also create custom game type handlers by implementing IGameTypeHandler:

public class MyCustomGameTypeHandler : BaseGameTypeHandler, IGameTypeHandler
{
    public override void Initialize(string userId, NetworkBackendType backend) {
        // Custom initialization
    }

    public override void CreateSession(string roomName, int maxPlayers,
        Dictionary<string, string> customProperties,
        Action<bool, RoomInfo> onComplete) {
        // Custom room creation logic
    }

    // Implement other required methods...
}

Detailed Game Type Pages