-
Notifications
You must be signed in to change notification settings - Fork 136
Feat: Readme Updates [MTT-5460] #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
6973898
8b086c4
a5ca036
4b439e8
328fa4d
4e870d0
9f5294d
43fad9a
291b4b2
dfe22a1
00c5269
7cd2ab7
3872aa9
96438a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,28 @@ | ||
## 2D Space Shooter | ||
# 2D Space Shooter | ||
|
||
This is a UNet sample project converted to Netcode for GameObjects. | ||
 | ||
 | ||
[](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 | ||
- Managing health and a list of buffs for your players in a multiplayer game | ||
In this sample, learn more about: | ||
|
||
- 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 | ||
jilfranco-unity marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<br><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> | ||
|
||
|
||
## Future Work | ||
- Add a way to assign a player name to each player. | ||
[](https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-introduction) | ||
jilfranco-unity marked this conversation as resolved.
Show resolved
Hide resolved
|
||
[](https://forum.unity.com/forums/multiplayer.26/) | ||
[](https://discord.gg/FM8SE9E) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,27 @@ | ||
# 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 | ||
 | ||
 | ||
[](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. | ||
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. | ||
# Sample Overview | ||
jilfranco-unity marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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> | ||
|
||
## 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> | ||
|
||
[](https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-introduction) | ||
[](https://forum.unity.com/forums/multiplayer.26/) | ||
[](https://discord.gg/FM8SE9E) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.