By no sessions saved I mean that there is session multiplayer, which is more simple…
- User
By no sessions saved I mean that there is session multiplayer, which is more simple alternative to mmo which can be extended into mmo later
Assistant
Ah, got it! You're referring to a session-based multiplayer game — where players join a temporary server (like a match or lobby), play together, and when the session ends, everything resets. This is a great starting point before jumping into full MMOs with persistent worlds and databases.
We'll walk through how to create a session-based multiplayer game in Unity, using a modern networking solution like Mirror Networking (which is actively maintained and built on top of Unity's Transport Layer).
✅ Step 1: Choose Your Tools
Recommended Stack:
- Unity: Use LTS version (e.g., 2020.3 LTS or newer)
- Mirror Networking: GitHub - Mirror Networking – easy-to-use networking layer
- Transport Layer: Use Unity's Netcode for GameObjects (formerly Netcode Transport) or Telepathy (simple TCP/UDP transport)
⚠️ Note: Unity’s old HLAPI/UNet is deprecated. Mirror is the best lightweight alternative.
🧪 Step 2: Set Up a New Unity Project
- Open Unity Hub
- Create a new 3D Core project (or 2D if you're making a top-down game)
- Name it something like
SessionMultiplayerDemo
🔌 Step 3: Install Mirror Networking
There are two ways to install Mirror:
Option A: via Package Manager (Recommended)
- Go to Window > Package Manager
- Click the
+button > "Add package from git URL" - Enter:
https://github.com/MirrorNetworking/Mirror.git?path=/Packages/com_mirror
Option B: via Unity Asset Store
- Open Unity Asset Store
- Search for Mirror Networking
- Import the package
🕹️ Step 4: Basic Multiplayer Scene Setup
1. Create a Network Manager
-
Right-click in Hierarchy → Create Empty → Name it
NetworkManager -
Add the NetworkManager component (from Mirror)
-
Also add NetworkManagerHUD to easily test hosting/joining
![Screenshot suggestion: NetworkManager setup]
-
Save the scene as
MainScene
2. Create a Player Prefab
-
Right-click in Hierarchy → 3D Object > Capsule
-
Rename it to
Player -
Add a NetworkIdentity component
-
Add a NetworkTransform so movement syncs over network
-
Drag this object into the Assets folder to make it a prefab
-
Remove it from the scene
-
In the NetworkManager inspector, set:
- Player Prefab = your
Playerprefab - Auto Create Player = true
- Player Prefab = your
🏃♂️ Step 5: Run the Game
- Hit Play
- Click Start Host or Start Server / Start Client
- You’ll see a local multiplayer environment working!
📦 Step 6: No Saved Data Between Sessions
This part is already handled by default:
- When the server shuts down, all data is lost.
- There’s no database or persistent storage.
- Players reconnecting later will not have their previous state saved.
You can now focus on gameplay mechanics without worrying about databases or servers running 24/7.
🧱 Step 7: Expand Into MMO Later
Once you’re comfortable with session-based multiplayer, you can evolve into an MMO by adding:
Feature Description Persistent World Store world state in a database Login System Authenticate users Player Profiles Save inventory, stats, etc. Matchmaking Auto-join lobbies or zones Dedicated Servers Run servers 24/7 Sharding / Zones Split world into regions Anti-Cheat & Security Protect against exploits
🛠️ Optional: Hosting a Dedicated Server
To run a public session server:
- Build your game (File > Build Settings)
- Build a dedicated server version:
- Enable “Headless Mode” in build settings
- Run it separately (on a VPS or cloud machine)
Clients connect via IP address or matchmaking service.
📚 Useful Tutorials
- Mirror Getting Started Guide
- YouTube: Mirror Multiplayer Tutorial Series
- Unity Netcode vs Mirror Comparison
🎯 Summary
Goal How to Achieve Session-based multiplayer Use Mirror Networking + NetworkIdentity + NetworkTransform No saved data Don’t implement saving/loading; reset each session Extendable to MMO Later, integrate databases, login systems, dedicated servers
Would you like a sample GitHub repo or starter template to get going faster? I can provide one that includes Mirror setup and player movement.
- User
Why you prefer mirror over new unity network system?
Assistant
Great question! The choice between Mirror Networking and Unity’s newer networking system — currently called Netcode for GameObjects (formerly known as Netcode for Unity Multiplayer or MLAPI) — depends on your project's goals, experience level, and what kind of development workflow you prefer.
Here’s a breakdown of why Mirror is still preferred by many developers today — especially for session-based multiplayer games, indie projects, and those transitioning from older Unity networking systems like UNet:
✅ Why Mirror Is Still Preferred in Many Cases
1. Mature, Stable, and Battle-Tested
- Mirror is a community-maintained fork of the original UNet HLAPI, with years of real-world use.
- It powers many shipped games and has a large community and ecosystem.
- If you're starting small or want something that "just works", Mirror is often more approachable.
2. Familiar API for Unity Developers
- Mirror uses an object-oriented, component-based model:
NetworkIdentity,NetworkBehaviour,Cmd,Rpc, etc.
- This makes it easier to learn if you're used to Unity’s MonoBehaviour-style scripting.
- Very little boilerplate code required to get started.
3. Built-in Tools & Editor Support
- Mirror includes useful editor tools like:
- NetworkManagerHUD (for testing)
- Spawn System
- SyncVars, NetworkTransform, etc.
- These reduce the amount of custom code you need to write.
4. Easier to Extend and Customize
- Because it's open-source and well-documented, it's relatively easy to modify or extend Mirror to suit your game.
- You can swap out transports (like using Telepathy for TCP/UDP instead of Netcode Transport).
5. Active Community and Plugins
- There are many free and paid plugins built around Mirror (e.g., authentication, voice chat, inventory systems).
- A lot of existing tutorials and YouTube content use Mirror.
🧪 Unity’s New Netcode for GameObjects: Pros
Unity's new official solution is Netcode for GameObjects, part of their larger Transport and Netcode packages. Here's where it shines:
1. Future-Proof and Officially Supported
- Actively developed and supported by Unity.
- Designed with scalability and performance in mind.
- Intended to replace all previous networking solutions.
2. More Performant and Scalable
- Lower-level API gives you more control over network behavior.
- Built for high-performance scenarios like AAA games or large-scale servers.
3. Better Security and Modern Practices
- Uses modern serialization (with System.Text.Json).
- Enforces better practices for secure communication and authoritative servers.
4. Cross-Platform Ready
- Works across platforms including mobile, consoles, and standalone builds.
⚖️ Mirror vs Netcode for GameObjects – Comparison Table
Feature Mirror Netcode for GameObjects Maturity Mature, stable, widely used Actively developed, improving Learning Curve Gentle, familiar to Unity devs Steeper, lower-level Editor Tools Rich GUI tools (Hud, Spawning, etc.) Limited tooling so far Performance Good for indie/small-scale games Optimized for high-performance Customization Easy to customize Requires deeper understanding Community / Resources Large, many tutorials Growing, but fewer guides Future Proof Community maintained Officially supported by Unity Use Case Indie games, session-based MP, fast prototyping AAA, large-scale MMOs, long-term support
🎯 When Should You Choose Mirror?
Use Mirror if:
- You’re building a small-to-medium scale multiplayer game
- You want fast prototyping and ease of use
- You're not ready to dive into low-level networking
- You're learning multiplayer concepts
- You're targeting a session-based multiplayer game, not a full MMO
🎯 When Should You Choose Netcode for GameObjects?
Use Netcode for GameObjects if:
- You're building a high-performance multiplayer game
- You plan to scale up to thousands of players eventually
- You want official Unity support
- You're comfortable writing lower-level networking logic
- You're working on a professional or enterprise-level product
🧠 Pro Tip: Hybrid Approach
You can even start with Mirror for rapid prototyping, then transition to Netcode for GameObjects later once your core mechanics are solid and you're ready to optimize.
🔗 Useful Links
- Mirror GitHub: https://github.com/MirrorNetworking/Mirror
- Mirror Docs: https://mirror-networking.com/docs/
- Netcode for GameObjects GitHub: https://github.com/Unity-Technologies/com.unity.netcode.gameobjects
- Netcode Docs: https://docs-multiplayer.unity3d.com/
Would you like a basic Mirror starter template or a Netcode for GameObjects starter template to see how each looks in practice? I can give you a minimal working example of either one.
- User
My game is TPS close combat fighting game.
Assistant
Got it! You're making a TPS (Third-Person Shooter) close-combat fighting game, likely with multiplayer. That gives us a solid foundation to tailor the approach.
🔥 Recommended Approach: Mirror Networking
Since you're building a close-combat TPS fighting game, your priorities are:
- Fast-paced, responsive movement and combat
- Synchronized player actions (attacks, dodges, health)
- Session-based multiplayer (no persistent data between sessions)
- Quick iteration and prototyping
For these reasons, Mirror Networking is still the better choice for now.
🎮 Core Multiplayer Features Needed
Feature Description Player Movement Sync Ensure all clients see smooth movement Input Prediction / Reconciliation Make controls feel responsive Attack & Hit Detection Handle combat logic on server Health & Death System Track damage and respawn players Session Matchmaking Host/Join lobbies without saved profiles Match Timer / Scoreboard Optional: Add win conditions
🧱 Architecture Overview
Client (Player 1) ----\ \ Client (Player 2) -------> [Server] / Client (Player 3) ----/- The server runs the authoritative game logic (damage, hit detection, win conditions).
- Clients send inputs (movement, attack buttons), and receive updates from the server.
- No database or persistent storage needed at this stage.
✅ Getting Started – Minimal Setup with Mirror
Step 1: Install Mirror Networking
Use Git URL in Unity Package Manager:
https://github.com/MirrorNetworking/Mirror.git?path=/Packages/com_mirrorStep 2: Create NetworkManager
- GameObject > Create Empty > Name it
NetworkManager - Add component:
NetworkManager - Add:
NetworkManagerHUD(for testing UI)
Step 3: Create Player Prefab
- Capsule → Rename to
Player - Add components:
NetworkIdentityNetworkTransform(synchronizes position/rotation)
- Drag into Assets folder as a prefab
- Set it as Player Prefab in NetworkManager
Step 4: Add Basic Movement Script
using UnityEngine; using Mirror; public class PlayerMovement : NetworkBehaviour { public float moveSpeed = 5f; public float jumpForce = 5f; private Rigidbody rb; void Start() { rb = GetComponent<Rigidbody>(); } void Update() { if (!isLocalPlayer) return; float x = Input.GetAxis("Horizontal"); float z = Input.GetAxis("Vertical"); Vector3 move = transform.right * x + transform.forward * z; rb.velocity = new Vector3(move.x * moveSpeed, rb.velocity.y, move.z * moveSpeed); if (Input.GetButtonDown("Jump")) { rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse); } } }Attach this to your Player prefab.
⚔️ Close Combat Fighting Logic
You’ll need to implement:
1. Attack Input & Animation Trigger
void Update() { if (!isLocalPlayer) return; if (Input.GetMouseButtonDown(0)) // Left click { CmdDoMeleeAttack(); } }2. Server-Side Damage Handling
[Command] void CmdDoMeleeAttack() { RaycastHit hit; if (Physics.Raycast(Camera.main.transform.position, Camera.main.transform.forward, out hit, 2f)) { if (hit.collider.CompareTag("Player")) { RpcApplyDamage(hit.collider.gameObject, 20); } } } [Rpc] void RpcApplyDamage(GameObject target, int damage) { Health health = target.GetComponent<Health>(); if (health != null) { health.TakeDamage(damage); } }3. Health Component
public class Health : NetworkBehaviour { [SyncVar] public int currentHealth = 100; public void TakeDamage(int amount) { if (!isServer) return; currentHealth -= amount; if (currentHealth <= 0) { Die(); } } [Server] void Die() { // Respawn or despawn player NetworkServer.Destroy(gameObject); } }
🧪 Testing Your Game
- Click Play
- Press Start Host in the HUD
- Launch another instance of the game (or build client)
- Join the server IP
- Fight!
🧠 Tips for Close Combat Games
- Use interpolation and prediction to make movement smoother.
- Consider input delay compensation for fairness in hits.
- For advanced hit detection, use raycasts on the server only to prevent cheating.
- If latency becomes an issue later, look into snapshot interpolation or switch to Netcode for GameObjects.
🛠️ Next Steps
Goal What to Do Improve network performance Learn about sync intervals, interpolation Add abilities or combos Extend CmdandRpcmethodsAdd matchmaking system Use Steamworks, Photon PUN, or simple LAN discovery Build dedicated server Export headless build and run on VPS
📦 Want a Starter Template?
I can provide a minimal GitHub repo or Unity package that includes:
- Mirror setup
- Basic player controller
- Melee attack system
- Health & death system
- Network HUD for testing
Would you like that? I can give you a zip file or GitHub link with everything ready to go.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.