This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
global:netcode [2018/08/28 00:55] Mistermind [UFE 2.0 Netcode] |
global:netcode [2024/12/10 16:17] (current) Mistermind |
||
---|---|---|---|
Line 2: | Line 2: | ||
**UFE Netcode** is the second iteration of the network system for UFE. It allows the game to run online matches in a smooth lag-free environment thanks to its native //rollback mechanics// and // | **UFE Netcode** is the second iteration of the network system for UFE. It allows the game to run online matches in a smooth lag-free environment thanks to its native //rollback mechanics// and // | ||
- | The new network options also comes with its own client/ | + | The new network options also comes with its own client/ |
- | [[http:// | ||
- | * Hit Online to search for a match (US Server) | + | The new Rollback netcode is available on [[https:// |
- | * All builds are **cross-platform** | + | |
Line 16: | Line 14: | ||
* **What is Rollback?** | * **What is Rollback?** | ||
Rollback (name might change depending on game or developer) is a technique in which a game is able to return to a previous frame, change the outcome of an event (say, an input), and return to the current frame, all in a span of a single frame of animation. This allows a game to //catch up// with whatever concurrent event instead of [[global: | Rollback (name might change depending on game or developer) is a technique in which a game is able to return to a previous frame, change the outcome of an event (say, an input), and return to the current frame, all in a span of a single frame of animation. This allows a game to //catch up// with whatever concurrent event instead of [[global: | ||
- | The subject can be extensive and have been topic of several games for years (often referred as [[https:// | + | The subject can be extensive and have been topic of several games for years (often referred as [[https:// |
* **If Rollback is so good, why use Frame Delay at all?** | * **If Rollback is so good, why use Frame Delay at all?** | ||
Line 25: | Line 23: | ||
---- | ---- | ||
===== Converting to 2.0 ===== | ===== Converting to 2.0 ===== | ||
+ | //This tutorial is meant for conversion between UFE 1 and 2. If you are starting from UFE 2 you can skip this step.// | ||
+ | |||
UFE 2.0 was developed with backwards compatibility in mind. Several processes were created specifically to deal with converting large amounts of data at once. A prototype of your project with the new netcode can be created in less then an hour if you know what you are doing. The whole process can be divided in 4 easy steps: | UFE 2.0 was developed with backwards compatibility in mind. Several processes were created specifically to deal with converting large amounts of data at once. A prototype of your project with the new netcode can be created in less then an hour if you know what you are doing. The whole process can be divided in 4 easy steps: | ||
Line 30: | Line 30: | ||
{{ : | {{ : | ||
- | One of the key changes made to the code is the use of '' | + | One of the key changes made to the code is the use of '' |
- | To run the auto update, right click on one of your UFE files ([[global: | + | To run the auto update, right click on one of your UFE files ([[global: |
\\ | \\ | ||
- | * **Step 2: Record Character Maps** | + | * **Step 2: Update Character File** |
- | Now that we have our asset files converted to //Fix64// we can move to the next step to ensure synchronization: | + | |
- | First, open the scene '' | + | |
- | {{ : | + | |
- | + | ||
- | Drag one of your characters into the //Character Info// field and hit **Play**. If you have your hitbox setup correctly you should see something like this: | + | |
- | {{ : | + | |
- | Select the Move Set and click //Record Basic Moves// to start recording all animations listed under your basic moves into //Fix64// position maps. Once completed, do the same for //Special Moves// then hit **Stop**. Replace the character info file with the next character and repeat the process.\\ | + | |
- | \\ | + | |
- | + | ||
- | * **Step 3: Update Character File** | + | |
Next up is the HitBoxes' | Next up is the HitBoxes' | ||
{{ : | {{ : | ||
Line 52: | Line 42: | ||
\\ | \\ | ||
- | * **Step 4: Photon Setup** | + | ---- |
+ | ===== Photon Setup ===== | ||
In order to have the client-server accessibility you need to download [[https:// | In order to have the client-server accessibility you need to download [[https:// | ||
Once you have an account go your Public Cloud -> Applications and copy your App ID as displayed here: | Once you have an account go your Public Cloud -> Applications and copy your App ID as displayed here: | ||
Line 73: | Line 65: | ||
===== Map Recorder ===== | ===== Map Recorder ===== | ||
- | One of the key elements that makes UFE easy to prototype is the guided transform hitbox system, meaning you only need to tell it where the joints are and UFE will take care of the rest. Unfortunately this means that we are tracking position information directly from the animation itself, and that value can only be read in //float// format (non-deterministic).\\ | + | One of the key elements that makes UFE easy to prototype is the guided transform hitbox system, meaning you only need to tell it where the joints are and UFE will take care of the rest. This means that we are tracking position information directly from the animation itself, and that value can only be read in //float// format (non-deterministic). |
- | To solve this, Map Recorder runs and stores the //position maps// (and delta displacements) of all identified hitbox on every frame of animation throughout the character' | + | |
+ | {{ : | ||
+ | |||
+ | To solve this, Map Recorder runs and stores the //position maps// (and delta displacements) of all identified hitbox on every frame of animation throughout the character' | ||
\\ | \\ | ||
- | Map Recorder is located at '' | + | Map Recorder is located at '' |
+ | |||
+ | {{ : | ||
Line 136: | Line 134: | ||
[RecordVar] public bool isBroken; | [RecordVar] public bool isBroken; | ||
- | void UFEFixedUpdate() { | + | public override |
if (position.y > .1f) BreakMe(); | if (position.y > .1f) BreakMe(); | ||
} | } | ||
Line 149: | Line 147: | ||
</ | </ | ||
- | Notice we only use the // | + | Notice we only use the // |
Also, notice we are using // | Also, notice we are using // | ||
An example of the auto-tracking system can be found under the projectile script: '' | An example of the auto-tracking system can be found under the projectile script: '' | ||
Line 167: | Line 165: | ||
---- | ---- | ||
===== Network 2.0 Options ===== | ===== Network 2.0 Options ===== | ||
+ | For a detailed explanation on each option [[global: | ||
- | {{ :global:global_netcode.png? | + | {{ :global:global_networkoptions.png |}} |
---- | ---- | ||
- | ==== Online Service | + | ====== |
- | + | {{youtube> | |
- | **Network Service:** Choose which online server to use. If you use Unity you must have a [[http:// | + | {{youtube> |
- | + | {{youtube> | |
- | **Photon Service: ** (Photon Only) Choose which cloud service to be used in conjunction with Photon (Photon Server, Photon Cloud, Playfab) | + | |
- | + | ||
- | **Photon Application ID:** (Photon Only) The application ID provided by Photon (read **Step 4** above for more info) | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | ==== LAN Games ==== | + | |
- | + | ||
- | **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 '' | + | |
- | + | ||
- | **Lan Discovery Port:** The port used in the network to search for games. | + | |
- | + | ||
- | **Lan Discovery Broadcast Interval:** The interval for the host to broadcast its signal. | + | |
- | + | ||
- | **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. | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | ==== Animation Control ==== | + | |
- | + | ||
- | **Fake Network:** Toggle to run local network packaging tests. It forces local PvP matches to emulate a network game. Useful to test the Netcode without running 2 clients. | + | |
- | + | ||
- | **Force UFE Animation Control:** UFE Netcode works by forcing a full synchronization between 2 clients. To ensure there are no desyncs, toggle this option to make it so the UFE Engine is always in charge of the [[character: | + | |
- | + | ||
- | **Disable Blending:** Override all animation blending states to be 0. Using this feature helps you " | + | |
- | + | ||
- | **Disable Rotation Blend:** (Mecanim only) Override the blending done during rotation to 0. | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | ==== Package Options ==== | + | |
- | + | ||
- | **Network Message Size:** How big should the package be. If your game only uses 4 buttons, use 8 bits. Use 16 bits for more than 4, and 32 bits if you plan to use more than 12 buttons or if you need to send different data through the same broadcast system (such as debug logs or sync checks). | + | |
- | + | ||
- | **Broadcast Frequency: | + | |
- | + | ||
- | **Only Send Input Changes:** If enable, the network will only send data that has been changed (instead of sending every broadcast frequency tick) | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | ==== Rollback Netcode ==== | + | |
- | + | ||
- | **Allow Rollbacks: | + | |
- | + | ||
- | **Track UFE Variables: | + | |
- | + | ||
- | **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. | + | |
- | + | ||
- | **Input Buffer Size:** The amount of inputs that can be stored and reproduced in case of a rollback. | + | |
- | + | ||
- | **Spawn Buffer Size:** The amount of game objects that can be stored in a "safe pool" before they get //garbage collected// | + | |
- | + | ||
- | **Rollback Balancing: | + | |
- | * // | + | |
- | * // | + | |
- | * // | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | ==== Frame Delay Netcode ==== | + | |
- | + | ||
- | **Frame Delay Type:** If set to '' | + | |
- | + | ||
- | **Min Frame Delay:** When connection is //ideal// (<10ms ping) what is the best value for //minimum// input delay in your game? Large values makes the game more tolerant to lag spikes. On ideal connections it's recommended that you leave at least 4 frames (for 60 fps) or 3 (for 30 fps) - according to your [[global: | + | |
- | If you are using Rollback, the game will always attempt to use this value. Games less dependent on animation blending (such as 2D) can try for lower values, while games more dependent on hardware optimization (or better visual fidelity) should try for higher. | + | |
- | + | ||
- | **Max Frame Delay:** In case of bad connections, | + | |
- | + | ||
- | **Apply Frame Delay Offline:** Makes it so every game (including CPU matches and Training Mode) are always running with the '' | + | |
Line 252: | Line 179: | ||
====== 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' | ||
* Make sure your moves don't have empty references when using '' | * Make sure your moves don't have empty references when using '' | ||
* The '' | * The '' | ||
Line 261: | Line 187: | ||
---- | ---- | ||
- | [[global:start|< Back to Global Editor]] | + | [[global:network|< Back to Network]] |