This repository has been archived by the owner on Aug 15, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 305
Ping Pong
TheYellowArchitect edited this page Feb 8, 2021
·
10 revisions
Ping measures the round-trip time for messages sent from the originating host to a destination computer that are echoed back to the source. You probably want to be able to see your Ping in the game. Show it to the player, or use it for the game's mechanics.
First of all, with a networkObject (make sure it is not null!), access the Networker, and register to the onPingPong
event!
networkObject.Networker.onPingPong += OnPingPong;
public void OnPingPong(double ping, NetWorker player)
{
Debug.Log("Ping: " + (int) ping);
}
And somewhere, call Ping()!
networkObject.Networker.Ping();
To ping each player, you have to check if the client is bound, not null, etc etc
Maybe you want to add a ping timer atop of that?
Here is an example, building atop of the above!
(ctrl+f ping)
Locally testing your game, you should have 0 ping. There are 2 ways to simulate different pings
- Forge's Internal Functions
- This software which can simulate lag, packet drops etc etc (it's pretty neat!)
Getting Started
Network Contract Wizard (NCW)
Remote Procedure Calls (RPCs)
Unity Integration
Basic Network Samples
Scene Navigation
Master Server
Netcoding Design Patterns
Troubleshooting
Miscellaneous
-
Connection Cycle Events
-
Rewinding
-
Network Logging
-
Working with Multiple Sockets
-
Modify Master and Standalone servers
-
NAT Hole Punching
-
UDP LAN Discovery
-
Offline Mode
-
Ping Pong
-
Lobby System
-
Upgrading Forge Remastered to Develop branch or different version
-
Forge Networking Classic to Remastered Migration Guide
-
Script to easily use Forge Networking from sources
-
Run Two Unity Instances with Shared Assets for Easiest Dedicated Client Workflow