Feat: Readme Updates [MTT-5460] (#96)

* Readme updates

* more github readme updates

* in editor readme for dynamic prefabs--will update temporary image

* readme updates, comments addressed

* little readme updates with what to do in each scene for the other bitesize samples

* Update Basic/DynamicAddressablesNetworkPrefabs/README.md

Co-authored-by: Sam Bellomo <71790295+SamuelBellomo@users.noreply.github.com>

* Update Basic/DynamicAddressablesNetworkPrefabs/README.md

Co-authored-by: Sam Bellomo <71790295+SamuelBellomo@users.noreply.github.com>

* Update Basic/2DSpaceShooter/README.md

* readme updates

* version update to 1.2.0 and some tiny in project readme edits to bring them on par with the gihub ones

* updated readme image to match current UI

* okay updated again to this cuter version

---------

Co-authored-by: Sam Bellomo <71790295+SamuelBellomo@users.noreply.github.com>
This commit is contained in:
Jil Franco 2023-02-16 18:51:31 -05:00 коммит произвёл GitHub
Родитель 391df999f2
Коммит fe1ed7124c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
23 изменённых файлов: 791 добавлений и 63 удалений

Просмотреть файл

@ -24,7 +24,10 @@ MonoBehaviour:
url: https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-spaceshooter/index.html url: https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-spaceshooter/index.html
- heading: - heading:
text: The entry scene for this game is the network scene. From there a game can text: The entry scene for this game is the network scene. From there a game can
be hosted or an existing game can be joined. be hosted or an existing game can be joined. Control the ship using WASD and
shoot asteroids (or other players!) using the spacebar. Fly over pickups in
the scene to get different temporary buffs for your ship (like increased fly
speed or shooting extra bullets).
linkText: linkText:
url: url:
- heading: - heading:

Просмотреть файл

@ -134,7 +134,7 @@ PlayerSettings:
16:10: 1 16:10: 1
16:9: 1 16:9: 1
Others: 1 Others: 1
bundleVersion: 1.1.0 bundleVersion: 1.2.0
preloadedAssets: [] preloadedAssets: []
metroInputSource: 1 metroInputSource: 1
wsaTransparentSwapchain: 0 wsaTransparentSwapchain: 0

Просмотреть файл

@ -1,14 +1,41 @@
## 2D Space Shooter # 2D Space Shooter
This is a UNet sample project converted to Netcode for GameObjects. ![UnityVersion](https://img.shields.io/badge/Unity%20Version:-2021.3%20LTS-57b9d3.svg?logo=unity&color=2196F3)
![NetcodeVersion](https://img.shields.io/badge/Netcode%20Version:-1.2.0-57b9d3.svg?logo=unity&color=2196F3)
[![LatestRelease](https://img.shields.io/badge/Latest%20%20Github%20Release:-v1.2.0-57b9d3.svg?logo=github&color=brightgreen)](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize/releases/tag/v1.2.0)
<br><br>
## Sample Features This is a UNet sample project converted to Netcode for GameObjects. The 2DSpaceShooter sample is a bitesize sample designed to demonstrate networked 2D and physics-based character movement.
<br><br>
This sample shows you: # Sample Overview
- Server authorative physics based movement In this sample, learn more about:
- Managing health and a list of buffs for your players in a multiplayer game
- Server authorative physics based movement using Netcode for GameObject's `NetworkRigidbody2D` component
- Managing health and a list of buffs for your players in a multiplayer game with a `NetworkVariable`
- How to pool network objects such as bullets and asteroids to improve performance - How to pool network objects such as bullets and asteroids to improve performance
<br><br>
---
### 💡 Documentation
Check out our [Bitesize Samples documentation](https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-introduction) for a more in-depth technical breakdown of our engineering decisions and why the sample works the way it does.
## Future Work ---
- Add a way to assign a player name to each player. <br>
## Exploring the Sample
The entry scene for this game is the network scene. From there a game can be hosted or an existing game can be joined. Control the ship using WASD and shoot asteroids (or other players!) using the spacebar. Fly over pickups in the scene to get different temporary buffs for your ship (like increased fly speed or shooting extra bullets).
<br><br>
---
### 💡 Bitesize Readme
Check out our main [Bitesize Samples GitHub Readme](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize#readme) for more documentation, resources, releases, contribution guidelines, and our feedback form.
---
<br>
[![Documentation](https://img.shields.io/badge/Unity-bitesize--docs-57b9d3.svg?logo=unity&color=2196F3)](https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-introduction)
[![Forums](https://img.shields.io/badge/Unity-multiplayer--forum-57b9d3.svg?logo=unity&color=2196F3)](https://forum.unity.com/forums/multiplayer.26/)
[![Discord](https://img.shields.io/discord/449263083769036810.svg?label=discord&logo=discord&color=5865F2)](https://discord.gg/FM8SE9E)

Просмотреть файл

@ -26,7 +26,10 @@ MonoBehaviour:
url: https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-clientdriven/index.html url: https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-clientdriven/index.html
- heading: - heading:
text: The entry scene for this game is the Bootstrap scene. From there a game text: The entry scene for this game is the Bootstrap scene. From there a game
can be hosted or an existing game can be joined. can be hosted or an existing game can be joined. Run around the scene using
WASD, and pick up orbs using the spacebar. Convert orbs from one color to another
by dropping them in the converters in the middle of the level. Deposit orbs
into the drop spots of the same color to earn points.
linkText: linkText:
url: url:
- heading: - heading:

Просмотреть файл

@ -134,7 +134,7 @@ PlayerSettings:
16:10: 1 16:10: 1
16:9: 1 16:9: 1
Others: 1 Others: 1
bundleVersion: 1.1.0 bundleVersion: 1.2.0
preloadedAssets: preloadedAssets:
- {fileID: 11400000, guid: 9e7be553448fa2546aea5752021cbcf7, type: 2} - {fileID: 11400000, guid: 9e7be553448fa2546aea5752021cbcf7, type: 2}
metroInputSource: 0 metroInputSource: 0

Просмотреть файл

@ -1,9 +1,40 @@
# Client Driven # Client Driven
This is a sample project oriented to Client Driven behaviour using Netcode for GameObjects. In this sample you will learn more about Client driven movements, networked physics, spawning vs statically placed objects, object reparenting ![UnityVersion](https://img.shields.io/badge/Unity%20Version:-2021.3%20LTS-57b9d3.svg?logo=unity&color=2196F3)
![NetcodeVersion](https://img.shields.io/badge/Netcode%20Version:-1.2.0-57b9d3.svg?logo=unity&color=2196F3)
[![LatestRelease](https://img.shields.io/badge/Latest%20%20Github%20Release:-v1.2.0-57b9d3.svg?logo=github&color=brightgreen)](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize/releases/tag/v1.2.0)
<br><br>
## Sample feature The ClientDriven sample is a sample project made with Netcode for GameObjects designed to demonstrate responsive 3rd-person WASD character movements even under unfavourable network conditions.
<br><br>
Making movements feel responsive while staying consistent over multiple game executables is a challenge for many networked games. ClientDriven's aim is to create a quick sample to show responsive character movements that don't feel sluggish, even under bad network conditions. # Sample Overview
It also provides a client side object detection with server side pickup, showing client driven patterns and networked object reparenting.
These physics objects are spawned server side at regular intervals and can be pushed around by client driven players. In this sample, learn more about:
- Client driven movements
- Networked physics
- Spawning vs in-scene placed `NetworkObjects`
- `NetworkObject` parenting (client side object detection with server side pickup)
<br><br>
---
### 💡 Documentation
Check out our [Bitesize Samples documentation](https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-introduction) for a more in-depth technical breakdown of our engineering decisions and why the sample works the way it does.
---
<br>
## Exploring the Sample
The entry scene for this game is the Bootstrap scene. From there a game can be hosted or an existing game can be joined. Run around the scene using WASD, and pick up orbs using the spacebar. Convert orbs from one color to another by dropping them in the converters in the middle of the level. Deposit orbs into the drop spots of the same color to earn points.
<br><br>
---
### 💡 Bitesize Readme
Check out our main [Bitesize Samples GitHub Readme](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize#readme) for more documentation, resources, releases, contribution guidelines, and our feedback form.
---
<br>
[![Documentation](https://img.shields.io/badge/Unity-bitesize--docs-57b9d3.svg?logo=unity&color=2196F3)](https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-introduction)
[![Forums](https://img.shields.io/badge/Unity-multiplayer--forum-57b9d3.svg?logo=unity&color=2196F3)](https://forum.unity.com/forums/multiplayer.26/)
[![Discord](https://img.shields.io/discord/449263083769036810.svg?label=discord&logo=discord&color=5865F2)](https://discord.gg/FM8SE9E)

Просмотреть файл

@ -0,0 +1,83 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5ce0e387261ddc34ba81ca7f2f1f7f73, type: 3}
m_Name: Readme
m_EditorClassIdentifier:
icon: {fileID: 2800000, guid: 06a678a9706d69242bc9e034adc27168, type: 3}
title: 'Dynamic Prefabs: A Bitesize Sample'
sections:
- heading:
text:
linkText:
url:
- heading: 'Exploring the Sample:'
text:
linkText:
url:
- heading:
text: 'The Dynamic Prefabs sample showcases the available use-cases for the dynamic
prefab system, which allows us to add new spawnable prefabs at runtime. '
linkText:
url:
- heading:
text: Each scene in the project showcases a different, isolated feature of the
API, allowing for easy extraction into other projects. We suggest exploring
them in sequential order to get an understanding of the flow of dynamically
loading and spawning network prefabs.
linkText:
url:
- heading:
text: Scenes 00-04 showcase example use-cases for the Dynamic Prefabs system,
and scene 05 serves as an API playground to test how all of the use-cases in
can work tandem. Please see our code comments for implemetation details on
each use-case.
linkText:
url:
- heading: ' '
text:
linkText:
url:
- heading:
text: This sample also uses in-game UI (created using UI Toolkit) to interface
with the dynamic prefabs system with configurable options like artificial latency
and network spawn timeout for easy testing.
linkText:
url:
- heading: ' '
text:
linkText:
url:
- heading: 'To Learn More:'
text:
linkText:
url:
- heading:
text: For more information about this bitesize sample, check out the
linkText: Dynamic Prefabs bitesize sample documentation,
url: https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-dynamicprefabs/index.html
- heading:
text: 'as well as the GitHub repo Readme from the '
linkText: Bitesize Samples public GitHub repository.
url: https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize
- heading:
text: Read more about Netcode and its built-in features from the
linkText: Netcode documentation.
url: https://docs-multiplayer.unity3d.com/
- heading: ' '
text:
linkText:
url:
- heading:
text: Also, check out our
linkText: Multiplayer Discord!
url: https://discord.gg/FM8SE9E
loadedLayout: 1

Просмотреть файл

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a9dc759e946e7974a9c7d423ecfea830
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c24ea5d585cf03c4288399e8770bd7a1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 52946d0b900eb9e48874410656f8e713
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -0,0 +1,186 @@
using UnityEngine;
using UnityEditor;
using System;
using System.IO;
using System.Reflection;
/// <remarks>
/// Custom readme editor window based on the readme created for URP. For more context, see:
/// https://github.com/Unity-Technologies/Graphics/tree/master/com.unity.template-universal
/// </remarks>
namespace Game.Readme
{
[CustomEditor(typeof(Readme))]
[InitializeOnLoad]
public class ReadmeEditor : UnityEditor.Editor
{
const string k_ShowedReadmeSessionStateName = "ReadmeEditor.showedReadme";
const float k_Space = 16f;
bool m_Initialized;
[SerializeField]
GUIStyle m_LinkStyle;
GUIStyle LinkStyle
{
get { return m_LinkStyle; }
}
[SerializeField]
GUIStyle m_TitleStyle;
GUIStyle TitleStyle
{
get { return m_TitleStyle; }
}
[SerializeField]
GUIStyle m_HeadingStyle;
GUIStyle HeadingStyle
{
get { return m_HeadingStyle; }
}
[SerializeField]
GUIStyle m_BodyStyle;
GUIStyle BodyStyle
{
get { return m_BodyStyle; }
}
static ReadmeEditor()
{
EditorApplication.delayCall += SelectReadmeAutomatically;
}
static void SelectReadmeAutomatically()
{
if (!SessionState.GetBool(k_ShowedReadmeSessionStateName, false))
{
var readme = SelectReadme();
SessionState.SetBool(k_ShowedReadmeSessionStateName, true);
if (readme && !readme.loadedLayout)
{
LoadLayout();
readme.loadedLayout = true;
}
}
}
static void LoadLayout()
{
var assembly = typeof(EditorApplication).Assembly;
var windowLayoutType = assembly.GetType("UnityEditor.WindowLayout", true);
var method = windowLayoutType.GetMethod("LoadWindowLayout", BindingFlags.Public | BindingFlags.Static);
method?.Invoke(null, new object[] {Path.Combine(Application.dataPath, "TutorialInfo/Layout.wlt"), false});
}
[MenuItem("Sample/Show Sample Instructions")]
static Readme SelectReadme()
{
var ids = AssetDatabase.FindAssets("Readme t:Readme");
if (ids.Length == 1)
{
var readmeObject = AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GUIDToAssetPath(ids[0]));
Selection.objects = new UnityEngine.Object[] {readmeObject};
return (Readme) readmeObject;
}
else
{
Debug.Log("Couldn't find a readme");
return null;
}
}
protected override void OnHeaderGUI()
{
var readme = (Readme) target;
Init();
var iconWidth = Mathf.Min(EditorGUIUtility.currentViewWidth / 3f - 20f, 128f);
GUILayout.BeginHorizontal("In BigTitle");
{
GUILayout.Label(readme.icon, GUILayout.Width(iconWidth), GUILayout.Height(iconWidth));
GUILayout.Label(readme.title, TitleStyle);
}
GUILayout.EndHorizontal();
}
public override void OnInspectorGUI()
{
var readme = (Readme) target;
Init();
foreach (var section in readme.sections)
{
if (!string.IsNullOrEmpty(section.heading))
{
GUILayout.Label(section.heading, HeadingStyle);
}
if (!string.IsNullOrEmpty(section.text))
{
GUILayout.Label(section.text, BodyStyle);
}
if (!string.IsNullOrEmpty(section.linkText))
{
if (LinkLabel(new GUIContent(section.linkText)))
{
Application.OpenURL(section.url);
}
}
GUILayout.Space(k_Space);
}
}
void Init()
{
if (m_Initialized)
return;
m_BodyStyle = new GUIStyle(EditorStyles.label);
m_BodyStyle.wordWrap = true;
m_BodyStyle.fontSize = 14;
m_TitleStyle = new GUIStyle(m_BodyStyle);
m_TitleStyle.fontSize = 26;
m_HeadingStyle = new GUIStyle(m_BodyStyle);
m_HeadingStyle.fontSize = 18;
m_LinkStyle = new GUIStyle(m_BodyStyle);
m_LinkStyle.wordWrap = false;
// Match selection color which works nicely for both light and dark skins
m_LinkStyle.normal.textColor = new Color(0x00 / 255f, 0x78 / 255f, 0xDA / 255f, 1f);
m_LinkStyle.stretchWidth = false;
m_Initialized = true;
}
bool LinkLabel(GUIContent label, params GUILayoutOption[] options)
{
var position = GUILayoutUtility.GetRect(label, LinkStyle, options);
Handles.BeginGUI();
Handles.color = LinkStyle.normal.textColor;
Handles.DrawLine(new Vector3(position.xMin, position.yMax), new Vector3(position.xMax, position.yMax));
Handles.color = Color.white;
Handles.EndGUI();
EditorGUIUtility.AddCursorRect(position, MouseCursor.Link);
return GUI.Button(position, label, LinkStyle);
}
}
}

Просмотреть файл

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fab904a2239c0154c88b5fc1eb15a624
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -0,0 +1,30 @@
using System;
using UnityEngine;
/// <remarks>
/// Custom readme class based on the readme created for URP. For more context, see:
/// https://github.com/Unity-Technologies/Graphics/tree/master/com.unity.template-universal
/// </remarks>
namespace Game.Readme
{
[CreateAssetMenu]
public class Readme : ScriptableObject
{
public Texture2D icon;
public string title;
public Section[] sections;
public bool loadedLayout;
[Serializable]
public class Section
{
public string heading;
public string text;
public string linkText;
public string url;
}
}
}

Просмотреть файл

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5ce0e387261ddc34ba81ca7f2f1f7f73
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 86 KiB

Просмотреть файл

@ -0,0 +1,123 @@
fileFormatVersion: 2
guid: 06a678a9706d69242bc9e034adc27168
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -134,7 +134,7 @@ PlayerSettings:
16:10: 1 16:10: 1
16:9: 1 16:9: 1
Others: 1 Others: 1
bundleVersion: 0.1 bundleVersion: 1.2.0
preloadedAssets: [] preloadedAssets: []
metroInputSource: 0 metroInputSource: 0
wsaTransparentSwapchain: 0 wsaTransparentSwapchain: 0
@ -155,7 +155,7 @@ PlayerSettings:
androidSupportedAspectRatio: 1 androidSupportedAspectRatio: 1
androidMaxAspectRatio: 2.1 androidMaxAspectRatio: 2.1
applicationIdentifier: applicationIdentifier:
Standalone: com.Unity.DynamicAddressableNetworkPrefabs Standalone: com.Unity.DynamicAddressablesNetworkPrefabs
buildNumber: buildNumber:
Standalone: 0 Standalone: 0
iPhone: 0 iPhone: 0

Просмотреть файл

@ -1,27 +1,127 @@
# Dynamic Prefabs # Dynamic Addressables Network Prefabs Sample
This sample showcases the available use-cases for the dynamic prefab system, which allows us to add new spawnable prefabs in runtime. ![UnityVersion](https://img.shields.io/badge/Unity%20Version:-2021.3%20LTS-57b9d3.svg?logo=unity&color=2196F3)
![NetcodeVersion](https://img.shields.io/badge/Netcode%20Version:-1.2.0-57b9d3.svg?logo=unity&color=2196F3)
[![LatestRelease](https://img.shields.io/badge/Latest%20%20Github%20Release:-v1.2.0-57b9d3.svg?logo=github&color=brightgreen)](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize/releases/tag/v1.2.0)
<br><br>
## Sample feature The Dynamic Prefabs Sample showcases the available use-cases for the dynamic prefab system, which allows us to add new spawnable prefabs at runtime. This sample uses Addressables to load the dynamic prefab, however any GameObject with a NetworkObject component can be used, regardless of its source. This sample also uses in-game UI (created using UI Toolkit) to interface with the dynamic prefabs system with configurable options like artificial latency and network spawn timeout for easy testing.
<br><br>
Dynamic prefabs feature allows the developer to add a new prefab to the network prefab list in runtime. # Sample Overview
For simplicity, this sample uses Addressables to load the dynamic prefab, however any GameObject with a NetworkObject component can be used, regardless of it's source (think User Generated Content (UGC)).
There are several limitations to this API: In this sample, learn more about:
- If you have NetworkConfig.ForceSamePrefabs enabled, you can only modify your prefab lists before starting - The dynamic prefabs system
- Loading prefabs with addressables
<br><br>
---
### 💡 Documentation
Check out our [Bitesize Samples documentation](https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-introduction) for a more in-depth technical breakdown of our engineering decisions and why the sample works the way it does.
---
<br>
## Exploring the Sample
Each scene in the project showcases a different, isolated feature of the API, allowing for easy extraction into other projects. We suggest exploring them in order to get a good understanding of the flow of dynamically loading and spawning network prefabs. The use-cases available in this sample are based around the current known limitations.
<br><br>
### Each Scene:
- Scene 00_Preloading Dynamic Prefabs
- This is the simplest case of a dynamic prefab - we instruct all game instances to load a network prefab (it can be just one, it could also be a set of network prefabs) and inject them to NetworkManager's NetworkPrefabs list before starting the server.
- This is the less intrusive option for your development, as you don't have any additional spawning and addressable management to do later in your game.
<br><br>
- Scene 01_Connection Approval Required For Late Joining
- An optional use-case scenario that walks through what a server would need to validate from a connecting client when dynamically loading network prefabs. Other use-cases don't allow for reconciliation after the server has loaded a prefab dynamically and before a client joined, whereas this one enables this functionality.
- This is to support late join and should be used in combination with the other techniques described below.
<br><br>
- Scene 02_Server Authoritative Preload All Prefabs Asynchronously
- A simple use-case where the server notifies all clients to preload a collection of network prefabs. The server will not invoke a spawn directly after the addressable loading in this use-case, and will incrementally load each dynamic prefab, one prefab at a time.
- This acts as a "warning" notification to clients that they'll soon need this prefab. This allows being less intrusive in the spawning process later as we can assume all clients have loaded the prefab already.
- This is different from option 0, as here this is done when clients are connected and already in game. This allows for more flexibility around your gameplay and could load different prefabs depending on where your players are at in the game for example.
<br><br>
- Scene 03_Server Authoritative Try Spawn Synchronously
- This is the first technique that loads and spawns sequentially. This is a dynamic prefab loading use-case where the server instructs all clients to load a single network prefab, and will only invoke a spawn once all clients have successfully completed their respective loads of said prefab. The server will initially send a ClientRpc to all clients, begin loading the prefab on the server, will await acknowledgement of a load via ServerRpcs from each client, and will only Spawn() the instantiated prefab over the network once it has received an acknowledgement from every client, within `m_SynchronousSpawnTimeoutTimer` seconds.
- This and the next technique allow for the most flexibility compared to the previous ones.
- This technique makes sure all clients have loaded a prefab before spawning and starting gameplay on that prefab. This is useful for game changing objects, like a big boss that could kill everyone. In that case you want to make sure all clients have loaded that prefab before spawning that object.
<br><br>
- Scene 04_Server Authoritative Spawn Dynamic Prefab Using Network Visibility
- A dynamic prefab loading use-case where the server instructs all clients to load a single network prefab via a ClientRpc, will spawn said prefab as soon as it is loaded on the server, and will mark it as network-visible only to clients that have already loaded that same prefab. As soon as a client loads the prefab locally, it sends an acknowledgement ServerRpc, and the server will mark that spawned NetworkObject as network-visible to that client.
- This makes sure that no client can block the spawn of certain objects by making it visible as soon as specific clients have loaded that prefab. This is great for network reactivity, but might create inconsistent world views for each client depending on whether you've loaded that prefab or not. Using that technique for boss loading could create a situation where your player sees its health decreasing rapidly for no visible reason because the boss is loaded server side and hitting you, but you haven't loaded it yet and it's invisible on your client.
<br><br>
- Scene 05_API Playground Showcasing All Post-Connection Use-Cases
This scene serves as an API playground to test how all of the use-cases can work in tandem.
<br><br><br>
## Known Limitations
- If you have NetworkConfig.ForceSamePrefabs enabled, you can only modify your prefab lists **before** starting
networking, and the server and all connected clients must all have the same exact set of prefabs networking, and the server and all connected clients must all have the same exact set of prefabs
added via this method before connecting added via this method before connecting.
- Adding a prefab on the server does not automatically add it on the client - it's up to you
to make sure the client and server are synchronized via whatever method makes sense for your game - Adding a prefab on the server **does not** automatically add it on the client - it's up to you
(RPCs, configs, deterministic loading, etc) to make sure the client and server are synchronized via whatever method makes sense for your game
- If the server sends a Spawn message to a client that has not yet added a prefab for, the spawn message (RPCs, configs, deterministic loading, etc). This sample lists some of those possible methods with basic implementations you can adapt to your various use cases.
and any other relevant messages will be held for a configurable time (default 1 second, configured via
NetworkConfig.SpawnTimeout) before an error is logged. This is intented to enable the SDK to gracefully - If the server sends a Spawn message to a client that does not yet have the corresponding prefab loaded, the spawn message
handle unexpected conditions (slow disks, slow network, etc) that slow down asset loading. This timeout (and any other relevant messages) will be held for a configurable time before an error is logged (default 1 second, configured via
should not be relied on and code shouldn't be written around it - your code should be written so that NetworkConfig.SpawnTimeout). This is intented to enable the SDK to gracefully
the asset is expected to be loaded before it's needed. handle unexpected conditions that slow down asset loading (slow disks, slow network, etc). This timeout
- Currently it's impossible to latejoin for clients after a dynamic prefab has been spawned by the server. The reason for this is that the initial sync doesn't allow us any time to load prefabs that are yet absent on the client. should not be relied upon and code shouldn't be written around it - your code should be written so that
the asset is expected to be loaded before it's needed.
<br><br>
## Index of Resources
### Dynamic Prefabs System
- Preloading Dynamic Prefabs - [Assets/Scripts/00_Preloading/Preloading.cs](Assets/Scripts/00_Preloading/Preloading.cs)
- Connection Approval supporting late join - [Assets/Scripts/01_Connection Approval/ConnectionApproval.cs](Assets/Scripts/01_ConnectionApproval/ConnectionApproval.cs)
- Server Authoritative Preloading All Prefabs Asynchronously - [Assets/Scripts/02_Server Authoritative Load All Async/ServerAuthoritativeLoadAllAsync.cs](Assets/Scripts/02_ServerAuthoritativeLoadAllAsync/ServerAuthoritativeLoadAllAsync.cs)
- Server Authoritative Try Spawning Synchronously - [Assets/Scripts/03_Server Authoritative Synchronous Spawning/ServerAuthoritativeSynchronousSpawning.cs](Assets/Scripts/03_ServerAuthoritativeSynchronousSpawning/ServerAuthoritativeSynchronousSpawning.cs)
- Server Authoritative Spawn using Network-Visibility - [Assets/Scripts/04_Server Authoritative Network-Visibility Spawning/ServerAuthoritativeNetworkVisibilitySpawning.cs](Assets/Scripts/04_ServerAuthoritativeNetwork-VisibilitySpawning/ServerAuthoritativeNetworkVisibilitySpawning.cs)
### UI
- In Game UI - [Assets/Scripts/UI/IPMenuUI.cs](Assets/Scripts/UI/IPMenuUI.cs)
### Addressables
- Package version - [Packages/manifest.json](Packages/manifest.json)
- Docs - https://docs.unity3d.com/Packages/com.unity.addressables@1.19/manual/index.html
<br><br>
## Future Improvement Ideas
This section describes some next steps a game developer could do to extend the sample code available here. This logic is left to the reader, this sample focuses on dynamic prefab management.
<br><br>
- Adding more advanced logic that would kick players that are consistently failing to load required Addressables.
- Compress Addressable GUID list before it is sent, thus reducing the amount of data being exchanged.
- Rather than exchanging Addressable GUIDS, the peers exchange a `short` index that would refer to Addressables
stored (in some sort of list) in a ScriptableObject, thus drastically reducing the amount of data being exchanged.
<br><br>
---
### 💡 Bitesize Readme
Check out our main [Bitesize Samples GitHub Readme](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize#readme) for more documentation, resources, releases, contribution guidelines, and our feedback form.
---
[![Documentation](https://img.shields.io/badge/Unity-bitesize--docs-57b9d3.svg?logo=unity&color=2196F3)](https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-introduction)
[![Forums](https://img.shields.io/badge/Unity-multiplayer--forum-57b9d3.svg?logo=unity&color=2196F3)](https://forum.unity.com/forums/multiplayer.26/)
[![Discord](https://img.shields.io/discord/449263083769036810.svg?label=discord&logo=discord&color=5865F2)](https://discord.gg/FM8SE9E)
Based on these limitations the following use cases are covered in the sample:
- PreloadingSample.cs - this is the simplest case of a dynamic prefab - we just add it to the list of prefabs before we connect on all the peers
- AppController.cs and DynamicPrefabManager.cs - this is a more complex case where the server spawns things that the client haven't yet loaded. There are two loading strategies - one is "synchronous" spawning, which ensures that all clients have acknowledged that they have loaded that prefab before the server actually spawns the NetworkObject. The other one is spawning the object immediately and using visibility system to hide that object from clients that haven't loaded the prefab yet (when they do acknowledge the prefab loading - the server will show the relevant hidden objects to the client). This sample also shows how we could handle the issue with initial synchronization breaking for late joiners by using some custom logic in connection approval delegate.

Просмотреть файл

@ -24,7 +24,9 @@ MonoBehaviour:
url: https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-invaders url: https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-invaders
- heading: - heading:
text: The entry scene for this game is the InitBootStrap scene. From there a text: The entry scene for this game is the InitBootStrap scene. From there a
game can be hosted or an existing game can be joined. game can be hosted or an existing game can be joined. Move back and forth using
the A and D keys, and shoot using the spacebar. Shoot enemies to gain points,
and avoid their bullets to avoid losing health (and eventually losing)!
linkText: linkText:
url: url:
- heading: - heading:

Просмотреть файл

@ -134,7 +134,7 @@ PlayerSettings:
16:10: 1 16:10: 1
16:9: 1 16:9: 1
Others: 1 Others: 1
bundleVersion: 1.1.0 bundleVersion: 1.2.0
preloadedAssets: [] preloadedAssets: []
metroInputSource: 0 metroInputSource: 0
wsaTransparentSwapchain: 0 wsaTransparentSwapchain: 0

Просмотреть файл

@ -1,12 +1,40 @@
# Invaders # Invaders
This is a UNet sample project converted to Netcode for GameObjects. ![UnityVersion](https://img.shields.io/badge/Unity%20Version:-2021.3%20LTS-57b9d3.svg?logo=unity&color=2196F3)
![NetcodeVersion](https://img.shields.io/badge/Netcode%20Version:-1.2.0-57b9d3.svg?logo=unity&color=2196F3)
[![LatestRelease](https://img.shields.io/badge/Latest%20%20Github%20Release:-v1.2.0-57b9d3.svg?logo=github&color=brightgreen)](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize/releases/tag/v1.2.0)
<br><br>
## Sample Features This is a UNet sample project converted to Netcode for GameObjects. The Invaders sample is a sample project designed to demonstrate game flows and game modes.
<br><br>
This sample shows you: # Sample Overview
In this sample, learn more about:
- Simple start, lobby, and finish flow with Netcode for GameObjects using Scene Management - Simple start, lobby, and finish flow with Netcode for GameObjects using Scene Management
- Unconventional movement networked - Unconventional movement networked
- Client driven movement with Client Network Transform - Client driven movement with Client Network Transform
- Shared timer between clients in a client-sided predicted way - Shared timer between clients in a client-sided predicted way
<br><br>
---
### 💡 Documentation
Check out our [Bitesize Samples documentation](https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-introduction) for a more in-depth technical breakdown of our engineering decisions and why the sample works the way it does.
---
<br>
## Exploring the Sample
The entry scene for this game is the InitBootStrap scene. From there a game can be hosted or an existing game can be joined. Move back and forth using the A and D keys, and shoot using the spacebar. Shoot enemies to gain points, and avoid their bullets to avoid losing health (and eventually losing)!
<br><br>
---
### 💡 Bitesize Readme
Check out our main [Bitesize Samples GitHub Readme](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize#readme) for more documentation, resources, releases, contribution guidelines, and our feedback form.
---
<br>
[![Documentation](https://img.shields.io/badge/Unity-bitesize--docs-57b9d3.svg?logo=unity&color=2196F3)](https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-introduction)
[![Forums](https://img.shields.io/badge/Unity-multiplayer--forum-57b9d3.svg?logo=unity&color=2196F3)](https://forum.unity.com/forums/multiplayer.26/)
[![Discord](https://img.shields.io/discord/449263083769036810.svg?label=discord&logo=discord&color=5865F2)](https://discord.gg/FM8SE9E)

102
README.md
Просмотреть файл

@ -1,35 +1,101 @@
![Banner](Resources/bitesize_banner.png)
<br><br>
# Netcode for GameObjects Bitesize Samples # Netcode for GameObjects Bitesize Samples
|Unity Version|Netcode Version| ![UnityVersion](https://img.shields.io/badge/Unity%20Version:-2021.3%20LTS+-57b9d3.svg?logo=unity&color=2196F3)
|:-------:|:-------:| ![NetcodeVersion](https://img.shields.io/badge/Netcode%20Version:-1.2.0+-57b9d3.svg?logo=unity&color=2196F3)
|2020.3|1.0.0-pre| [![LatestRelease](https://img.shields.io/badge/Latest%20%20Github%20Release:-v1.2.0-57b9d3.svg?logo=github&color=brightgreen)](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize/releases/tag/v1.2.0)
<br><br>
This repository contains a collection of bitesize sample projects and games that showcase different This repository contains a collection of bitesize sample projects and games that showcase different
sub-features of Netcode. You can review these samples with [documentation](https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-introduction) to better understand APIs and features. which can help you get started with development of a multiplayer
project using [Netcode for GameObjects](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects).
<br><br>
## Who is this for? # Bitesize Samples Overview
The samples in this repository help you get started with development of a multiplayer ### 2D Space Shooter Overview
project using [Netcode for GameObjects](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects).
The [2D Space Shooter Sample](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize/tree/main/Basic/2DSpaceShooter) was a UNet sample that has been converted over to NGO. Check it out to learn more about physics movement and status effects using Netcode `NetworkVariables` and `ObjectPooling`.
<br><br>
### Invaders Overview
The [Invaders Sample](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize/tree/main/Basic/Invaders) was a UNet sample that has been converted over to NGO. Learn more about game flow, modes, unconventional networked movement, and using a shared timer in this sample.
<br><br>
### Client Driven Overview
See the [Client Driven Sample](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize/tree/main/Basic/ClientDriven) to learn about client driven movements, networked physics, spawning vs in-scene placed `NetworkObjects`, and `NetworkObject` parenting.
<br><br>
### Dynamic Addressables Network Prefabs Overview ![](https://img.shields.io/badge/New!-brightgreen)
Check out the new [Dynamic Addressables Network Prefabs Sample]() to learn more about the dynamic prefab system, which allows us to add new spawnable network prefabs at runtime.
<br><br>
---
## Readme Contents and Quick Links
<details open> <summary> Click to expand/collapse contents </summary>
- ### [Getting the Project](#getting-the-project)
- ### [Requirements](#requirements)
- ### [Troubleshooting](#troubleshooting)
- [Bugs](#bugs)
- [Documentation](#documentation)
- ### [Contributing](#contributing)
- ### [Community](#community)
- ### [Feedback Form](#feedback-form)
- ### [Other Samples](#other-samples)
- [Boss Room](#boss-room-sample)
</details>
---
<br><br>
## Getting the project
### Direct download
- You can download the latest versions of these samples from our [Releases](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize/releases/tag/v1.2.0) page
- __Alternatively:__ select `Code` and select the 'Download Zip' option. Please note that this will download the branch you're currently viewing on Github
<br><br>
## Requirements ## Requirements
You need Unity and Netcode for GameObjects installed to use these samples. Complete the [Hello World Getting Started](https://docs-multiplayer.unity3d.com/netcode/current/tutorials/helloworld) to prepare your environment. You can then access and use these samples for Netcode for GameObjects in a more self-contained scenario. The bitesize samples are compatible with the latest Unity Long Term Support (LTS) editor version, currently [2021 LTS](https://unity.com/releases/2021-lts). Please include standalone support for Windows/Mac in your installation.
## Community and Feedback **PLEASE NOTE:** You will also need Netcode for Game Objects to use these samples. Complete the [Hello World Getting Started](https://docs-multiplayer.unity3d.com/netcode/current/tutorials/helloworld) to prepare your environment.
<br><br>
For help, questions, networking advice or discussions about Netcode for GameObjects and its samples, please join our [Discord Community](https://discord.gg/FM8SE9E) or create a post in the [Unity Multiplayer Forum](https://forum.unity.com/forums/netcode-for-gameobjects.661/). ## Troubleshooting
### Bugs
- Report bugs in Boss Room using Github [issues](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop/issues)
- Report NGO bugs using NGO Github [issues](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects)
- Report Unity bugs using the [Unity bug submission process](https://unity3d.com/unity/qa/bug-reporting)
### Documentation
For a deep dive into Unity Netcode and Boss Room, visit our [documentation site](https://docs-multiplayer.unity3d.com/).
<br><br>
## Maintenance ## Community
For help, questions, networking advice, or discussions about Netcode for GameObjects and its samples, please join our [Discord Community](https://discord.gg/FM8SE9E) or create a post in the [Unity Multiplayer Forum](https://forum.unity.com/forums/netcode-for-gameobjects.661/).
The Netcode for GameObjects Bitesize Samples repository will be maintained and updated with the latest released Netcode for GameObjects version and Unity LTS version. See this readme and the [changelog](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize/blob/main/CHANGELOG.md) for supported versions. <br><br>
## Other samples
See our other samples for more multiplayer content
- [Boss Room a small scale coop game](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop/releases/latest)
## Contributing ## Contributing
We welcome your contributions to this sample code and objects. See our [contribution guidelines](CONTRIBUTING.md) for details. We welcome your contributions to this sample code and objects. See our [contribution guidelines](CONTRIBUTING.md) for details.
<br><br>
## Feedback ## Feedback
If you have tried these samples already, please follow the link to fill out your feedback: https://unitytech.typeform.com/bitesize - ETA: 1 min 30 secs. If you have tried these samples already, please consider leaving us feedback [here](https://unitytech.typeform.com/bitesize) --it will only take a couple of minutes. Thanks!
<br><br>
## Other samples
### Boss Room Sample
[Boss Room](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop/releases/latest) is a fully functional co-op multiplayer RPG made with Unity Netcode. It is an educational sample designed to showcase typical netcode patterns that are frequently featured in similar multiplayer games.
<br><br>
[![Documentation](https://img.shields.io/badge/Unity-bitesize--docs-57b9d3.svg?logo=unity&color=2196F3)](https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-introduction)
[![Forums](https://img.shields.io/badge/Unity-multiplayer--forum-57b9d3.svg?logo=unity&color=2196F3)](https://forum.unity.com/forums/multiplayer.26/)
[![Discord](https://img.shields.io/discord/449263083769036810.svg?label=discord&logo=discord&color=5865F2)](https://discord.gg/FM8SE9E)

Двоичные данные
Resources/bitesize_banner.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1000 KiB