User Tools

Site Tools


global:network

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
global:network [2021/03/17 23:23]
Mistermind [Network Options]
global:network [2024/01/02 23:38] (current)
Mistermind
Line 1: Line 1:
 ===== Network Options ===== ===== Network Options =====
-**UFE 2** comes with a completely revision of its core physics and network mechanics. The second iteration allows you to run online matches in a smooth lag-free environment thanks to its native //rollback mechanics// (similar to [[https://en.wikipedia.org/wiki/GGPO|GGPO]]) and //deterministic physics//. The netcode also uses raw //manual tracking// to its own variables, optimizing CPU usage (including mobile devices).\\+UFE 2 comes with a completely revision of its core physics and network mechanics. The second iteration allows you to run online matches in a smooth lag-free environment thanks to its native //rollback mechanics// (similar to [[https://en.wikipedia.org/wiki/GGPO|GGPO]]) and //deterministic physics//. The netcode also uses raw //manual tracking// to its own variables, optimizing CPU usage (including mobile devices).\\
 The new network options also comes with its own client/server structure (using Photon Network or UNet) allowing direct player connection without the use of IP. The new network options also comes with its own client/server structure (using Photon Network or UNet) allowing direct player connection without the use of IP.
  
 For detailed instructions on UFE 2 Netcode and how to convert your previous UFE 1.x project, [[global:netcode|click here]]. For detailed instructions on UFE 2 Netcode and how to convert your previous UFE 1.x project, [[global:netcode|click here]].
  
 +----
  
-{{ :global:global_netcode.png?nolink |}}+{{ :global:global_networkoptions.png |}}
  
  
 ---- ----
 ==== Setup ==== ==== Setup ====
