Berkay 
 Kus 

GitHub LinkedIn
email
CV
back

Unity Multiplayer

🏡 Personal Project

About

A fully integrated multiplayer Steam game template using Unity Mirror and Steamworks (FizzyFacePunch). Easily create or join lobbies, invite Steam friends, and enjoy secure, peer-to-peer gameplay via Steam Relay for low-latency, NAT-punching-free connections.

Trailer

Description

Source Code Explanation

SteamManager initializes Steamworks, enabling all subsequent API calls.
SteamLobbyManager creates/joins lobbies, synchronize members and manages Mirror Networking.
SteamFriendsManager populates the player’s Steam friends list in the UI.
FriendObject handles lobby invitations through Steam.
CustomNetworkManager ensures scene transitions and player spawning.
LocalComponentChecker disables non-local player components.
PlayerNameTag displays and synchronizes Steam usernames as floating name tags above players.

SteamManager.cs

The foundational script for initializing and shutting down Steamworks. On Awake(), it calls SteamClient.Init with a predefined AppID, starting the Steam connection. The OnApplicationQuit method ensures a clean shutdown with SteamClient.Shutdown(), preventing memory leaks.

SteamLobbyManager.cs

Manages the entire lobby lifecycle, including creation, joining, and member synchronization. The CreateLobbyAsync method initializes a Steam lobby and starts a Mirror host session. Callbacks like OnLobbyEntered and OnLobbyMemberJoined update the UI dynamically via UnityEvent (e.g., OnJoinedLobby.Invoke()).

SteamFriendsManager.cs

This script dynamically fetches and displays the player’s Steam friends list, including profile names and avatars. The InitFriends method iterates through the user’s friends using SteamFriends.GetFriends(), instantiates UI entries for each friend, and links them to their SteamID.

FriendObject.cs

Attached to each friend entry in the UI, this script handles lobby invitations. When a player clicks "Invite," it checks if the user is in a lobby and either sends an invite via SteamLobbyManager.currentLobby.InviteFriend() or creates a new lobby first.

CustomNetworkManager.cs

Extends Mirror’s NetworkManager. The ChangeScene method allows the host to trigger a scene transition for all players. Overrides OnServerSceneChanged to spawn players in the game scene.

LocalComponentChecker.cs

This script disables non-essential components (e.g., cameras, movement scripts) on non-local players. During Update(), it checks isLocalPlayer and destroys components like Mover or AdvancedWalkerController for non-local players, preventing redundant processing.

PlayerNameTag.cs

This script handles displaying and synchronizing Steam usernames as floating name tags above players’ in the game. The CmdSetPlayerName command sends the local player’s Steam name to the server, which broadcasts it to all clients via OnNameChanged hook.
Also, the LateUpdate method ensures the name tag always faces the camera.