-You need **UFE 2 Standard/PRO/Source** and [[https://assetstore.unity.com/packages/tools/network/pun-2-free-119922|PUN2]] (or [[https://assetstore.unity.com/packages/tools/network/photon-unity-networking-free-1786|PUN1]]) to use this feature. +You need **UFE 2 Standard/PRO/Source** and [[https://assetstore.unity.com/packages/tools/network/pun-2-free-119922|PUN2]] to use this feature. 
  
 1- Sign up for free at [[https://www.photonengine.com/en/PUN]]. You will be asked to setup the App ID. You can find it under ''Public Cloud -> Applications'' inside your account page. Copy your App ID as displayed on the web page (example): 1- Sign up for free at [[https://www.photonengine.com/en/PUN]]. You will be asked to setup the App ID. You can find it under ''Public Cloud -> Applications'' inside your account page. Copy your App ID as displayed on the web page (example):
Line 19: Line 20:
 {{ :global:netcode_photonadditionaloptions.png?nolink |}} {{ :global:netcode_photonadditionaloptions.png?nolink |}}
  
-3 - Now, extract the files at ''UFE\Engine\ThirdParty\Photon2API.unitypackage'' to connect UFE and Photon. If everything worked, you will notice the [[global:network|Network Options]] under Global Editor is now unlocked. Go to //Online Service// and set Photon as your Network service. Hit play and you should see the Network option enabled.+3 - Now, extract the files at ''UFE\Engine\ThirdPartySupport\Photon2APIConnector.unitypackage'' to connect UFE and Photon. If everything worked, you will notice the [[global:network|Network Options]] under Global Editor is now unlocked. Go to //Online Service// and set Photon as your Network service. Hit play and you should see the Network option enabled.
  
  
Line 35: Line 36:
  
 ---- ----
-==== LAN Games ====+==== Particle Control ====
  
-**Network Port:** Set which Network port should the game use to connect between the clients in the local network. If you are testing your game using ''Play Mode'' under Unitymake sure your router and/or firewall are not blocking the port used.+**Control Spawned Particles:** When toggled, UFE will search for possible particle effects coming from a spawned game object (either being a [[move:projectiles|projectile]], [[global:hiteffects|hit effect]], or just a spawned [[move:particleeffects|particle effect]]) and control its random seed and speed for when the game pauses or rolls back.
  
-**Lan Discovery Port:** The port used in the network to search for games.+**Sync Random Seed:** Override the [[https://docs.unity3d.com/ScriptReference/ParticleSystem-randomSeed.html|random seed]] used for the Particle System emission.
  
-**Lan Discovery Broadcast Interval:** The interval for the host to broadcast its signal. +**Override Simulated Speed:** Override the default [[https://docs.unity3d.com/ScriptReference/ParticleSystem.MainModule-simulationSpeed.html|playback speed]] of the Particle System.
- +
-**Lan Discovery Search Interval:** The interval for the broadcast of witch the game searches for hosts. +
- +
-**Lan Discovery Search Timeout:** How long before it stops searching.+
  
  
Line 73: Line 70:
 ==== Rollback Netcode ==== ==== Rollback Netcode ====
  
-**Allow Rollbacks:** Enable Rollbacks in your game (Make sure you've gone through [[global:netcode|setup]]).+**Available only on PRO and Source licenses**
  
-**Track UFE Variables:** Toggle so UFE will use the //auto tracking// technique to search for its interface (''UFEInterface'') and attributed variables (''RecordVar''on its own instantiated classes. The deeper a variable is from the UFE instance, the more CPU power it consumes.+**Allow Rollbacks:** Enable Rollbacks in your game (Make sure you've gone through [[global:netcode|setup]]).
  
 **Max Fast-Forward Per Frame:** When using rollback, depending on the distance between packages sent, how many frames can your game recover from. The more frames, the more CPU power it needs. **Max Fast-Forward Per Frame:** When using rollback, depending on the distance between packages sent, how many frames can your game recover from. The more frames, the more CPU power it needs.
Line 87: Line 84:
   * //Conservative:// One player feels the effects of rollback more often the other.   * //Conservative:// One player feels the effects of rollback more often the other.
   * //Aggressive:// Both players share the same impact when a rollback is needed to stabilize the connection. Use this option to "share" the impact of a rollback between players (recommended).   * //Aggressive:// Both players share the same impact when a rollback is needed to stabilize the connection. Use this option to "share" the impact of a rollback between players (recommended).
 +
 +**Track UFE Variables (disabled):** Toggle so UFE will use the //auto tracking// technique to search for its interface (''UFEInterface'') and attributed variables (''RecordVar'') on its own instantiated classes. The deeper a variable is from the UFE instance, the more CPU power it consumes.
  
  
Line 100: Line 99:
  
 **Apply Frame Delay Offline:** Makes it so every game (including CPU matches and Training Mode) are always running with the ''Min Frame Delay'' value. **Apply Frame Delay Offline:** Makes it so every game (including CPU matches and Training Mode) are always running with the ''Min Frame Delay'' value.
 +
 +
 +----
 +==== Synchronization Test ====
 +
 +If you are making modifications to the source code, specially the core files, there is a chance you could cause an accidental desynchronization. Don't worry, UFE offers plenty of tools for you to try detecting what went wrong.
 +
 +**Set Host As AI:** When toggled, while testing online matches, the person who //hosts// the game will have its inputs overwritten by AI controls.
 +
 +**Set Client As AI:** When toggled, while testing online matches, the person who //joins// the game will have its inputs overwritten by AI controls.
 +
 +**Desync Action:** If the game desyncs, what should happen?
 +  * Disabled: Nothing happens, the game continues differently for both players.
 +  * Playback Tool: The game pauses on both players and the replay tool is enabled. You will see 2 recording states: One that shows what the player saw and one that shows what happened after the rollback was applied (standard gameplay). Use this tool to compare and detect what could have gone wrong. You can also generate data logs to better identify the problem. For more information check out this [[https://www.youtube.com/watch?v=j3B-lhd8JBw|video]].
 +  * Disconnect: If the game desyncs, both players are disconnected from the match.
 +
 +**Float Desync Threshold:** When the playback tool or disconnect option is selected, UFE will attempt to compare certain data values every frame cycle (defined bellow) in order to catch the desync as soon as possible.
 +
 +**Log Sync Messages (Console):** If toggled, UFE will report every successful sync check in the console window.
 +
 +**Record Post-Rollback Frames:** If toggled, UFE will record a second set of frames with the post-rollback process allowing you to see what happened in between rollback frames in the recording.
 +
 +**Generate Variable Log:** If toggled, UFE will generate a variable log that you can compare between the 2 clients.
 +
 +**Exported File Path:** The path the variable log above will be created.
 +
 +**Recording Buffer:** How many frames should be recorded for comparing.
  
  
Line 118: Line 144:
 ====== Hints ====== ====== Hints ======
 Networking is a relatively complicated aspect of the engine. Don't be alarmed if you can't get running at first. Here are a few hints to help out on common issues: Networking is a relatively complicated aspect of the engine. Don't be alarmed if you can't get running at first. Here are a few hints to help out on common issues:
-  * If you are having trouble connecting to the other peers, you might need to work on your router's [[http://portforward.com/|port forwarding]]. 
   * If you are experiencing lag, try changing the hosting option and protocol under 'PhotonServerSettings'. For more information on Photon options, [[https://doc.photonengine.com/en-us/pun/current/getting-started/initial-setup|click here]].   * If you are experiencing lag, try changing the hosting option and protocol under 'PhotonServerSettings'. For more information on Photon options, [[https://doc.photonengine.com/en-us/pun/current/getting-started/initial-setup|click here]].
   * Make sure you have no 'self-destruct' scripts attached to your particle effects. UFE needs to control the spawn and despawn of every GameObject. If you need to use one, use ''UFE\Engine\Scripts\DestroyScript.cs'' instead.   * Make sure you have no 'self-destruct' scripts attached to your particle effects. UFE needs to control the spawn and despawn of every GameObject. If you need to use one, use ''UFE\Engine\Scripts\DestroyScript.cs'' instead.
  
 +
 +----
 +====== Related Videos ======
 +{{youtube>-dmVAf_cyN8?medium}}
 +{{youtube>j3B-lhd8JBw?medium}}
  
 ---- ----
global/network.1616037795.txt.gz · Last modified: 2021/03/17 23:23 by Mistermind