├── .gitignore ├── Client ├── .gitattributes ├── .gitignore ├── .vscode │ ├── launch.json │ └── settings.json ├── Assets │ ├── Materials.meta │ ├── Materials │ │ ├── Server1.mat │ │ ├── Server1.mat.meta │ │ ├── Server2.mat │ │ └── Server2.mat.meta │ ├── Prefabs.meta │ ├── Prefabs │ │ ├── Player.meta │ │ └── Player │ │ │ ├── Alpha_Body_MAT.mat │ │ │ ├── Alpha_Body_MAT.mat.meta │ │ │ ├── Alpha_Body_MAT_other_players.mat │ │ │ ├── Alpha_Body_MAT_other_players.mat.meta │ │ │ ├── Player.prefab │ │ │ ├── Player.prefab.meta │ │ │ ├── PlayerController.controller │ │ │ ├── PlayerController.controller.meta │ │ │ ├── ybot@Idle.fbx │ │ │ ├── ybot@Idle.fbx.meta │ │ │ ├── ybot@Running.fbx │ │ │ └── ybot@Running.fbx.meta │ ├── Scenes.meta │ ├── Scenes │ │ ├── MainScene.unity │ │ ├── MainScene.unity.meta │ │ ├── Server1.unity │ │ ├── Server1.unity.meta │ │ ├── Server2.unity │ │ └── Server2.unity.meta │ ├── Scripts.meta │ ├── Scripts │ │ ├── AdditiveSceneLoader.cs │ │ ├── AdditiveSceneLoader.cs.meta │ │ ├── Networking.meta │ │ ├── Networking │ │ │ ├── ConnectionToServer.cs │ │ │ ├── ConnectionToServer.cs.meta │ │ │ ├── NetworkComponent.cs │ │ │ ├── NetworkComponent.cs.meta │ │ │ ├── NetworkIdentity.cs │ │ │ ├── NetworkIdentity.cs.meta │ │ │ ├── NetworkMessages.meta │ │ │ ├── NetworkMessages │ │ │ │ ├── DespawnMessage.cs │ │ │ │ ├── DespawnMessage.cs.meta │ │ │ │ ├── EnableMessage.cs │ │ │ │ ├── EnableMessage.cs.meta │ │ │ │ ├── NetworkMessage.cs │ │ │ │ ├── NetworkMessage.cs.meta │ │ │ │ ├── SpawnMessage.cs │ │ │ │ ├── SpawnMessage.cs.meta │ │ │ │ ├── TransformMessage.cs │ │ │ │ └── TransformMessage.cs.meta │ │ │ ├── NetworkTransform.cs │ │ │ └── NetworkTransform.cs.meta │ │ ├── Player.cs │ │ └── Player.cs.meta │ ├── Skybox.meta │ └── Skybox │ │ ├── Cartoon_Airbrush_Day_NoSun.mat │ │ ├── Cartoon_Airbrush_Day_NoSun.mat.meta │ │ ├── Cartoon_Airbrush_Day_NoSun.meta │ │ ├── Cartoon_Airbrush_Day_NoSun.unity │ │ ├── Cartoon_Airbrush_Day_NoSun.unity.meta │ │ ├── Cartoon_Airbrush_Day_NoSun │ │ ├── ReflectionProbe-0.exr │ │ └── ReflectionProbe-0.exr.meta │ │ ├── Sky_Cartoon_Airbrush_Day_NoSun_Cam_0_Front+Z.png │ │ ├── Sky_Cartoon_Airbrush_Day_NoSun_Cam_0_Front+Z.png.meta │ │ ├── Sky_Cartoon_Airbrush_Day_NoSun_Cam_1_Back-Z.png │ │ ├── Sky_Cartoon_Airbrush_Day_NoSun_Cam_1_Back-Z.png.meta │ │ ├── Sky_Cartoon_Airbrush_Day_NoSun_Cam_2_Left+X.png │ │ ├── Sky_Cartoon_Airbrush_Day_NoSun_Cam_2_Left+X.png.meta │ │ ├── Sky_Cartoon_Airbrush_Day_NoSun_Cam_3_Right-X.png │ │ ├── Sky_Cartoon_Airbrush_Day_NoSun_Cam_3_Right-X.png.meta │ │ ├── Sky_Cartoon_Airbrush_Day_NoSun_Cam_4_Up+Y.png │ │ ├── Sky_Cartoon_Airbrush_Day_NoSun_Cam_4_Up+Y.png.meta │ │ ├── Sky_Cartoon_Airbrush_Day_NoSun_Cam_5_Down-Y.png │ │ └── Sky_Cartoon_Airbrush_Day_NoSun_Cam_5_Down-Y.png.meta ├── Packages │ └── manifest.json └── ProjectSettings │ ├── AudioManager.asset │ ├── ClusterInputManager.asset │ ├── DynamicsManager.asset │ ├── EditorBuildSettings.asset │ ├── EditorSettings.asset │ ├── GraphicsSettings.asset │ ├── InputManager.asset │ ├── NavMeshAreas.asset │ ├── NetworkManager.asset │ ├── Physics2DSettings.asset │ ├── PresetManager.asset │ ├── ProjectSettings.asset │ ├── ProjectVersion.txt │ ├── QualitySettings.asset │ ├── TagManager.asset │ ├── TimeManager.asset │ └── UnityConnectSettings.asset ├── Images ├── 4Clients.png ├── ServerLogs.png ├── arch.png ├── distributed_concept.png └── goal_arch.png ├── README.md └── Server ├── .gitignore ├── makefile └── src ├── NetworkMessages ├── despawnMessage.hpp ├── enableMessage.hpp ├── networkMessage.hpp ├── spawnMessage.hpp └── transformMessage.hpp ├── game.cpp ├── game.hpp ├── login.cpp ├── login.hpp ├── main.cpp ├── player.cpp ├── player.hpp ├── playerThread.cpp ├── playerThread.hpp ├── server.cpp └── server.hpp /.gitignore: -------------------------------------------------------------------------------- 1 | .metadata 2 | bin/ 3 | tmp/ 4 | *.tmp 5 | *.bak 6 | *.swp 7 | *~.nib 8 | local.properties 9 | .settings/ 10 | .loadpath 11 | .recommenders 12 | 13 | # External tool builders 14 | .externalToolBuilders/ 15 | 16 | # Locally stored "Eclipse launch configurations" 17 | *.launch 18 | 19 | # PyDev specific (Python IDE for Eclipse) 20 | *.pydevproject 21 | 22 | # CDT-specific (C/C++ Development Tooling) 23 | .cproject 24 | 25 | # CDT- autotools 26 | .autotools 27 | 28 | # Java annotation processor (APT) 29 | .factorypath 30 | 31 | # PDT-specific (PHP Development Tools) 32 | .buildpath 33 | 34 | # sbteclipse plugin 35 | .target 36 | 37 | # Tern plugin 38 | .tern-project 39 | 40 | # TeXlipse plugin 41 | .texlipse 42 | 43 | # STS (Spring Tool Suite) 44 | .springBeans 45 | 46 | # Code Recommenders 47 | .recommenders/ 48 | 49 | # Scala IDE specific (Scala & Java development for Eclipse) 50 | .cache-main 51 | .scala_dependencies 52 | .worksheet 53 | -------------------------------------------------------------------------------- /Client/.gitattributes: -------------------------------------------------------------------------------- 1 | *.obj filter=lfs diff=lfs merge=lfs -text 2 | *.png filter=lfs diff=lfs merge=lfs -text 3 | *.jpg filter=lfs diff=lfs merge=lfs -text 4 | *.jpeg filter=lfs diff=lfs merge=lfs -text 5 | *.tga filter=lfs diff=lfs merge=lfs -text 6 | *.wav filter=lfs diff=lfs merge=lfs -text 7 | *.mp3 filter=lfs diff=lfs merge=lfs -text 8 | *.fbx filter=lfs diff=lfs merge=lfs -text 9 | *.mtl filter=lfs diff=lfs merge=lfs -text 10 | -------------------------------------------------------------------------------- /Client/.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /[Bb]uilds/ 6 | /Assets/AssetStoreTools* 7 | 8 | # Visual Studio 2015 cache directory 9 | /.vs/ 10 | 11 | # Autogenerated VS/MD/Consulo solution and project files 12 | ExportedObj/ 13 | .consulo/ 14 | *.csproj 15 | *.unityproj 16 | *.sln 17 | *.suo 18 | *.tmp 19 | *.user 20 | *.userprefs 21 | *.pidb 22 | *.booproj 23 | *.svd 24 | *.pdb 25 | 26 | # Unity3D generated meta files 27 | *.pidb.meta 28 | 29 | # Unity3D Generated File On Crash Reports 30 | sysinfo.txt 31 | 32 | # Builds 33 | *.apk 34 | *.unitypackage 35 | -------------------------------------------------------------------------------- /Client/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Unity Editor", 9 | "type": "unity", 10 | "request": "launch" 11 | }, 12 | { 13 | "name": "Windows Player", 14 | "type": "unity", 15 | "request": "launch" 16 | }, 17 | { 18 | "name": "OSX Player", 19 | "type": "unity", 20 | "request": "launch" 21 | }, 22 | { 23 | "name": "Linux Player", 24 | "type": "unity", 25 | "request": "launch" 26 | }, 27 | { 28 | "name": "iOS Player", 29 | "type": "unity", 30 | "request": "launch" 31 | }, 32 | { 33 | "name": "Android Player", 34 | "type": "unity", 35 | "request": "launch" 36 | } 37 | ] 38 | } -------------------------------------------------------------------------------- /Client/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.exclude": 3 | { 4 | "**/.DS_Store":true, 5 | "**/.git":true, 6 | "**/.gitignore":true, 7 | "**/.gitmodules":true, 8 | "**/*.booproj":true, 9 | "**/*.pidb":true, 10 | "**/*.suo":true, 11 | "**/*.user":true, 12 | "**/*.userprefs":true, 13 | "**/*.unityproj":true, 14 | "**/*.dll":true, 15 | "**/*.exe":true, 16 | "**/*.pdf":true, 17 | "**/*.mid":true, 18 | "**/*.midi":true, 19 | "**/*.wav":true, 20 | "**/*.gif":true, 21 | "**/*.ico":true, 22 | "**/*.jpg":true, 23 | "**/*.jpeg":true, 24 | "**/*.png":true, 25 | "**/*.psd":true, 26 | "**/*.tga":true, 27 | "**/*.tif":true, 28 | "**/*.tiff":true, 29 | "**/*.3ds":true, 30 | "**/*.3DS":true, 31 | "**/*.fbx":true, 32 | "**/*.FBX":true, 33 | "**/*.lxo":true, 34 | "**/*.LXO":true, 35 | "**/*.ma":true, 36 | "**/*.MA":true, 37 | "**/*.obj":true, 38 | "**/*.OBJ":true, 39 | "**/*.asset":true, 40 | "**/*.cubemap":true, 41 | "**/*.flare":true, 42 | "**/*.mat":true, 43 | "**/*.meta":true, 44 | "**/*.prefab":true, 45 | "**/*.unity":true, 46 | "build/":true, 47 | "Build/":true, 48 | "Library/":true, 49 | "library/":true, 50 | "obj/":true, 51 | "Obj/":true, 52 | "ProjectSettings/":true, 53 | "temp/":true, 54 | "Temp/":true 55 | } 56 | } -------------------------------------------------------------------------------- /Client/Assets/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 765c6d825ad3748cf82d18c152013d05 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Client/Assets/Materials/Server1.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Server1 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 1, g: 0.5801332, b: 0.4481132, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /Client/Assets/Materials/Server1.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4d4525299aadb4647887337b4ca46b12 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Client/Assets/Materials/Server2.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Server2 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0.4575472, g: 0.6698111, b: 1, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /Client/Assets/Materials/Server2.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c4401e168524d4b5d9796f0aecedb6c0 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Client/Assets/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b917d902442f841439c05da1784e14cf 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Client/Assets/Prefabs/Player.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 50abca10481962245a493af9af806cb2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Client/Assets/Prefabs/Player/Alpha_Body_MAT.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Alpha_Body_MAT 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 1, g: 0.0447725, b: 0, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 0} 77 | -------------------------------------------------------------------------------- /Client/Assets/Prefabs/Player/Alpha_Body_MAT.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 375df2e2f9e624f499684db857483500 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Client/Assets/Prefabs/Player/Alpha_Body_MAT_other_players.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Alpha_Body_MAT_other_players 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0, g: 0.95253086, b: 1, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 0} 77 | -------------------------------------------------------------------------------- /Client/Assets/Prefabs/Player/Alpha_Body_MAT_other_players.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d21837f34e1f64331a99176a003726a5 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Client/Assets/Prefabs/Player/Player.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f409a5718a84e834db46be37787d924c 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 100100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Client/Assets/Prefabs/Player/PlayerController.controller: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!91 &9100000 4 | AnimatorController: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_Name: PlayerController 9 | serializedVersion: 5 10 | m_AnimatorParameters: 11 | - m_Name: isRunning 12 | m_Type: 4 13 | m_DefaultFloat: 0 14 | m_DefaultInt: 0 15 | m_DefaultBool: 0 16 | m_Controller: {fileID: 9100000} 17 | m_AnimatorLayers: 18 | - serializedVersion: 5 19 | m_Name: Base Layer 20 | m_StateMachine: {fileID: 1107012392790222682} 21 | m_Mask: {fileID: 0} 22 | m_Motions: [] 23 | m_Behaviours: [] 24 | m_BlendingMode: 0 25 | m_SyncedLayerIndex: -1 26 | m_DefaultWeight: 0 27 | m_IKPass: 0 28 | m_SyncedLayerAffectsTiming: 0 29 | m_Controller: {fileID: 9100000} 30 | --- !u!1101 &1101659675554727438 31 | AnimatorStateTransition: 32 | m_ObjectHideFlags: 1 33 | m_PrefabParentObject: {fileID: 0} 34 | m_PrefabInternal: {fileID: 0} 35 | m_Name: 36 | m_Conditions: 37 | - m_ConditionMode: 2 38 | m_ConditionEvent: isRunning 39 | m_EventTreshold: 0 40 | m_DstStateMachine: {fileID: 0} 41 | m_DstState: {fileID: 1102754968469334716} 42 | m_Solo: 0 43 | m_Mute: 0 44 | m_IsExit: 0 45 | serializedVersion: 3 46 | m_TransitionDuration: 0.25 47 | m_TransitionOffset: 0 48 | m_ExitTime: 0.60526323 49 | m_HasExitTime: 0 50 | m_HasFixedDuration: 1 51 | m_InterruptionSource: 0 52 | m_OrderedInterruption: 1 53 | m_CanTransitionToSelf: 1 54 | --- !u!1101 &1101968585000316182 55 | AnimatorStateTransition: 56 | m_ObjectHideFlags: 1 57 | m_PrefabParentObject: {fileID: 0} 58 | m_PrefabInternal: {fileID: 0} 59 | m_Name: 60 | m_Conditions: 61 | - m_ConditionMode: 1 62 | m_ConditionEvent: isRunning 63 | m_EventTreshold: 0 64 | m_DstStateMachine: {fileID: 0} 65 | m_DstState: {fileID: 1102485297285295660} 66 | m_Solo: 0 67 | m_Mute: 0 68 | m_IsExit: 0 69 | serializedVersion: 3 70 | m_TransitionDuration: 0.25 71 | m_TransitionOffset: 0 72 | m_ExitTime: 0.87288135 73 | m_HasExitTime: 0 74 | m_HasFixedDuration: 1 75 | m_InterruptionSource: 0 76 | m_OrderedInterruption: 1 77 | m_CanTransitionToSelf: 1 78 | --- !u!1102 &1102485297285295660 79 | AnimatorState: 80 | serializedVersion: 5 81 | m_ObjectHideFlags: 1 82 | m_PrefabParentObject: {fileID: 0} 83 | m_PrefabInternal: {fileID: 0} 84 | m_Name: Running 85 | m_Speed: 1 86 | m_CycleOffset: 0 87 | m_Transitions: 88 | - {fileID: 1101659675554727438} 89 | m_StateMachineBehaviours: [] 90 | m_Position: {x: 50, y: 50, z: 0} 91 | m_IKOnFeet: 0 92 | m_WriteDefaultValues: 1 93 | m_Mirror: 0 94 | m_SpeedParameterActive: 0 95 | m_MirrorParameterActive: 0 96 | m_CycleOffsetParameterActive: 0 97 | m_TimeParameterActive: 0 98 | m_Motion: {fileID: 7400000, guid: 697f7102efde58e48974700a0725f125, type: 3} 99 | m_Tag: 100 | m_SpeedParameter: 101 | m_MirrorParameter: 102 | m_CycleOffsetParameter: 103 | m_TimeParameter: 104 | --- !u!1102 &1102754968469334716 105 | AnimatorState: 106 | serializedVersion: 5 107 | m_ObjectHideFlags: 1 108 | m_PrefabParentObject: {fileID: 0} 109 | m_PrefabInternal: {fileID: 0} 110 | m_Name: Idle 111 | m_Speed: 1 112 | m_CycleOffset: 0 113 | m_Transitions: 114 | - {fileID: 1101968585000316182} 115 | m_StateMachineBehaviours: [] 116 | m_Position: {x: 50, y: 50, z: 0} 117 | m_IKOnFeet: 0 118 | m_WriteDefaultValues: 1 119 | m_Mirror: 0 120 | m_SpeedParameterActive: 0 121 | m_MirrorParameterActive: 0 122 | m_CycleOffsetParameterActive: 0 123 | m_TimeParameterActive: 0 124 | m_Motion: {fileID: 7400000, guid: 1a4d634a5ae6c16488ea28cf7e17b7ab, type: 3} 125 | m_Tag: 126 | m_SpeedParameter: 127 | m_MirrorParameter: 128 | m_CycleOffsetParameter: 129 | m_TimeParameter: 130 | --- !u!1107 &1107012392790222682 131 | AnimatorStateMachine: 132 | serializedVersion: 5 133 | m_ObjectHideFlags: 1 134 | m_PrefabParentObject: {fileID: 0} 135 | m_PrefabInternal: {fileID: 0} 136 | m_Name: Base Layer 137 | m_ChildStates: 138 | - serializedVersion: 1 139 | m_State: {fileID: 1102754968469334716} 140 | m_Position: {x: 264, y: 108, z: 0} 141 | - serializedVersion: 1 142 | m_State: {fileID: 1102485297285295660} 143 | m_Position: {x: 264, y: 192, z: 0} 144 | m_ChildStateMachines: [] 145 | m_AnyStateTransitions: [] 146 | m_EntryTransitions: [] 147 | m_StateMachineTransitions: {} 148 | m_StateMachineBehaviours: [] 149 | m_AnyStatePosition: {x: 50, y: 20, z: 0} 150 | m_EntryPosition: {x: 50, y: 120, z: 0} 151 | m_ExitPosition: {x: 800, y: 120, z: 0} 152 | m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} 153 | m_DefaultState: {fileID: 1102754968469334716} 154 | -------------------------------------------------------------------------------- /Client/Assets/Prefabs/Player/PlayerController.controller.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 053285e820950ea4797f80f8eeff7ef2 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 9100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Client/Assets/Prefabs/Player/ybot@Idle.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saarg/Unity_MMO_Demo/871d9f5cce10af0d7642e1f81fcf6913bb4bf976/Client/Assets/Prefabs/Player/ybot@Idle.fbx -------------------------------------------------------------------------------- /Client/Assets/Prefabs/Player/ybot@Idle.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1a4d634a5ae6c16488ea28cf7e17b7ab 3 | ModelImporter: 4 | serializedVersion: 22 5 | fileIDToRecycleName: 6 | 100000: Alpha_Joints 7 | 100002: Alpha_Surface 8 | 100004: mixamorig:Head 9 | 100006: mixamorig:HeadTop_End 10 | 100008: mixamorig:Hips 11 | 100010: mixamorig:LeftArm 12 | 100012: mixamorig:LeftEye 13 | 100014: mixamorig:LeftFoot 14 | 100016: mixamorig:LeftForeArm 15 | 100018: mixamorig:LeftHand 16 | 100020: mixamorig:LeftHandIndex1 17 | 100022: mixamorig:LeftHandIndex2 18 | 100024: mixamorig:LeftHandIndex3 19 | 100026: mixamorig:LeftHandIndex4 20 | 100028: mixamorig:LeftHandMiddle1 21 | 100030: mixamorig:LeftHandMiddle2 22 | 100032: mixamorig:LeftHandMiddle3 23 | 100034: mixamorig:LeftHandMiddle4 24 | 100036: mixamorig:LeftHandPinky1 25 | 100038: mixamorig:LeftHandPinky2 26 | 100040: mixamorig:LeftHandPinky3 27 | 100042: mixamorig:LeftHandPinky4 28 | 100044: mixamorig:LeftHandRing1 29 | 100046: mixamorig:LeftHandRing2 30 | 100048: mixamorig:LeftHandRing3 31 | 100050: mixamorig:LeftHandRing4 32 | 100052: mixamorig:LeftHandThumb1 33 | 100054: mixamorig:LeftHandThumb2 34 | 100056: mixamorig:LeftHandThumb3 35 | 100058: mixamorig:LeftHandThumb4 36 | 100060: mixamorig:LeftLeg 37 | 100062: mixamorig:LeftShoulder 38 | 100064: mixamorig:LeftToe_End 39 | 100066: mixamorig:LeftToeBase 40 | 100068: mixamorig:LeftUpLeg 41 | 100070: mixamorig:Neck 42 | 100072: mixamorig:RightArm 43 | 100074: mixamorig:RightEye 44 | 100076: mixamorig:RightFoot 45 | 100078: mixamorig:RightForeArm 46 | 100080: mixamorig:RightHand 47 | 100082: mixamorig:RightHandIndex1 48 | 100084: mixamorig:RightHandIndex2 49 | 100086: mixamorig:RightHandIndex3 50 | 100088: mixamorig:RightHandIndex4 51 | 100090: mixamorig:RightHandMiddle1 52 | 100092: mixamorig:RightHandMiddle2 53 | 100094: mixamorig:RightHandMiddle3 54 | 100096: mixamorig:RightHandMiddle4 55 | 100098: mixamorig:RightHandPinky1 56 | 100100: mixamorig:RightHandPinky2 57 | 100102: mixamorig:RightHandPinky3 58 | 100104: mixamorig:RightHandPinky4 59 | 100106: mixamorig:RightHandRing1 60 | 100108: mixamorig:RightHandRing2 61 | 100110: mixamorig:RightHandRing3 62 | 100112: mixamorig:RightHandRing4 63 | 100114: mixamorig:RightHandThumb1 64 | 100116: mixamorig:RightHandThumb2 65 | 100118: mixamorig:RightHandThumb3 66 | 100120: mixamorig:RightHandThumb4 67 | 100122: mixamorig:RightLeg 68 | 100124: mixamorig:RightShoulder 69 | 100126: mixamorig:RightToe_End 70 | 100128: mixamorig:RightToeBase 71 | 100130: mixamorig:RightUpLeg 72 | 100132: mixamorig:Spine 73 | 100134: mixamorig:Spine1 74 | 100136: mixamorig:Spine2 75 | 100138: //RootNode 76 | 400000: Alpha_Joints 77 | 400002: Alpha_Surface 78 | 400004: mixamorig:Head 79 | 400006: mixamorig:HeadTop_End 80 | 400008: mixamorig:Hips 81 | 400010: mixamorig:LeftArm 82 | 400012: mixamorig:LeftEye 83 | 400014: mixamorig:LeftFoot 84 | 400016: mixamorig:LeftForeArm 85 | 400018: mixamorig:LeftHand 86 | 400020: mixamorig:LeftHandIndex1 87 | 400022: mixamorig:LeftHandIndex2 88 | 400024: mixamorig:LeftHandIndex3 89 | 400026: mixamorig:LeftHandIndex4 90 | 400028: mixamorig:LeftHandMiddle1 91 | 400030: mixamorig:LeftHandMiddle2 92 | 400032: mixamorig:LeftHandMiddle3 93 | 400034: mixamorig:LeftHandMiddle4 94 | 400036: mixamorig:LeftHandPinky1 95 | 400038: mixamorig:LeftHandPinky2 96 | 400040: mixamorig:LeftHandPinky3 97 | 400042: mixamorig:LeftHandPinky4 98 | 400044: mixamorig:LeftHandRing1 99 | 400046: mixamorig:LeftHandRing2 100 | 400048: mixamorig:LeftHandRing3 101 | 400050: mixamorig:LeftHandRing4 102 | 400052: mixamorig:LeftHandThumb1 103 | 400054: mixamorig:LeftHandThumb2 104 | 400056: mixamorig:LeftHandThumb3 105 | 400058: mixamorig:LeftHandThumb4 106 | 400060: mixamorig:LeftLeg 107 | 400062: mixamorig:LeftShoulder 108 | 400064: mixamorig:LeftToe_End 109 | 400066: mixamorig:LeftToeBase 110 | 400068: mixamorig:LeftUpLeg 111 | 400070: mixamorig:Neck 112 | 400072: mixamorig:RightArm 113 | 400074: mixamorig:RightEye 114 | 400076: mixamorig:RightFoot 115 | 400078: mixamorig:RightForeArm 116 | 400080: mixamorig:RightHand 117 | 400082: mixamorig:RightHandIndex1 118 | 400084: mixamorig:RightHandIndex2 119 | 400086: mixamorig:RightHandIndex3 120 | 400088: mixamorig:RightHandIndex4 121 | 400090: mixamorig:RightHandMiddle1 122 | 400092: mixamorig:RightHandMiddle2 123 | 400094: mixamorig:RightHandMiddle3 124 | 400096: mixamorig:RightHandMiddle4 125 | 400098: mixamorig:RightHandPinky1 126 | 400100: mixamorig:RightHandPinky2 127 | 400102: mixamorig:RightHandPinky3 128 | 400104: mixamorig:RightHandPinky4 129 | 400106: mixamorig:RightHandRing1 130 | 400108: mixamorig:RightHandRing2 131 | 400110: mixamorig:RightHandRing3 132 | 400112: mixamorig:RightHandRing4 133 | 400114: mixamorig:RightHandThumb1 134 | 400116: mixamorig:RightHandThumb2 135 | 400118: mixamorig:RightHandThumb3 136 | 400120: mixamorig:RightHandThumb4 137 | 400122: mixamorig:RightLeg 138 | 400124: mixamorig:RightShoulder 139 | 400126: mixamorig:RightToe_End 140 | 400128: mixamorig:RightToeBase 141 | 400130: mixamorig:RightUpLeg 142 | 400132: mixamorig:Spine 143 | 400134: mixamorig:Spine1 144 | 400136: mixamorig:Spine2 145 | 400138: //RootNode 146 | 2100000: Alpha_Body_MAT 147 | 2100002: Alpha_Joints_MAT 148 | 4300000: Alpha_Surface 149 | 4300002: Alpha_Joints 150 | 7400000: Idle 151 | 9500000: //RootNode 152 | 13700000: Alpha_Joints 153 | 13700002: Alpha_Surface 154 | externalObjects: {} 155 | materials: 156 | importMaterials: 1 157 | materialName: 0 158 | materialSearch: 1 159 | materialLocation: 1 160 | animations: 161 | legacyGenerateAnimations: 4 162 | bakeSimulation: 0 163 | resampleCurves: 1 164 | optimizeGameObjects: 0 165 | motionNodeName: 166 | rigImportErrors: 167 | rigImportWarnings: 168 | animationImportErrors: 169 | animationImportWarnings: 170 | animationRetargetingWarnings: 171 | animationDoRetargetingWarnings: 0 172 | importAnimatedCustomProperties: 0 173 | importConstraints: 0 174 | animationCompression: 1 175 | animationRotationError: 0.5 176 | animationPositionError: 0.5 177 | animationScaleError: 0.5 178 | animationWrapMode: 0 179 | extraExposedTransformPaths: [] 180 | extraUserProperties: [] 181 | clipAnimations: 182 | - serializedVersion: 16 183 | name: Idle 184 | takeName: mixamo.com 185 | firstFrame: 0 186 | lastFrame: 59 187 | wrapMode: 0 188 | orientationOffsetY: 0 189 | level: 0 190 | cycleOffset: 0 191 | loop: 0 192 | hasAdditiveReferencePose: 0 193 | loopTime: 1 194 | loopBlend: 0 195 | loopBlendOrientation: 0 196 | loopBlendPositionY: 0 197 | loopBlendPositionXZ: 0 198 | keepOriginalOrientation: 0 199 | keepOriginalPositionY: 1 200 | keepOriginalPositionXZ: 0 201 | heightFromFeet: 0 202 | mirror: 0 203 | bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000 204 | curves: [] 205 | events: [] 206 | transformMask: [] 207 | maskType: 3 208 | maskSource: {instanceID: 0} 209 | additiveReferencePoseFrame: 0 210 | isReadable: 1 211 | meshes: 212 | lODScreenPercentages: [] 213 | globalScale: 1 214 | meshCompression: 0 215 | addColliders: 0 216 | importVisibility: 1 217 | importBlendShapes: 1 218 | importCameras: 1 219 | importLights: 1 220 | swapUVChannels: 0 221 | generateSecondaryUV: 0 222 | useFileUnits: 1 223 | optimizeMeshForGPU: 1 224 | keepQuads: 0 225 | weldVertices: 1 226 | preserveHierarchy: 0 227 | indexFormat: 0 228 | secondaryUVAngleDistortion: 8 229 | secondaryUVAreaDistortion: 15.000001 230 | secondaryUVHardAngle: 88 231 | secondaryUVPackMargin: 4 232 | useFileScale: 1 233 | tangentSpace: 234 | normalSmoothAngle: 60 235 | normalImportMode: 0 236 | tangentImportMode: 3 237 | normalCalculationMode: 4 238 | importAnimation: 1 239 | copyAvatar: 0 240 | humanDescription: 241 | serializedVersion: 2 242 | human: [] 243 | skeleton: [] 244 | armTwist: 0.5 245 | foreArmTwist: 0.5 246 | upperLegTwist: 0.5 247 | legTwist: 0.5 248 | armStretch: 0.05 249 | legStretch: 0.05 250 | feetSpacing: 0 251 | rootMotionBoneName: 252 | rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1} 253 | hasTranslationDoF: 0 254 | hasExtraRoot: 0 255 | skeletonHasParents: 1 256 | lastHumanDescriptionAvatarSource: {instanceID: 0} 257 | animationType: 2 258 | humanoidOversampling: 1 259 | additionalBone: 0 260 | userData: 261 | assetBundleName: 262 | assetBundleVariant: 263 | -------------------------------------------------------------------------------- /Client/Assets/Prefabs/Player/ybot@Running.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saarg/Unity_MMO_Demo/871d9f5cce10af0d7642e1f81fcf6913bb4bf976/Client/Assets/Prefabs/Player/ybot@Running.fbx -------------------------------------------------------------------------------- /Client/Assets/Prefabs/Player/ybot@Running.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 697f7102efde58e48974700a0725f125 3 | ModelImporter: 4 | serializedVersion: 22 5 | fileIDToRecycleName: 6 | 100000: Alpha_Joints 7 | 100002: Alpha_Surface 8 | 100004: mixamorig:Head 9 | 100006: mixamorig:HeadTop_End 10 | 100008: mixamorig:Hips 11 | 100010: mixamorig:LeftArm 12 | 100012: mixamorig:LeftEye 13 | 100014: mixamorig:LeftFoot 14 | 100016: mixamorig:LeftForeArm 15 | 100018: mixamorig:LeftHand 16 | 100020: mixamorig:LeftHandIndex1 17 | 100022: mixamorig:LeftHandIndex2 18 | 100024: mixamorig:LeftHandIndex3 19 | 100026: mixamorig:LeftHandIndex4 20 | 100028: mixamorig:LeftHandMiddle1 21 | 100030: mixamorig:LeftHandMiddle2 22 | 100032: mixamorig:LeftHandMiddle3 23 | 100034: mixamorig:LeftHandMiddle4 24 | 100036: mixamorig:LeftHandPinky1 25 | 100038: mixamorig:LeftHandPinky2 26 | 100040: mixamorig:LeftHandPinky3 27 | 100042: mixamorig:LeftHandPinky4 28 | 100044: mixamorig:LeftHandRing1 29 | 100046: mixamorig:LeftHandRing2 30 | 100048: mixamorig:LeftHandRing3 31 | 100050: mixamorig:LeftHandRing4 32 | 100052: mixamorig:LeftHandThumb1 33 | 100054: mixamorig:LeftHandThumb2 34 | 100056: mixamorig:LeftHandThumb3 35 | 100058: mixamorig:LeftHandThumb4 36 | 100060: mixamorig:LeftLeg 37 | 100062: mixamorig:LeftShoulder 38 | 100064: mixamorig:LeftToe_End 39 | 100066: mixamorig:LeftToeBase 40 | 100068: mixamorig:LeftUpLeg 41 | 100070: mixamorig:Neck 42 | 100072: mixamorig:RightArm 43 | 100074: mixamorig:RightEye 44 | 100076: mixamorig:RightFoot 45 | 100078: mixamorig:RightForeArm 46 | 100080: mixamorig:RightHand 47 | 100082: mixamorig:RightHandIndex1 48 | 100084: mixamorig:RightHandIndex2 49 | 100086: mixamorig:RightHandIndex3 50 | 100088: mixamorig:RightHandIndex4 51 | 100090: mixamorig:RightHandMiddle1 52 | 100092: mixamorig:RightHandMiddle2 53 | 100094: mixamorig:RightHandMiddle3 54 | 100096: mixamorig:RightHandMiddle4 55 | 100098: mixamorig:RightHandPinky1 56 | 100100: mixamorig:RightHandPinky2 57 | 100102: mixamorig:RightHandPinky3 58 | 100104: mixamorig:RightHandPinky4 59 | 100106: mixamorig:RightHandRing1 60 | 100108: mixamorig:RightHandRing2 61 | 100110: mixamorig:RightHandRing3 62 | 100112: mixamorig:RightHandRing4 63 | 100114: mixamorig:RightHandThumb1 64 | 100116: mixamorig:RightHandThumb2 65 | 100118: mixamorig:RightHandThumb3 66 | 100120: mixamorig:RightHandThumb4 67 | 100122: mixamorig:RightLeg 68 | 100124: mixamorig:RightShoulder 69 | 100126: mixamorig:RightToe_End 70 | 100128: mixamorig:RightToeBase 71 | 100130: mixamorig:RightUpLeg 72 | 100132: mixamorig:Spine 73 | 100134: mixamorig:Spine1 74 | 100136: mixamorig:Spine2 75 | 100138: //RootNode 76 | 400000: Alpha_Joints 77 | 400002: Alpha_Surface 78 | 400004: mixamorig:Head 79 | 400006: mixamorig:HeadTop_End 80 | 400008: mixamorig:Hips 81 | 400010: mixamorig:LeftArm 82 | 400012: mixamorig:LeftEye 83 | 400014: mixamorig:LeftFoot 84 | 400016: mixamorig:LeftForeArm 85 | 400018: mixamorig:LeftHand 86 | 400020: mixamorig:LeftHandIndex1 87 | 400022: mixamorig:LeftHandIndex2 88 | 400024: mixamorig:LeftHandIndex3 89 | 400026: mixamorig:LeftHandIndex4 90 | 400028: mixamorig:LeftHandMiddle1 91 | 400030: mixamorig:LeftHandMiddle2 92 | 400032: mixamorig:LeftHandMiddle3 93 | 400034: mixamorig:LeftHandMiddle4 94 | 400036: mixamorig:LeftHandPinky1 95 | 400038: mixamorig:LeftHandPinky2 96 | 400040: mixamorig:LeftHandPinky3 97 | 400042: mixamorig:LeftHandPinky4 98 | 400044: mixamorig:LeftHandRing1 99 | 400046: mixamorig:LeftHandRing2 100 | 400048: mixamorig:LeftHandRing3 101 | 400050: mixamorig:LeftHandRing4 102 | 400052: mixamorig:LeftHandThumb1 103 | 400054: mixamorig:LeftHandThumb2 104 | 400056: mixamorig:LeftHandThumb3 105 | 400058: mixamorig:LeftHandThumb4 106 | 400060: mixamorig:LeftLeg 107 | 400062: mixamorig:LeftShoulder 108 | 400064: mixamorig:LeftToe_End 109 | 400066: mixamorig:LeftToeBase 110 | 400068: mixamorig:LeftUpLeg 111 | 400070: mixamorig:Neck 112 | 400072: mixamorig:RightArm 113 | 400074: mixamorig:RightEye 114 | 400076: mixamorig:RightFoot 115 | 400078: mixamorig:RightForeArm 116 | 400080: mixamorig:RightHand 117 | 400082: mixamorig:RightHandIndex1 118 | 400084: mixamorig:RightHandIndex2 119 | 400086: mixamorig:RightHandIndex3 120 | 400088: mixamorig:RightHandIndex4 121 | 400090: mixamorig:RightHandMiddle1 122 | 400092: mixamorig:RightHandMiddle2 123 | 400094: mixamorig:RightHandMiddle3 124 | 400096: mixamorig:RightHandMiddle4 125 | 400098: mixamorig:RightHandPinky1 126 | 400100: mixamorig:RightHandPinky2 127 | 400102: mixamorig:RightHandPinky3 128 | 400104: mixamorig:RightHandPinky4 129 | 400106: mixamorig:RightHandRing1 130 | 400108: mixamorig:RightHandRing2 131 | 400110: mixamorig:RightHandRing3 132 | 400112: mixamorig:RightHandRing4 133 | 400114: mixamorig:RightHandThumb1 134 | 400116: mixamorig:RightHandThumb2 135 | 400118: mixamorig:RightHandThumb3 136 | 400120: mixamorig:RightHandThumb4 137 | 400122: mixamorig:RightLeg 138 | 400124: mixamorig:RightShoulder 139 | 400126: mixamorig:RightToe_End 140 | 400128: mixamorig:RightToeBase 141 | 400130: mixamorig:RightUpLeg 142 | 400132: mixamorig:Spine 143 | 400134: mixamorig:Spine1 144 | 400136: mixamorig:Spine2 145 | 400138: //RootNode 146 | 2100000: Alpha_Body_MAT 147 | 2100002: Alpha_Joints_MAT 148 | 4300000: Alpha_Surface 149 | 4300002: Alpha_Joints 150 | 7400000: Running 151 | 9500000: //RootNode 152 | 13700000: Alpha_Joints 153 | 13700002: Alpha_Surface 154 | externalObjects: {} 155 | materials: 156 | importMaterials: 1 157 | materialName: 0 158 | materialSearch: 1 159 | materialLocation: 1 160 | animations: 161 | legacyGenerateAnimations: 4 162 | bakeSimulation: 0 163 | resampleCurves: 1 164 | optimizeGameObjects: 0 165 | motionNodeName: 166 | rigImportErrors: 167 | rigImportWarnings: 168 | animationImportErrors: 169 | animationImportWarnings: 170 | animationRetargetingWarnings: 171 | animationDoRetargetingWarnings: 0 172 | importAnimatedCustomProperties: 0 173 | importConstraints: 0 174 | animationCompression: 1 175 | animationRotationError: 0.5 176 | animationPositionError: 0.5 177 | animationScaleError: 0.5 178 | animationWrapMode: 0 179 | extraExposedTransformPaths: [] 180 | extraUserProperties: [] 181 | clipAnimations: 182 | - serializedVersion: 16 183 | name: Running 184 | takeName: mixamo.com 185 | firstFrame: 0 186 | lastFrame: 19 187 | wrapMode: 0 188 | orientationOffsetY: 0 189 | level: 0 190 | cycleOffset: 0 191 | loop: 0 192 | hasAdditiveReferencePose: 0 193 | loopTime: 1 194 | loopBlend: 0 195 | loopBlendOrientation: 0 196 | loopBlendPositionY: 0 197 | loopBlendPositionXZ: 0 198 | keepOriginalOrientation: 0 199 | keepOriginalPositionY: 1 200 | keepOriginalPositionXZ: 0 201 | heightFromFeet: 0 202 | mirror: 0 203 | bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000 204 | curves: [] 205 | events: [] 206 | transformMask: [] 207 | maskType: 3 208 | maskSource: {instanceID: 0} 209 | additiveReferencePoseFrame: 0 210 | isReadable: 1 211 | meshes: 212 | lODScreenPercentages: [] 213 | globalScale: 1 214 | meshCompression: 0 215 | addColliders: 0 216 | importVisibility: 1 217 | importBlendShapes: 1 218 | importCameras: 1 219 | importLights: 1 220 | swapUVChannels: 0 221 | generateSecondaryUV: 0 222 | useFileUnits: 1 223 | optimizeMeshForGPU: 1 224 | keepQuads: 0 225 | weldVertices: 1 226 | preserveHierarchy: 0 227 | indexFormat: 0 228 | secondaryUVAngleDistortion: 8 229 | secondaryUVAreaDistortion: 15.000001 230 | secondaryUVHardAngle: 88 231 | secondaryUVPackMargin: 4 232 | useFileScale: 1 233 | tangentSpace: 234 | normalSmoothAngle: 60 235 | normalImportMode: 0 236 | tangentImportMode: 3 237 | normalCalculationMode: 4 238 | importAnimation: 1 239 | copyAvatar: 0 240 | humanDescription: 241 | serializedVersion: 2 242 | human: [] 243 | skeleton: [] 244 | armTwist: 0.5 245 | foreArmTwist: 0.5 246 | upperLegTwist: 0.5 247 | legTwist: 0.5 248 | armStretch: 0.05 249 | legStretch: 0.05 250 | feetSpacing: 0 251 | rootMotionBoneName: 252 | rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1} 253 | hasTranslationDoF: 0 254 | hasExtraRoot: 0 255 | skeletonHasParents: 1 256 | lastHumanDescriptionAvatarSource: {instanceID: 0} 257 | animationType: 2 258 | humanoidOversampling: 1 259 | additionalBone: 0 260 | userData: 261 | assetBundleName: 262 | assetBundleVariant: 263 | -------------------------------------------------------------------------------- /Client/Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4f704ae4b4f98ae41a0bce26658850c1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Client/Assets/Scenes/MainScene.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 2100000, guid: 5072c671f5d9f4003a83241b424bb0f0, type: 2} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.1600065, g: 0.31191325, b: 0.6271495, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 11 47 | m_GIWorkflowMode: 0 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_TemporalCoherenceThreshold: 1 54 | m_EnvironmentLightingMode: 0 55 | m_EnableBakedLightmaps: 1 56 | m_EnableRealtimeLightmaps: 0 57 | m_LightmapEditorSettings: 58 | serializedVersion: 10 59 | m_Resolution: 2 60 | m_BakeResolution: 10 61 | m_AtlasSize: 512 62 | m_AO: 0 63 | m_AOMaxDistance: 1 64 | m_CompAOExponent: 1 65 | m_CompAOExponentDirect: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 256 79 | m_PVRBounces: 2 80 | m_PVRFilterTypeDirect: 0 81 | m_PVRFilterTypeIndirect: 0 82 | m_PVRFilterTypeAO: 0 83 | m_PVRFilteringMode: 1 84 | m_PVRCulling: 1 85 | m_PVRFilteringGaussRadiusDirect: 1 86 | m_PVRFilteringGaussRadiusIndirect: 5 87 | m_PVRFilteringGaussRadiusAO: 2 88 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 89 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 90 | m_PVRFilteringAtrousPositionSigmaAO: 1 91 | m_ShowResolutionOverlay: 1 92 | m_LightingDataAsset: {fileID: 0} 93 | m_UseShadowmask: 1 94 | --- !u!196 &4 95 | NavMeshSettings: 96 | serializedVersion: 2 97 | m_ObjectHideFlags: 0 98 | m_BuildSettings: 99 | serializedVersion: 2 100 | agentTypeID: 0 101 | agentRadius: 0.5 102 | agentHeight: 2 103 | agentSlope: 45 104 | agentClimb: 0.4 105 | ledgeDropHeight: 0 106 | maxJumpAcrossDistance: 0 107 | minRegionArea: 2 108 | manualCellSize: 0 109 | cellSize: 0.16666667 110 | manualTileSize: 0 111 | tileSize: 256 112 | accuratePlacement: 0 113 | debug: 114 | m_Flags: 0 115 | m_NavMeshData: {fileID: 0} 116 | --- !u!1 &170076733 117 | GameObject: 118 | m_ObjectHideFlags: 0 119 | m_PrefabParentObject: {fileID: 0} 120 | m_PrefabInternal: {fileID: 0} 121 | serializedVersion: 5 122 | m_Component: 123 | - component: {fileID: 170076735} 124 | - component: {fileID: 170076734} 125 | m_Layer: 0 126 | m_Name: Directional Light 127 | m_TagString: Untagged 128 | m_Icon: {fileID: 0} 129 | m_NavMeshLayer: 0 130 | m_StaticEditorFlags: 0 131 | m_IsActive: 1 132 | --- !u!108 &170076734 133 | Light: 134 | m_ObjectHideFlags: 0 135 | m_PrefabParentObject: {fileID: 0} 136 | m_PrefabInternal: {fileID: 0} 137 | m_GameObject: {fileID: 170076733} 138 | m_Enabled: 1 139 | serializedVersion: 8 140 | m_Type: 1 141 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 142 | m_Intensity: 1 143 | m_Range: 10 144 | m_SpotAngle: 30 145 | m_CookieSize: 10 146 | m_Shadows: 147 | m_Type: 2 148 | m_Resolution: -1 149 | m_CustomResolution: -1 150 | m_Strength: 1 151 | m_Bias: 0.05 152 | m_NormalBias: 0.4 153 | m_NearPlane: 0.2 154 | m_Cookie: {fileID: 0} 155 | m_DrawHalo: 0 156 | m_Flare: {fileID: 0} 157 | m_RenderMode: 0 158 | m_CullingMask: 159 | serializedVersion: 2 160 | m_Bits: 4294967295 161 | m_Lightmapping: 1 162 | m_AreaSize: {x: 1, y: 1} 163 | m_BounceIntensity: 1 164 | m_ColorTemperature: 6570 165 | m_UseColorTemperature: 0 166 | m_ShadowRadius: 0 167 | m_ShadowAngle: 0 168 | --- !u!4 &170076735 169 | Transform: 170 | m_ObjectHideFlags: 0 171 | m_PrefabParentObject: {fileID: 0} 172 | m_PrefabInternal: {fileID: 0} 173 | m_GameObject: {fileID: 170076733} 174 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 175 | m_LocalPosition: {x: 0, y: 3, z: 0} 176 | m_LocalScale: {x: 1, y: 1, z: 1} 177 | m_Children: [] 178 | m_Father: {fileID: 0} 179 | m_RootOrder: 1 180 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 181 | --- !u!1 &282840810 182 | GameObject: 183 | m_ObjectHideFlags: 0 184 | m_PrefabParentObject: {fileID: 0} 185 | m_PrefabInternal: {fileID: 0} 186 | serializedVersion: 5 187 | m_Component: 188 | - component: {fileID: 282840814} 189 | - component: {fileID: 282840813} 190 | m_Layer: 0 191 | m_Name: Main Camera 192 | m_TagString: MainCamera 193 | m_Icon: {fileID: 0} 194 | m_NavMeshLayer: 0 195 | m_StaticEditorFlags: 0 196 | m_IsActive: 1 197 | --- !u!20 &282840813 198 | Camera: 199 | m_ObjectHideFlags: 0 200 | m_PrefabParentObject: {fileID: 0} 201 | m_PrefabInternal: {fileID: 0} 202 | m_GameObject: {fileID: 282840810} 203 | m_Enabled: 1 204 | serializedVersion: 2 205 | m_ClearFlags: 1 206 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 207 | m_NormalizedViewPortRect: 208 | serializedVersion: 2 209 | x: 0 210 | y: 0 211 | width: 1 212 | height: 1 213 | near clip plane: 0.3 214 | far clip plane: 1000 215 | field of view: 60 216 | orthographic: 0 217 | orthographic size: 5 218 | m_Depth: -1 219 | m_CullingMask: 220 | serializedVersion: 2 221 | m_Bits: 4294967295 222 | m_RenderingPath: -1 223 | m_TargetTexture: {fileID: 0} 224 | m_TargetDisplay: 0 225 | m_TargetEye: 3 226 | m_HDR: 1 227 | m_AllowMSAA: 1 228 | m_AllowDynamicResolution: 0 229 | m_ForceIntoRT: 1 230 | m_OcclusionCulling: 1 231 | m_StereoConvergence: 10 232 | m_StereoSeparation: 0.022 233 | --- !u!4 &282840814 234 | Transform: 235 | m_ObjectHideFlags: 0 236 | m_PrefabParentObject: {fileID: 0} 237 | m_PrefabInternal: {fileID: 0} 238 | m_GameObject: {fileID: 282840810} 239 | m_LocalRotation: {x: -0.47661647, y: -0.004749607, z: 0.0025750354, w: -0.8790947} 240 | m_LocalPosition: {x: 0.16023196, y: 24.73, z: -23.13} 241 | m_LocalScale: {x: 1, y: 1, z: 1} 242 | m_Children: [] 243 | m_Father: {fileID: 0} 244 | m_RootOrder: 0 245 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 246 | --- !u!1 &1870899678 247 | GameObject: 248 | m_ObjectHideFlags: 0 249 | m_PrefabParentObject: {fileID: 0} 250 | m_PrefabInternal: {fileID: 0} 251 | serializedVersion: 5 252 | m_Component: 253 | - component: {fileID: 1870899680} 254 | - component: {fileID: 1870899679} 255 | m_Layer: 0 256 | m_Name: ScenesLoader 257 | m_TagString: Untagged 258 | m_Icon: {fileID: 0} 259 | m_NavMeshLayer: 0 260 | m_StaticEditorFlags: 0 261 | m_IsActive: 1 262 | --- !u!114 &1870899679 263 | MonoBehaviour: 264 | m_ObjectHideFlags: 0 265 | m_PrefabParentObject: {fileID: 0} 266 | m_PrefabInternal: {fileID: 0} 267 | m_GameObject: {fileID: 1870899678} 268 | m_Enabled: 1 269 | m_EditorHideFlags: 0 270 | m_Script: {fileID: 11500000, guid: 69bca3b86d037493cba11b2d1f35b541, type: 3} 271 | m_Name: 272 | m_EditorClassIdentifier: 273 | scenes: 0100000002000000 274 | --- !u!4 &1870899680 275 | Transform: 276 | m_ObjectHideFlags: 0 277 | m_PrefabParentObject: {fileID: 0} 278 | m_PrefabInternal: {fileID: 0} 279 | m_GameObject: {fileID: 1870899678} 280 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 281 | m_LocalPosition: {x: -2.5796466, y: 0.2683959, z: 4.641625} 282 | m_LocalScale: {x: 1, y: 1, z: 1} 283 | m_Children: [] 284 | m_Father: {fileID: 0} 285 | m_RootOrder: 2 286 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 287 | -------------------------------------------------------------------------------- /Client/Assets/Scenes/MainScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 99c9720ab356a0642a771bea13969a05 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Client/Assets/Scenes/Server1.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 11 47 | m_GIWorkflowMode: 0 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_TemporalCoherenceThreshold: 1 54 | m_EnvironmentLightingMode: 0 55 | m_EnableBakedLightmaps: 1 56 | m_EnableRealtimeLightmaps: 1 57 | m_LightmapEditorSettings: 58 | serializedVersion: 10 59 | m_Resolution: 2 60 | m_BakeResolution: 40 61 | m_AtlasSize: 1024 62 | m_AO: 0 63 | m_AOMaxDistance: 1 64 | m_CompAOExponent: 1 65 | m_CompAOExponentDirect: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVRFilterTypeDirect: 0 81 | m_PVRFilterTypeIndirect: 0 82 | m_PVRFilterTypeAO: 0 83 | m_PVRFilteringMode: 1 84 | m_PVRCulling: 1 85 | m_PVRFilteringGaussRadiusDirect: 1 86 | m_PVRFilteringGaussRadiusIndirect: 5 87 | m_PVRFilteringGaussRadiusAO: 2 88 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 89 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 90 | m_PVRFilteringAtrousPositionSigmaAO: 1 91 | m_ShowResolutionOverlay: 1 92 | m_LightingDataAsset: {fileID: 0} 93 | m_UseShadowmask: 1 94 | --- !u!196 &4 95 | NavMeshSettings: 96 | serializedVersion: 2 97 | m_ObjectHideFlags: 0 98 | m_BuildSettings: 99 | serializedVersion: 2 100 | agentTypeID: 0 101 | agentRadius: 0.5 102 | agentHeight: 2 103 | agentSlope: 45 104 | agentClimb: 0.4 105 | ledgeDropHeight: 0 106 | maxJumpAcrossDistance: 0 107 | minRegionArea: 2 108 | manualCellSize: 0 109 | cellSize: 0.16666667 110 | manualTileSize: 0 111 | tileSize: 256 112 | accuratePlacement: 0 113 | debug: 114 | m_Flags: 0 115 | m_NavMeshData: {fileID: 0} 116 | --- !u!1 &893235965 117 | GameObject: 118 | m_ObjectHideFlags: 0 119 | m_PrefabParentObject: {fileID: 0} 120 | m_PrefabInternal: {fileID: 0} 121 | serializedVersion: 5 122 | m_Component: 123 | - component: {fileID: 893235966} 124 | - component: {fileID: 893235967} 125 | m_Layer: 0 126 | m_Name: WorldBoundaries 127 | m_TagString: Untagged 128 | m_Icon: {fileID: 0} 129 | m_NavMeshLayer: 0 130 | m_StaticEditorFlags: 0 131 | m_IsActive: 1 132 | --- !u!4 &893235966 133 | Transform: 134 | m_ObjectHideFlags: 0 135 | m_PrefabParentObject: {fileID: 0} 136 | m_PrefabInternal: {fileID: 0} 137 | m_GameObject: {fileID: 893235965} 138 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 139 | m_LocalPosition: {x: 0, y: 0, z: 0} 140 | m_LocalScale: {x: 1, y: 1, z: 1} 141 | m_Children: [] 142 | m_Father: {fileID: 1371720261} 143 | m_RootOrder: 0 144 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 145 | --- !u!65 &893235967 146 | BoxCollider: 147 | m_ObjectHideFlags: 0 148 | m_PrefabParentObject: {fileID: 0} 149 | m_PrefabInternal: {fileID: 0} 150 | m_GameObject: {fileID: 893235965} 151 | m_Material: {fileID: 0} 152 | m_IsTrigger: 1 153 | m_Enabled: 1 154 | serializedVersion: 2 155 | m_Size: {x: 39, y: 20, z: 39} 156 | m_Center: {x: 0, y: 5, z: 0} 157 | --- !u!1 &1156388342 158 | GameObject: 159 | m_ObjectHideFlags: 0 160 | m_PrefabParentObject: {fileID: 0} 161 | m_PrefabInternal: {fileID: 0} 162 | serializedVersion: 5 163 | m_Component: 164 | - component: {fileID: 1156388346} 165 | - component: {fileID: 1156388345} 166 | - component: {fileID: 1156388344} 167 | - component: {fileID: 1156388343} 168 | m_Layer: 0 169 | m_Name: Ground 170 | m_TagString: Untagged 171 | m_Icon: {fileID: 0} 172 | m_NavMeshLayer: 0 173 | m_StaticEditorFlags: 0 174 | m_IsActive: 1 175 | --- !u!64 &1156388343 176 | MeshCollider: 177 | m_ObjectHideFlags: 0 178 | m_PrefabParentObject: {fileID: 0} 179 | m_PrefabInternal: {fileID: 0} 180 | m_GameObject: {fileID: 1156388342} 181 | m_Material: {fileID: 0} 182 | m_IsTrigger: 0 183 | m_Enabled: 1 184 | serializedVersion: 3 185 | m_Convex: 0 186 | m_CookingOptions: 14 187 | m_SkinWidth: 0.01 188 | m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} 189 | --- !u!23 &1156388344 190 | MeshRenderer: 191 | m_ObjectHideFlags: 0 192 | m_PrefabParentObject: {fileID: 0} 193 | m_PrefabInternal: {fileID: 0} 194 | m_GameObject: {fileID: 1156388342} 195 | m_Enabled: 1 196 | m_CastShadows: 1 197 | m_ReceiveShadows: 1 198 | m_DynamicOccludee: 1 199 | m_MotionVectors: 1 200 | m_LightProbeUsage: 1 201 | m_ReflectionProbeUsage: 1 202 | m_RenderingLayerMask: 4294967295 203 | m_Materials: 204 | - {fileID: 2100000, guid: 4d4525299aadb4647887337b4ca46b12, type: 2} 205 | m_StaticBatchInfo: 206 | firstSubMesh: 0 207 | subMeshCount: 0 208 | m_StaticBatchRoot: {fileID: 0} 209 | m_ProbeAnchor: {fileID: 0} 210 | m_LightProbeVolumeOverride: {fileID: 0} 211 | m_ScaleInLightmap: 1 212 | m_PreserveUVs: 0 213 | m_IgnoreNormalsForChartDetection: 0 214 | m_ImportantGI: 0 215 | m_StitchLightmapSeams: 0 216 | m_SelectedEditorRenderState: 3 217 | m_MinimumChartSize: 4 218 | m_AutoUVMaxDistance: 0.5 219 | m_AutoUVMaxAngle: 89 220 | m_LightmapParameters: {fileID: 0} 221 | m_SortingLayerID: 0 222 | m_SortingLayer: 0 223 | m_SortingOrder: 0 224 | --- !u!33 &1156388345 225 | MeshFilter: 226 | m_ObjectHideFlags: 0 227 | m_PrefabParentObject: {fileID: 0} 228 | m_PrefabInternal: {fileID: 0} 229 | m_GameObject: {fileID: 1156388342} 230 | m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} 231 | --- !u!4 &1156388346 232 | Transform: 233 | m_ObjectHideFlags: 0 234 | m_PrefabParentObject: {fileID: 0} 235 | m_PrefabInternal: {fileID: 0} 236 | m_GameObject: {fileID: 1156388342} 237 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 238 | m_LocalPosition: {x: -20, y: 0, z: 0} 239 | m_LocalScale: {x: 4, y: 4, z: 4} 240 | m_Children: [] 241 | m_Father: {fileID: 0} 242 | m_RootOrder: 1 243 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 244 | --- !u!1 &1371720260 245 | GameObject: 246 | m_ObjectHideFlags: 0 247 | m_PrefabParentObject: {fileID: 0} 248 | m_PrefabInternal: {fileID: 0} 249 | serializedVersion: 5 250 | m_Component: 251 | - component: {fileID: 1371720261} 252 | - component: {fileID: 1371720262} 253 | - component: {fileID: 1371720263} 254 | m_Layer: 0 255 | m_Name: NetworkManager 256 | m_TagString: Untagged 257 | m_Icon: {fileID: 0} 258 | m_NavMeshLayer: 0 259 | m_StaticEditorFlags: 0 260 | m_IsActive: 1 261 | --- !u!4 &1371720261 262 | Transform: 263 | m_ObjectHideFlags: 0 264 | m_PrefabParentObject: {fileID: 0} 265 | m_PrefabInternal: {fileID: 0} 266 | m_GameObject: {fileID: 1371720260} 267 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 268 | m_LocalPosition: {x: -20, y: 0, z: 0} 269 | m_LocalScale: {x: 1, y: 1, z: 1} 270 | m_Children: 271 | - {fileID: 893235966} 272 | m_Father: {fileID: 0} 273 | m_RootOrder: 2 274 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 275 | --- !u!114 &1371720262 276 | MonoBehaviour: 277 | m_ObjectHideFlags: 0 278 | m_PrefabParentObject: {fileID: 0} 279 | m_PrefabInternal: {fileID: 0} 280 | m_GameObject: {fileID: 1371720260} 281 | m_Enabled: 1 282 | m_EditorHideFlags: 0 283 | m_Script: {fileID: 11500000, guid: c36cec47046d44efebed170c21c51764, type: 3} 284 | m_Name: 285 | m_EditorClassIdentifier: 286 | ip: localhost 287 | port: 9501 288 | autoconnect: 1 289 | spawnablePrefabs: 290 | - {fileID: 114284233523721722, guid: f409a5718a84e834db46be37787d924c, type: 2} 291 | --- !u!54 &1371720263 292 | Rigidbody: 293 | m_ObjectHideFlags: 0 294 | m_PrefabParentObject: {fileID: 0} 295 | m_PrefabInternal: {fileID: 0} 296 | m_GameObject: {fileID: 1371720260} 297 | serializedVersion: 2 298 | m_Mass: 1 299 | m_Drag: 0 300 | m_AngularDrag: 0.05 301 | m_UseGravity: 0 302 | m_IsKinematic: 1 303 | m_Interpolate: 0 304 | m_Constraints: 0 305 | m_CollisionDetection: 0 306 | --- !u!1 &1520976774 307 | GameObject: 308 | m_ObjectHideFlags: 0 309 | m_PrefabParentObject: {fileID: 0} 310 | m_PrefabInternal: {fileID: 0} 311 | serializedVersion: 5 312 | m_Component: 313 | - component: {fileID: 1520976778} 314 | - component: {fileID: 1520976777} 315 | - component: {fileID: 1520976776} 316 | m_Layer: 0 317 | m_Name: Main Camera 318 | m_TagString: MainCamera 319 | m_Icon: {fileID: 0} 320 | m_NavMeshLayer: 0 321 | m_StaticEditorFlags: 0 322 | m_IsActive: 1 323 | --- !u!124 &1520976776 324 | Behaviour: 325 | m_ObjectHideFlags: 0 326 | m_PrefabParentObject: {fileID: 0} 327 | m_PrefabInternal: {fileID: 0} 328 | m_GameObject: {fileID: 1520976774} 329 | m_Enabled: 1 330 | --- !u!20 &1520976777 331 | Camera: 332 | m_ObjectHideFlags: 0 333 | m_PrefabParentObject: {fileID: 0} 334 | m_PrefabInternal: {fileID: 0} 335 | m_GameObject: {fileID: 1520976774} 336 | m_Enabled: 1 337 | serializedVersion: 2 338 | m_ClearFlags: 1 339 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 340 | m_NormalizedViewPortRect: 341 | serializedVersion: 2 342 | x: 0 343 | y: 0 344 | width: 1 345 | height: 1 346 | near clip plane: 0.3 347 | far clip plane: 1000 348 | field of view: 60 349 | orthographic: 0 350 | orthographic size: 5 351 | m_Depth: -1 352 | m_CullingMask: 353 | serializedVersion: 2 354 | m_Bits: 4294967295 355 | m_RenderingPath: -1 356 | m_TargetTexture: {fileID: 0} 357 | m_TargetDisplay: 1 358 | m_TargetEye: 3 359 | m_HDR: 1 360 | m_AllowMSAA: 1 361 | m_AllowDynamicResolution: 0 362 | m_ForceIntoRT: 0 363 | m_OcclusionCulling: 1 364 | m_StereoConvergence: 10 365 | m_StereoSeparation: 0.022 366 | --- !u!4 &1520976778 367 | Transform: 368 | m_ObjectHideFlags: 0 369 | m_PrefabParentObject: {fileID: 0} 370 | m_PrefabInternal: {fileID: 0} 371 | m_GameObject: {fileID: 1520976774} 372 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 373 | m_LocalPosition: {x: -10, y: 1, z: -10} 374 | m_LocalScale: {x: 1, y: 1, z: 1} 375 | m_Children: [] 376 | m_Father: {fileID: 0} 377 | m_RootOrder: 0 378 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 379 | -------------------------------------------------------------------------------- /Client/Assets/Scenes/Server1.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 08c048535083a44cab9a0ff7cf311c0e 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Client/Assets/Scenes/Server2.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 11 47 | m_GIWorkflowMode: 0 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_TemporalCoherenceThreshold: 1 54 | m_EnvironmentLightingMode: 0 55 | m_EnableBakedLightmaps: 1 56 | m_EnableRealtimeLightmaps: 1 57 | m_LightmapEditorSettings: 58 | serializedVersion: 10 59 | m_Resolution: 2 60 | m_BakeResolution: 40 61 | m_AtlasSize: 1024 62 | m_AO: 0 63 | m_AOMaxDistance: 1 64 | m_CompAOExponent: 1 65 | m_CompAOExponentDirect: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVRFilterTypeDirect: 0 81 | m_PVRFilterTypeIndirect: 0 82 | m_PVRFilterTypeAO: 0 83 | m_PVRFilteringMode: 1 84 | m_PVRCulling: 1 85 | m_PVRFilteringGaussRadiusDirect: 1 86 | m_PVRFilteringGaussRadiusIndirect: 5 87 | m_PVRFilteringGaussRadiusAO: 2 88 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 89 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 90 | m_PVRFilteringAtrousPositionSigmaAO: 1 91 | m_ShowResolutionOverlay: 1 92 | m_LightingDataAsset: {fileID: 0} 93 | m_UseShadowmask: 1 94 | --- !u!196 &4 95 | NavMeshSettings: 96 | serializedVersion: 2 97 | m_ObjectHideFlags: 0 98 | m_BuildSettings: 99 | serializedVersion: 2 100 | agentTypeID: 0 101 | agentRadius: 0.5 102 | agentHeight: 2 103 | agentSlope: 45 104 | agentClimb: 0.4 105 | ledgeDropHeight: 0 106 | maxJumpAcrossDistance: 0 107 | minRegionArea: 2 108 | manualCellSize: 0 109 | cellSize: 0.16666667 110 | manualTileSize: 0 111 | tileSize: 256 112 | accuratePlacement: 0 113 | debug: 114 | m_Flags: 0 115 | m_NavMeshData: {fileID: 0} 116 | --- !u!1 &893235965 117 | GameObject: 118 | m_ObjectHideFlags: 0 119 | m_PrefabParentObject: {fileID: 0} 120 | m_PrefabInternal: {fileID: 0} 121 | serializedVersion: 5 122 | m_Component: 123 | - component: {fileID: 893235966} 124 | - component: {fileID: 893235967} 125 | m_Layer: 0 126 | m_Name: WorldBoundaries 127 | m_TagString: Untagged 128 | m_Icon: {fileID: 0} 129 | m_NavMeshLayer: 0 130 | m_StaticEditorFlags: 0 131 | m_IsActive: 1 132 | --- !u!4 &893235966 133 | Transform: 134 | m_ObjectHideFlags: 0 135 | m_PrefabParentObject: {fileID: 0} 136 | m_PrefabInternal: {fileID: 0} 137 | m_GameObject: {fileID: 893235965} 138 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 139 | m_LocalPosition: {x: 0, y: 0, z: 0} 140 | m_LocalScale: {x: 1, y: 1, z: 1} 141 | m_Children: [] 142 | m_Father: {fileID: 1371720261} 143 | m_RootOrder: 0 144 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 145 | --- !u!65 &893235967 146 | BoxCollider: 147 | m_ObjectHideFlags: 0 148 | m_PrefabParentObject: {fileID: 0} 149 | m_PrefabInternal: {fileID: 0} 150 | m_GameObject: {fileID: 893235965} 151 | m_Material: {fileID: 0} 152 | m_IsTrigger: 1 153 | m_Enabled: 1 154 | serializedVersion: 2 155 | m_Size: {x: 39, y: 20, z: 39} 156 | m_Center: {x: 0, y: 5, z: 0} 157 | --- !u!1 &1156388342 158 | GameObject: 159 | m_ObjectHideFlags: 0 160 | m_PrefabParentObject: {fileID: 0} 161 | m_PrefabInternal: {fileID: 0} 162 | serializedVersion: 5 163 | m_Component: 164 | - component: {fileID: 1156388346} 165 | - component: {fileID: 1156388345} 166 | - component: {fileID: 1156388344} 167 | - component: {fileID: 1156388343} 168 | m_Layer: 0 169 | m_Name: Ground 170 | m_TagString: Untagged 171 | m_Icon: {fileID: 0} 172 | m_NavMeshLayer: 0 173 | m_StaticEditorFlags: 0 174 | m_IsActive: 1 175 | --- !u!64 &1156388343 176 | MeshCollider: 177 | m_ObjectHideFlags: 0 178 | m_PrefabParentObject: {fileID: 0} 179 | m_PrefabInternal: {fileID: 0} 180 | m_GameObject: {fileID: 1156388342} 181 | m_Material: {fileID: 0} 182 | m_IsTrigger: 0 183 | m_Enabled: 1 184 | serializedVersion: 3 185 | m_Convex: 0 186 | m_CookingOptions: 14 187 | m_SkinWidth: 0.01 188 | m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} 189 | --- !u!23 &1156388344 190 | MeshRenderer: 191 | m_ObjectHideFlags: 0 192 | m_PrefabParentObject: {fileID: 0} 193 | m_PrefabInternal: {fileID: 0} 194 | m_GameObject: {fileID: 1156388342} 195 | m_Enabled: 1 196 | m_CastShadows: 1 197 | m_ReceiveShadows: 1 198 | m_DynamicOccludee: 1 199 | m_MotionVectors: 1 200 | m_LightProbeUsage: 1 201 | m_ReflectionProbeUsage: 1 202 | m_RenderingLayerMask: 4294967295 203 | m_Materials: 204 | - {fileID: 2100000, guid: c4401e168524d4b5d9796f0aecedb6c0, type: 2} 205 | m_StaticBatchInfo: 206 | firstSubMesh: 0 207 | subMeshCount: 0 208 | m_StaticBatchRoot: {fileID: 0} 209 | m_ProbeAnchor: {fileID: 0} 210 | m_LightProbeVolumeOverride: {fileID: 0} 211 | m_ScaleInLightmap: 1 212 | m_PreserveUVs: 0 213 | m_IgnoreNormalsForChartDetection: 0 214 | m_ImportantGI: 0 215 | m_StitchLightmapSeams: 0 216 | m_SelectedEditorRenderState: 3 217 | m_MinimumChartSize: 4 218 | m_AutoUVMaxDistance: 0.5 219 | m_AutoUVMaxAngle: 89 220 | m_LightmapParameters: {fileID: 0} 221 | m_SortingLayerID: 0 222 | m_SortingLayer: 0 223 | m_SortingOrder: 0 224 | --- !u!33 &1156388345 225 | MeshFilter: 226 | m_ObjectHideFlags: 0 227 | m_PrefabParentObject: {fileID: 0} 228 | m_PrefabInternal: {fileID: 0} 229 | m_GameObject: {fileID: 1156388342} 230 | m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} 231 | --- !u!4 &1156388346 232 | Transform: 233 | m_ObjectHideFlags: 0 234 | m_PrefabParentObject: {fileID: 0} 235 | m_PrefabInternal: {fileID: 0} 236 | m_GameObject: {fileID: 1156388342} 237 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 238 | m_LocalPosition: {x: 20, y: 0, z: 0} 239 | m_LocalScale: {x: 4, y: 4, z: 4} 240 | m_Children: [] 241 | m_Father: {fileID: 0} 242 | m_RootOrder: 1 243 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 244 | --- !u!1 &1371720260 245 | GameObject: 246 | m_ObjectHideFlags: 0 247 | m_PrefabParentObject: {fileID: 0} 248 | m_PrefabInternal: {fileID: 0} 249 | serializedVersion: 5 250 | m_Component: 251 | - component: {fileID: 1371720261} 252 | - component: {fileID: 1371720262} 253 | - component: {fileID: 1371720263} 254 | m_Layer: 0 255 | m_Name: NetworkManager 256 | m_TagString: Untagged 257 | m_Icon: {fileID: 0} 258 | m_NavMeshLayer: 0 259 | m_StaticEditorFlags: 0 260 | m_IsActive: 1 261 | --- !u!4 &1371720261 262 | Transform: 263 | m_ObjectHideFlags: 0 264 | m_PrefabParentObject: {fileID: 0} 265 | m_PrefabInternal: {fileID: 0} 266 | m_GameObject: {fileID: 1371720260} 267 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 268 | m_LocalPosition: {x: 20, y: 0, z: 0} 269 | m_LocalScale: {x: 1, y: 1, z: 1} 270 | m_Children: 271 | - {fileID: 893235966} 272 | m_Father: {fileID: 0} 273 | m_RootOrder: 2 274 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 275 | --- !u!114 &1371720262 276 | MonoBehaviour: 277 | m_ObjectHideFlags: 0 278 | m_PrefabParentObject: {fileID: 0} 279 | m_PrefabInternal: {fileID: 0} 280 | m_GameObject: {fileID: 1371720260} 281 | m_Enabled: 1 282 | m_EditorHideFlags: 0 283 | m_Script: {fileID: 11500000, guid: c36cec47046d44efebed170c21c51764, type: 3} 284 | m_Name: 285 | m_EditorClassIdentifier: 286 | ip: localhost 287 | port: 9502 288 | autoconnect: 0 289 | spawnablePrefabs: 290 | - {fileID: 114284233523721722, guid: f409a5718a84e834db46be37787d924c, type: 2} 291 | --- !u!54 &1371720263 292 | Rigidbody: 293 | m_ObjectHideFlags: 0 294 | m_PrefabParentObject: {fileID: 0} 295 | m_PrefabInternal: {fileID: 0} 296 | m_GameObject: {fileID: 1371720260} 297 | serializedVersion: 2 298 | m_Mass: 1 299 | m_Drag: 0 300 | m_AngularDrag: 0.05 301 | m_UseGravity: 0 302 | m_IsKinematic: 1 303 | m_Interpolate: 0 304 | m_Constraints: 0 305 | m_CollisionDetection: 0 306 | --- !u!1 &1520976774 307 | GameObject: 308 | m_ObjectHideFlags: 0 309 | m_PrefabParentObject: {fileID: 0} 310 | m_PrefabInternal: {fileID: 0} 311 | serializedVersion: 5 312 | m_Component: 313 | - component: {fileID: 1520976778} 314 | - component: {fileID: 1520976777} 315 | - component: {fileID: 1520976776} 316 | m_Layer: 0 317 | m_Name: Main Camera 318 | m_TagString: MainCamera 319 | m_Icon: {fileID: 0} 320 | m_NavMeshLayer: 0 321 | m_StaticEditorFlags: 0 322 | m_IsActive: 1 323 | --- !u!124 &1520976776 324 | Behaviour: 325 | m_ObjectHideFlags: 0 326 | m_PrefabParentObject: {fileID: 0} 327 | m_PrefabInternal: {fileID: 0} 328 | m_GameObject: {fileID: 1520976774} 329 | m_Enabled: 1 330 | --- !u!20 &1520976777 331 | Camera: 332 | m_ObjectHideFlags: 0 333 | m_PrefabParentObject: {fileID: 0} 334 | m_PrefabInternal: {fileID: 0} 335 | m_GameObject: {fileID: 1520976774} 336 | m_Enabled: 1 337 | serializedVersion: 2 338 | m_ClearFlags: 1 339 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 340 | m_NormalizedViewPortRect: 341 | serializedVersion: 2 342 | x: 0 343 | y: 0 344 | width: 1 345 | height: 1 346 | near clip plane: 0.3 347 | far clip plane: 1000 348 | field of view: 60 349 | orthographic: 0 350 | orthographic size: 5 351 | m_Depth: -1 352 | m_CullingMask: 353 | serializedVersion: 2 354 | m_Bits: 4294967295 355 | m_RenderingPath: -1 356 | m_TargetTexture: {fileID: 0} 357 | m_TargetDisplay: 2 358 | m_TargetEye: 3 359 | m_HDR: 1 360 | m_AllowMSAA: 1 361 | m_AllowDynamicResolution: 0 362 | m_ForceIntoRT: 0 363 | m_OcclusionCulling: 1 364 | m_StereoConvergence: 10 365 | m_StereoSeparation: 0.022 366 | --- !u!4 &1520976778 367 | Transform: 368 | m_ObjectHideFlags: 0 369 | m_PrefabParentObject: {fileID: 0} 370 | m_PrefabInternal: {fileID: 0} 371 | m_GameObject: {fileID: 1520976774} 372 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 373 | m_LocalPosition: {x: 10, y: 1, z: -10} 374 | m_LocalScale: {x: 1, y: 1, z: 1} 375 | m_Children: [] 376 | m_Father: {fileID: 0} 377 | m_RootOrder: 0 378 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 379 | -------------------------------------------------------------------------------- /Client/Assets/Scenes/Server2.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 349a4eeaf39b44e5a9cf61ad3c80db61 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Client/Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e8b2fedbd32e7478db22314de15b068d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/AdditiveSceneLoader.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.SceneManagement; 5 | 6 | public class AdditiveSceneLoader : MonoBehaviour { 7 | 8 | [SerializeField] int[] scenes; 9 | 10 | void Awake () { 11 | #if !UNITY_EDITOR 12 | StartCoroutine(LoadAllScenes()); 13 | #endif 14 | } 15 | 16 | IEnumerator LoadAllScenes() { 17 | foreach (int sceneIndex in scenes) 18 | { 19 | 20 | if (SceneManager.GetSceneByBuildIndex(sceneIndex).isLoaded) 21 | continue; 22 | 23 | AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneIndex, LoadSceneMode.Additive); 24 | 25 | while (!asyncLoad.isDone) 26 | { 27 | yield return null; 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/AdditiveSceneLoader.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 69bca3b86d037493cba11b2d1f35b541 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d9ad1b9a596c747bcbac1adc2951ef79 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking/ConnectionToServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Sockets; 4 | using System.Threading; 5 | using System.Text; 6 | using System.Collections; 7 | using System.Collections.Generic; 8 | using UnityEngine; 9 | using UnityEngine.SceneManagement; 10 | 11 | public class ConnectionToServer : MonoBehaviour { 12 | 13 | [SerializeField] String ip; 14 | [SerializeField] int port; 15 | 16 | [SerializeField] bool autoconnect = true; 17 | 18 | TcpClient tcpClient; 19 | Socket socket; 20 | int clientId = -1; 21 | 22 | [SerializeField] List spawnablePrefabs; 23 | [SerializeField] Dictionary netComps = new Dictionary(); 24 | int idIndex = 10000; 25 | 26 | Thread msgReceiveThread; 27 | 28 | String sceneName; 29 | 30 | void Awake() 31 | { 32 | sceneName = gameObject.scene.name; 33 | 34 | NetworkIdentity[] ids = FindObjectsOfType(); 35 | foreach (NetworkIdentity netComp in ids) { 36 | if (netComp.gameObject.scene != gameObject.scene) 37 | continue; 38 | 39 | netComp.gameObject.SetActive(false); 40 | 41 | netComp.id = idIndex++; 42 | netComp.spawned = false; 43 | netComps.Add(idIndex, netComp); 44 | }; 45 | 46 | if (autoconnect) 47 | Connect(); 48 | } 49 | 50 | void OnDestroy() { 51 | Disconnect(); 52 | } 53 | 54 | void Connect(NetworkIdentity player = null) { 55 | if (socket != null && socket.Connected) { 56 | Disconnect(); 57 | } 58 | 59 | tcpClient = new TcpClient(ip, port); 60 | 61 | socket = tcpClient.Client; 62 | 63 | if(socket.Connected) 64 | { 65 | socket.Send(BitConverter.GetBytes(0), SocketFlags.None); 66 | 67 | byte[] buffer = new byte[sizeof(int)]; 68 | Read(ref buffer); 69 | int length = BitConverter.ToInt32(buffer, 0); 70 | 71 | buffer = new byte[length]; 72 | Read(ref buffer); 73 | 74 | if ((MessageId) buffer[0] == MessageId.Spawn) { 75 | 76 | SpawnMessage msg = new SpawnMessage(); 77 | msg.Deserialize(ref buffer); 78 | clientId = msg.objectId; 79 | 80 | if (player != null) { 81 | player.connectionToServer.Leave(player); 82 | 83 | SceneManager.MoveGameObjectToScene(player.gameObject, gameObject.scene); 84 | player.id = msg.objectId; 85 | player.spawned = true; 86 | 87 | player.connectionToServer = this; 88 | 89 | netComps.Add(msg.objectId, player); 90 | } else { 91 | messageQueue.Enqueue(buffer); 92 | } 93 | } else { 94 | Debug.LogError("[" + sceneName + "] Failed to get client data"); 95 | Disconnect(); 96 | return; 97 | } 98 | 99 | Debug.Log("[" + sceneName + "] Client connected to " + ip + ":" + port + " with id: " + clientId + "!"); 100 | } 101 | 102 | if (!socket.Connected) { 103 | Debug.LogWarning("[" + sceneName + "] Failed to connect " + ip + ":" + port + "!"); 104 | gameObject.SetActive(false); 105 | } else { 106 | foreach ( KeyValuePair netComp in netComps) { 107 | GameObject go = netComp.Value.gameObject; 108 | go.SendMessage("OnConnect", this, SendMessageOptions.DontRequireReceiver); 109 | go.SetActive(true); 110 | } 111 | 112 | StartCoroutine(MsgHandling()); 113 | 114 | msgReceiveThread = new Thread(new ThreadStart(MsgThread)); 115 | msgReceiveThread.Start(); 116 | } 117 | } 118 | 119 | void Disconnect() { 120 | foreach ( KeyValuePair netComp in netComps) { 121 | if (netComp.Value != null) 122 | { 123 | netComp.Value.SendMessage("OnDisconnect", null, SendMessageOptions.DontRequireReceiver); 124 | } 125 | } 126 | netComps.Clear(); 127 | 128 | if (tcpClient == null || !tcpClient.Connected) { 129 | return; 130 | } 131 | 132 | if (msgReceiveThread != null) 133 | msgReceiveThread.Abort(); 134 | 135 | DespawnMessage msg = new DespawnMessage();; 136 | msg.objectId = clientId; 137 | 138 | Send(msg); 139 | 140 | // tcpClient.Close(); 141 | 142 | Debug.Log("[" + sceneName + "] Disconected"); 143 | } 144 | 145 | void OnTriggerEnter(Collider other) 146 | { 147 | if (other.tag != "Player" || other.gameObject.scene == gameObject.scene) 148 | return; 149 | 150 | Debug.Log("[" + sceneName + "] Entered by " + other.name); 151 | 152 | NetworkIdentity netId = other.GetComponent(); 153 | 154 | if (netId.hasAuthority) 155 | Connect(netId); 156 | } 157 | 158 | void Leave(NetworkIdentity player) { 159 | Debug.Log("[" + sceneName + "] Left by " + player.id); 160 | 161 | netComps.Remove(player.id); 162 | Disconnect(); 163 | } 164 | 165 | // Message handling 166 | Queue messageQueue = new Queue(); 167 | IEnumerator MsgHandling() { 168 | while(true) { 169 | if (messageQueue.Count <= 0) { 170 | yield return null; 171 | continue; 172 | } 173 | 174 | byte[] buffer = messageQueue.Dequeue(); 175 | 176 | if ((MessageId) buffer[0] == MessageId.Transform) { 177 | TransformMessage msg = new TransformMessage(); 178 | msg.Deserialize(ref buffer); 179 | 180 | if (!netComps.ContainsKey(msg.sourceId)) { 181 | Debug.LogWarning("[" + sceneName + "] Object with netId " + msg.sourceId + " not found!"); 182 | continue; 183 | } 184 | 185 | NetworkIdentity netId = netComps[msg.sourceId]; 186 | 187 | netId.SendMessage("ApplyTransform", msg, SendMessageOptions.DontRequireReceiver); 188 | 189 | } else if ((MessageId) buffer[0] == MessageId.Spawn) { 190 | SpawnMessage msg = new SpawnMessage(); 191 | msg.Deserialize(ref buffer); 192 | 193 | if (netComps.ContainsKey(msg.objectId)) { 194 | continue; 195 | } 196 | 197 | GameObject spawned = Instantiate(spawnablePrefabs[msg.prefabId].gameObject, transform.position, transform.rotation); 198 | SceneManager.MoveGameObjectToScene(spawned, gameObject.scene); 199 | spawned.SetActive(msg.hasAuthority); 200 | 201 | NetworkIdentity netId = spawned.GetComponent(); 202 | netComps.Add(msg.objectId, netId); 203 | 204 | netId.id = msg.objectId; 205 | netId.spawned = true; 206 | netId.connectionToServer = this; 207 | netId.hasAuthority = msg.hasAuthority; 208 | } else if ((MessageId) buffer[0] == MessageId.Despawn) { 209 | DespawnMessage msg = new DespawnMessage(); 210 | msg.Deserialize(ref buffer); 211 | 212 | if (netComps.ContainsKey(msg.objectId)) { 213 | NetworkIdentity netComp = netComps[msg.objectId]; 214 | netComps.Remove(msg.objectId); 215 | 216 | Destroy(netComp.gameObject); 217 | } 218 | } else if ((MessageId) buffer[0] == MessageId.Enable) { 219 | EnableMessage msg = new EnableMessage(); 220 | msg.Deserialize(ref buffer); 221 | 222 | if (netComps.ContainsKey(msg.objectId)) { 223 | NetworkIdentity netComp = netComps[msg.objectId]; 224 | 225 | netComp.transform.position = new Vector3(msg.position[0], msg.position[1], msg.position[2]); 226 | netComp.transform.rotation = new Quaternion(msg.rotation[0], msg.rotation[1], msg.rotation[2], msg.rotation[3]); 227 | 228 | netComp.gameObject.SetActive(msg.toEnable); 229 | } 230 | } 231 | 232 | yield return null; 233 | } 234 | } 235 | 236 | // Message reception 237 | void MsgThread() 238 | { 239 | while (true) { 240 | byte[] buffer = new byte[sizeof(int)]; 241 | Read(ref buffer); 242 | int length = BitConverter.ToInt32(buffer, 0); 243 | 244 | if (length <= 0) { 245 | continue; 246 | } 247 | 248 | buffer = new byte[length]; 249 | Read(ref buffer); 250 | 251 | // Debug.Log("[" + sceneName + "] Received message id: " + (MessageId) buffer[0]); 252 | 253 | messageQueue.Enqueue(buffer); 254 | } 255 | } 256 | 257 | public void Send(NetworkMessage msg) { 258 | byte[] buffer; 259 | 260 | msg.Serialize(out buffer); 261 | 262 | Write(ref buffer); 263 | } 264 | 265 | 266 | // Socket methods to send buffers 267 | int Read(ref byte[] bytes, SocketFlags flags = SocketFlags.None) { 268 | if (socket == null || !socket.Connected) 269 | return 0; 270 | 271 | return socket.Receive(bytes, flags); 272 | } 273 | 274 | int Write(ref byte[] bytes, SocketFlags flags = SocketFlags.None) { 275 | if (socket == null || !socket.Connected) 276 | return 0; 277 | 278 | return socket.Send(bytes, flags); 279 | } 280 | } 281 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking/ConnectionToServer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c36cec47046d44efebed170c21c51764 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking/NetworkComponent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | [RequireComponent(typeof(NetworkIdentity))] 6 | public class NetworkComponent : MonoBehaviour { 7 | 8 | protected NetworkIdentity netId; 9 | 10 | public bool HasAuthority { get { return netId.HasAuthority; } } 11 | 12 | void Awake() 13 | { 14 | netId = GetComponent(); 15 | } 16 | 17 | public virtual void OnConnect(ConnectionToServer connection) {} 18 | public virtual void OnDisconnect() {} 19 | } 20 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking/NetworkComponent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 09a8e958d6a1c409db75330b42ab5601 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking/NetworkIdentity.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class NetworkIdentity : MonoBehaviour { 6 | 7 | public int id; 8 | public ConnectionToServer connectionToServer; 9 | public bool spawned = true; 10 | 11 | public bool hasAuthority = false; 12 | public bool HasAuthority { get { return HasAuthority; } } 13 | 14 | public virtual void OnConnect(ConnectionToServer connection) { 15 | connectionToServer = connection; 16 | } 17 | 18 | public virtual void OnDisconnect() { 19 | connectionToServer = null; 20 | 21 | if (spawned) 22 | Destroy(gameObject); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking/NetworkIdentity.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aeaa4c1f16de9498c9f6a914c9ac5a03 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking/NetworkMessages.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8d3ac3c83deb444d186e48fa53ae07ba 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking/NetworkMessages/DespawnMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | public class DespawnMessage: NetworkMessage { 7 | 8 | public int objectId = -1; 9 | 10 | public DespawnMessage() { 11 | id = 3; 12 | size = 1 + sizeof(int); 13 | } 14 | 15 | public override void Deserialize(ref byte[] buffer) { 16 | if (buffer[0] != id) { 17 | Debug.LogError("Deserializing wrong packet id found!"); 18 | return; 19 | } 20 | 21 | int offset = 1; 22 | 23 | objectId = BitConverter.ToInt32(buffer, offset); 24 | offset += sizeof(int); 25 | 26 | } 27 | 28 | public override void Serialize(out byte[] buffer) { 29 | buffer = new byte[sizeof(int) + size]; 30 | Buffer.BlockCopy(BitConverter.GetBytes(size), 0, buffer, 0, sizeof(int)); 31 | int offset = sizeof(int); 32 | 33 | buffer[offset++] = id; 34 | 35 | Buffer.BlockCopy(BitConverter.GetBytes(objectId), 0, buffer, offset, sizeof(int)); 36 | offset += sizeof(int); 37 | } 38 | } -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking/NetworkMessages/DespawnMessage.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43208eab26b74452c8b12b38ca6f8c69 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking/NetworkMessages/EnableMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | public class EnableMessage: NetworkMessage { 7 | 8 | public int objectId = -1; 9 | public bool toEnable = false; 10 | 11 | public float[] position = new float[3]; 12 | public float[] rotation = new float[4]; 13 | 14 | public EnableMessage() { 15 | id = 4; 16 | size = 1 + 8*sizeof(int) + sizeof(bool); 17 | } 18 | 19 | public override void Deserialize(ref byte[] buffer) { 20 | if (buffer[0] != id) { 21 | Debug.LogError("Deserializing wrong packet id found!"); 22 | return; 23 | } 24 | 25 | int offset = 1; 26 | 27 | objectId = BitConverter.ToInt32(buffer, offset); 28 | offset += sizeof(int); 29 | toEnable = BitConverter.ToBoolean(buffer, offset); 30 | offset += sizeof(bool); 31 | 32 | position [0] = BitConverter.ToSingle(buffer, offset); 33 | offset += sizeof(float); 34 | position [1] = BitConverter.ToSingle(buffer, offset); 35 | offset += sizeof(float); 36 | position [2] = BitConverter.ToSingle(buffer, offset); 37 | offset += sizeof(float); 38 | 39 | rotation [0] = BitConverter.ToSingle(buffer, offset); 40 | offset += sizeof(float); 41 | rotation [1] = BitConverter.ToSingle(buffer, offset); 42 | offset += sizeof(float); 43 | rotation [2] = BitConverter.ToSingle(buffer, offset); 44 | offset += sizeof(float); 45 | rotation [3] = BitConverter.ToSingle(buffer, offset); 46 | offset += sizeof(float); 47 | } 48 | 49 | public override void Serialize(out byte[] buffer) { 50 | buffer = new byte[sizeof(int) + size]; 51 | Buffer.BlockCopy(BitConverter.GetBytes(size), 0, buffer, 0, sizeof(int)); 52 | int offset = sizeof(int); 53 | 54 | buffer[offset++] = id; 55 | 56 | Buffer.BlockCopy(BitConverter.GetBytes(objectId), 0, buffer, offset, sizeof(int)); 57 | offset += sizeof(int); 58 | Buffer.BlockCopy(BitConverter.GetBytes(toEnable), 0, buffer, offset, sizeof(bool)); 59 | offset += sizeof(bool); 60 | 61 | Buffer.BlockCopy(position, 0, buffer, offset, position.Length*sizeof(float)); 62 | offset += position.Length*sizeof(float); 63 | 64 | Buffer.BlockCopy(rotation, 0, buffer, offset, rotation.Length*sizeof(float)); 65 | offset += rotation.Length*sizeof(float); 66 | } 67 | } -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking/NetworkMessages/EnableMessage.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a67e68c5a8e434eb6b82d0fb80a5e45e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking/NetworkMessages/NetworkMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | 5 | enum MessageId {None, Transform, Spawn, Despawn, Enable} 6 | 7 | public class NetworkMessage { 8 | 9 | protected static byte id = 0; 10 | public int Id { get { return id; } } 11 | protected static int size = 1024; 12 | public int Size { get { return size; } } 13 | 14 | public NetworkMessage() { 15 | 16 | } 17 | 18 | public virtual void Deserialize(ref byte[] buffer) { 19 | 20 | } 21 | 22 | public virtual void Serialize(out byte[] buffer) { 23 | buffer = new byte[1024]; 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking/NetworkMessages/NetworkMessage.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 171a2101e013e4823b7916b8813e752c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking/NetworkMessages/SpawnMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | public class SpawnMessage: NetworkMessage { 7 | 8 | 9 | public int prefabId = -1; 10 | public int objectId = -1; 11 | public bool hasAuthority = false; 12 | 13 | public SpawnMessage() { 14 | id = 2; 15 | size = 1 + 2 * sizeof(int) + sizeof(bool); 16 | } 17 | 18 | public override void Deserialize(ref byte[] buffer) { 19 | if (buffer[0] != id) { 20 | Debug.LogError("Deserializing wrong packet id found!"); 21 | return; 22 | } 23 | 24 | int offset = 1; 25 | 26 | prefabId = BitConverter.ToInt32(buffer, offset); 27 | offset += sizeof(int); 28 | objectId = BitConverter.ToInt32(buffer, offset); 29 | offset += sizeof(int); 30 | hasAuthority = BitConverter.ToBoolean(buffer, offset); 31 | offset += sizeof(bool); 32 | } 33 | 34 | public override void Serialize(out byte[] buffer) { 35 | buffer = new byte[sizeof(int) + size]; 36 | Buffer.BlockCopy(BitConverter.GetBytes(size), 0, buffer, 0, sizeof(int)); 37 | int offset = sizeof(int); 38 | 39 | buffer[offset++] = id; 40 | 41 | Buffer.BlockCopy(BitConverter.GetBytes(prefabId), 0, buffer, offset, sizeof(int)); 42 | offset += sizeof(int); 43 | Buffer.BlockCopy(BitConverter.GetBytes(objectId), 0, buffer, offset, sizeof(int)); 44 | offset += sizeof(int); 45 | Buffer.BlockCopy(BitConverter.GetBytes(hasAuthority), 0, buffer, offset, sizeof(bool)); 46 | offset += sizeof(bool); 47 | } 48 | } -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking/NetworkMessages/SpawnMessage.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4c2f4139739c345a3a1729f8b5908e31 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking/NetworkMessages/TransformMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | public class TransformMessage: NetworkMessage { 7 | 8 | public int sourceId { get; protected set; } 9 | public float[] position = new float[3]; 10 | public float[] rotation = new float[4]; 11 | 12 | public TransformMessage() { 13 | id = 1; 14 | size = 1 + sizeof(int) + 7 * sizeof(float); 15 | } 16 | 17 | public TransformMessage(Transform t) { 18 | id = 1; 19 | size = 1 + sizeof(int) + 7 * sizeof(float); 20 | 21 | NetworkIdentity netId = t.GetComponent(); 22 | if (netId == null) 23 | throw new NullReferenceException(); 24 | sourceId = netId.id; 25 | 26 | position [0] = t.position.x; 27 | position [1] = t.position.y; 28 | position [2] = t.position.z; 29 | 30 | rotation [0] = t.rotation.x; 31 | rotation [1] = t.rotation.y; 32 | rotation [2] = t.rotation.z; 33 | rotation [3] = t.rotation.w; 34 | } 35 | 36 | public override void Deserialize(ref byte[] buffer) { 37 | int offset = 1; 38 | 39 | sourceId = BitConverter.ToInt32(buffer, offset); 40 | offset += sizeof(int); 41 | 42 | position [0] = BitConverter.ToSingle(buffer, offset); 43 | offset += sizeof(float); 44 | position [1] = BitConverter.ToSingle(buffer, offset); 45 | offset += sizeof(float); 46 | position [2] = BitConverter.ToSingle(buffer, offset); 47 | offset += sizeof(float); 48 | 49 | rotation [0] = BitConverter.ToSingle(buffer, offset); 50 | offset += sizeof(float); 51 | rotation [1] = BitConverter.ToSingle(buffer, offset); 52 | offset += sizeof(float); 53 | rotation [2] = BitConverter.ToSingle(buffer, offset); 54 | offset += sizeof(float); 55 | rotation [3] = BitConverter.ToSingle(buffer, offset); 56 | offset += sizeof(float); 57 | } 58 | 59 | public override void Serialize(out byte[] buffer) { 60 | buffer = new byte[sizeof(int) + size]; 61 | Buffer.BlockCopy(BitConverter.GetBytes(size), 0, buffer, 0, sizeof(int)); 62 | int offset = sizeof(int); 63 | 64 | buffer[offset++] = id; 65 | 66 | Buffer.BlockCopy(BitConverter.GetBytes(sourceId), 0, buffer, offset, sizeof(int)); 67 | offset += sizeof(int); 68 | 69 | Buffer.BlockCopy(position, 0, buffer, offset, position.Length*sizeof(float)); 70 | offset += position.Length*sizeof(float); 71 | 72 | Buffer.BlockCopy(rotation, 0, buffer, offset, rotation.Length*sizeof(float)); 73 | offset += rotation.Length*sizeof(float); 74 | } 75 | } -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking/NetworkMessages/TransformMessage.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a891af884b44a492d9346c7780d4cbb6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking/NetworkTransform.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class NetworkTransform : NetworkComponent { 6 | 7 | float lastUpdate; 8 | [Range(0f, 30f)] 9 | [SerializeField] float updatePerSec = 10f; 10 | [SerializeField] float maxMovement = 3f; 11 | 12 | float lastReception; 13 | 14 | Vector3 lastPosition; 15 | Quaternion lastRotation; 16 | 17 | Vector3 newPosition; 18 | Quaternion newRotation; 19 | 20 | Animator animator; 21 | 22 | public void OnEnable() { 23 | lastPosition = newPosition = transform.position; 24 | lastRotation = newRotation = transform.rotation; 25 | 26 | lastReception = Time.realtimeSinceStartup; 27 | 28 | animator = GetComponent(); 29 | } 30 | 31 | // Update is called once per frame 32 | void Update () { 33 | if (netId.connectionToServer != null && netId.hasAuthority && updatePerSec != 0 && Time.realtimeSinceStartup - lastUpdate > 1 / updatePerSec) { 34 | lastUpdate = Time.realtimeSinceStartup; 35 | TransformMessage message = new TransformMessage(transform); 36 | 37 | netId.connectionToServer.Send(message); 38 | } 39 | 40 | if (!netId.hasAuthority) { 41 | float lerpValue = Mathf.Clamp01((Time.realtimeSinceStartup - lastReception) / (1 / updatePerSec)); 42 | 43 | transform.position = Vector3.Lerp(lastPosition, newPosition, lerpValue); 44 | transform.rotation = Quaternion.Lerp(lastRotation, newRotation, lerpValue); 45 | } 46 | } 47 | 48 | 49 | public void ApplyTransform(TransformMessage msg) 50 | { 51 | newPosition = new Vector3(msg.position[0], msg.position[1], msg.position[2]); 52 | newRotation = new Quaternion(msg.rotation[0], msg.rotation[1], msg.rotation[2], msg.rotation[3]); 53 | 54 | lastPosition = transform.position; 55 | lastRotation = transform.rotation; 56 | 57 | animator = transform.GetComponent(); 58 | if (animator != null) 59 | { 60 | UpdateAnimator(animator, lastPosition, newPosition); 61 | } 62 | else 63 | { 64 | Debug.Log("No animator found"); 65 | } 66 | 67 | Vector3 movmntVec = newPosition - lastPosition; 68 | if (movmntVec.sqrMagnitude > maxMovement*maxMovement) { 69 | lastReception = 0; 70 | } else { 71 | lastReception = Time.realtimeSinceStartup; 72 | } 73 | } 74 | 75 | private void UpdateAnimator(Animator animator, Vector3 lastPosition, Vector3 newPosition) 76 | { 77 | float speed = (newPosition - lastPosition).sqrMagnitude; 78 | 79 | if (speed > 0f) 80 | { 81 | animator.SetBool("isRunning", true); 82 | } 83 | else 84 | { 85 | animator.SetBool("isRunning", false); 86 | } 87 | } 88 | 89 | private IEnumerator LerpTransform(Vector3 lastPosition, Vector3 newPosition, Quaternion lastRotation, Quaternion newRotation) 90 | { 91 | float startTime = Time.realtimeSinceStartup; 92 | while (Time.realtimeSinceStartup - startTime <= 1 / updatePerSec) 93 | { 94 | float lerpValue = Mathf.Clamp01((Time.realtimeSinceStartup - startTime) / (1 / updatePerSec)); 95 | 96 | transform.position = Vector3.Lerp(lastPosition, newPosition, lerpValue); 97 | transform.rotation = Quaternion.Lerp(lastRotation, newRotation, lerpValue); 98 | yield return null; 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/Networking/NetworkTransform.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 63781565cdf414ce581f57c92a3202dd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/Player.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class Player : NetworkComponent { 6 | 7 | [SerializeField] string horizontalInput; 8 | [SerializeField] string verticalInput; 9 | 10 | [Range(1f, 10f)] 11 | [SerializeField] float speed = 5f; 12 | [Range(5f, 20f)] 13 | [SerializeField] float interestRadius = 8f; 14 | 15 | [SerializeField] new Camera camera; 16 | [SerializeField] Animator animator; 17 | 18 | [SerializeField] Renderer targetRenderer; 19 | [SerializeField] Material localPlayerMat; 20 | [SerializeField] Material onlinePlayerMat; 21 | 22 | void Start () { 23 | animator = GetComponent(); 24 | 25 | if (netId.hasAuthority) { 26 | targetRenderer.material = localPlayerMat; 27 | } else { 28 | targetRenderer.material = onlinePlayerMat; 29 | } 30 | 31 | speed += speed * Random.Range(-0.2f, 0.2f); 32 | } 33 | 34 | void FixedUpdate() { 35 | if (netId.hasAuthority) { 36 | Vector3 inputs = new Vector3(Input.GetAxis(horizontalInput), 0, Input.GetAxis(verticalInput)).normalized; 37 | Vector3 translation = inputs * Time.fixedDeltaTime * speed; 38 | 39 | transform.position += translation; 40 | 41 | if (inputs.sqrMagnitude != 0) { 42 | Quaternion targetRot; 43 | targetRot = Quaternion.LookRotation(inputs, Vector3.up); 44 | 45 | transform.rotation = Quaternion.Lerp(transform.rotation, targetRot, 3f*Time.fixedDeltaTime); 46 | } 47 | 48 | if (animator != null) 49 | { 50 | UpdateAnimator(translation.sqrMagnitude); 51 | } 52 | else 53 | { 54 | Debug.Log("No animator found"); 55 | } 56 | } else if (camera != null) { 57 | Destroy(camera.gameObject); 58 | } 59 | } 60 | 61 | private void UpdateAnimator(float speed) 62 | { 63 | if (speed > 0f) 64 | { 65 | animator.SetBool("isRunning", true); 66 | } 67 | else 68 | { 69 | animator.SetBool("isRunning", false); 70 | } 71 | } 72 | 73 | void OnDrawGizmos() { 74 | Gizmos.color = Color.green; 75 | Gizmos.DrawWireSphere(transform.position, interestRadius); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Client/Assets/Scripts/Player.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 51b0ffbc0b5e242ada607ca816a029ba 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Client/Assets/Skybox.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 46cd726ba68ff49828dcd847247d86c9 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Client/Assets/Skybox/Cartoon_Airbrush_Day_NoSun.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Cartoon_Airbrush_Day_NoSun 10 | m_Shader: {fileID: 10700, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BackTex: 22 | m_Texture: {fileID: 2800000, guid: ccbc3f25708ed491e86a569f0a679e73, type: 3} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DownTex: 26 | m_Texture: {fileID: 2800000, guid: 0986bee61deb042389dfc7a860a1fa3a, type: 3} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _FrontTex: 30 | m_Texture: {fileID: 2800000, guid: 70797ab05989b4fb295f60eaf537cd3a, type: 3} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _LeftTex: 34 | m_Texture: {fileID: 2800000, guid: 530cdbf9e0f2f45239f957330e5cb249, type: 3} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _MainTex: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _RightTex: 42 | m_Texture: {fileID: 2800000, guid: ad1066355bbf24261a04760a57add9b0, type: 3} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _UpTex: 46 | m_Texture: {fileID: 2800000, guid: 4b733fcd5d5b54a4d8f2dff5482e0126, type: 3} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | m_Floats: [] 50 | m_Colors: 51 | - _Color: {r: 1, g: 1, b: 1, a: 1} 52 | -------------------------------------------------------------------------------- /Client/Assets/Skybox/Cartoon_Airbrush_Day_NoSun.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5072c671f5d9f4003a83241b424bb0f0 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Client/Assets/Skybox/Cartoon_Airbrush_Day_NoSun.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a8e495b20bbc64cadb002bcc499944e5 3 | folderAsset: yes 4 | timeCreated: 1425917267 5 | licenseType: Store 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Client/Assets/Skybox/Cartoon_Airbrush_Day_NoSun.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6d5543e3ecbfe4d2fba5244ccea81e17 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Client/Assets/Skybox/Cartoon_Airbrush_Day_NoSun/ReflectionProbe-0.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saarg/Unity_MMO_Demo/871d9f5cce10af0d7642e1f81fcf6913bb4bf976/Client/Assets/Skybox/Cartoon_Airbrush_Day_NoSun/ReflectionProbe-0.exr -------------------------------------------------------------------------------- /Client/Assets/Skybox/Cartoon_Airbrush_Day_NoSun/ReflectionProbe-0.exr.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 64c80760f6744a74d8650a4397c88c5b 3 | timeCreated: 1481806089 4 | licenseType: Store 5 | TextureImporter: 6 | fileIDToRecycleName: 7 | 8900000: generatedCubemap 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 1 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | grayScaleToAlpha: 0 25 | generateCubemap: 6 26 | cubemapConvolution: 1 27 | seamlessCubemap: 1 28 | textureFormat: 1 29 | maxTextureSize: 2048 30 | textureSettings: 31 | filterMode: 2 32 | aniso: 0 33 | mipBias: 0 34 | wrapMode: 1 35 | nPOTScale: 1 36 | lightmap: 0 37 | compressionQuality: 50 38 | spriteMode: 0 39 | spriteExtrude: 1 40 | spriteMeshType: 1 41 | alignment: 0 42 | spritePivot: {x: 0.5, y: 0.5} 43 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 44 | spritePixelsToUnits: 100 45 | alphaUsage: 1 46 | alphaIsTransparency: 0 47 | spriteTessellationDetail: -1 48 | textureType: 0 49 | textureShape: 2 50 | maxTextureSizeSet: 0 51 | compressionQualitySet: 0 52 | textureFormatSet: 0 53 | platformSettings: 54 | - buildTarget: DefaultTexturePlatform 55 | maxTextureSize: 2048 56 | textureFormat: -1 57 | textureCompression: 1 58 | compressionQuality: 100 59 | crunchedCompression: 0 60 | allowsAlphaSplitting: 0 61 | overridden: 0 62 | spriteSheet: 63 | serializedVersion: 2 64 | sprites: [] 65 | outline: [] 66 | spritePackingTag: 67 | userData: 68 | assetBundleName: 69 | assetBundleVariant: 70 | -------------------------------------------------------------------------------- /Client/Assets/Skybox/Sky_Cartoon_Airbrush_Day_NoSun_Cam_0_Front+Z.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saarg/Unity_MMO_Demo/871d9f5cce10af0d7642e1f81fcf6913bb4bf976/Client/Assets/Skybox/Sky_Cartoon_Airbrush_Day_NoSun_Cam_0_Front+Z.png -------------------------------------------------------------------------------- /Client/Assets/Skybox/Sky_Cartoon_Airbrush_Day_NoSun_Cam_0_Front+Z.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 70797ab05989b4fb295f60eaf537cd3a 3 | labels: 4 | - Sky 5 | - Skies 6 | - AllSky 7 | - Skybox 8 | TextureImporter: 9 | fileIDToRecycleName: 10 | 2186277476908879412: ImportLogs 11 | externalObjects: {} 12 | serializedVersion: 5 13 | mipmaps: 14 | mipMapMode: 0 15 | enableMipMap: 0 16 | sRGBTexture: 1 17 | linearTexture: 0 18 | fadeOut: 0 19 | borderMipMap: 0 20 | mipMapsPreserveCoverage: 0 21 | alphaTestReferenceValue: 0.5 22 | mipMapFadeDistanceStart: 1 23 | mipMapFadeDistanceEnd: 3 24 | bumpmap: 25 | convertToNormalMap: 0 26 | externalNormalMap: 0 27 | heightScale: 0.25 28 | normalMapFilter: 0 29 | isReadable: 0 30 | grayScaleToAlpha: 0 31 | generateCubemap: 6 32 | cubemapConvolution: 0 33 | seamlessCubemap: 0 34 | textureFormat: -1 35 | maxTextureSize: 32 36 | textureSettings: 37 | serializedVersion: 2 38 | filterMode: -1 39 | aniso: -1 40 | mipBias: -1 41 | wrapU: 1 42 | wrapV: 1 43 | wrapW: 1 44 | nPOTScale: 1 45 | lightmap: 0 46 | compressionQuality: 50 47 | spriteMode: 0 48 | spriteExtrude: 1 49 | spriteMeshType: 1 50 | alignment: 0 51 | spritePivot: {x: 0.5, y: 0.5} 52 | spritePixelsToUnits: 100 53 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 54 | spriteGenerateFallbackPhysicsShape: 1 55 | alphaUsage: 1 56 | alphaIsTransparency: 0 57 | spriteTessellationDetail: -1 58 | textureType: 0 59 | textureShape: 1 60 | singleChannelComponent: 0 61 | maxTextureSizeSet: 0 62 | compressionQualitySet: 0 63 | textureFormatSet: 0 64 | platformSettings: 65 | - serializedVersion: 2 66 | buildTarget: DefaultTexturePlatform 67 | maxTextureSize: 2048 68 | resizeAlgorithm: 0 69 | textureFormat: -1 70 | textureCompression: 1 71 | compressionQuality: 50 72 | crunchedCompression: 0 73 | allowsAlphaSplitting: 0 74 | overridden: 0 75 | androidETC2FallbackOverride: 0 76 | - serializedVersion: 2 77 | buildTarget: Standalone 78 | maxTextureSize: 2048 79 | resizeAlgorithm: 0 80 | textureFormat: -1 81 | textureCompression: 1 82 | compressionQuality: 50 83 | crunchedCompression: 0 84 | allowsAlphaSplitting: 0 85 | overridden: 0 86 | androidETC2FallbackOverride: 0 87 | spriteSheet: 88 | serializedVersion: 2 89 | sprites: [] 90 | outline: [] 91 | physicsShape: [] 92 | bones: [] 93 | spriteID: 94 | vertices: [] 95 | indices: 96 | edges: [] 97 | weights: [] 98 | spritePackingTag: 99 | userData: 100 | assetBundleName: 101 | assetBundleVariant: 102 | -------------------------------------------------------------------------------- /Client/Assets/Skybox/Sky_Cartoon_Airbrush_Day_NoSun_Cam_1_Back-Z.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saarg/Unity_MMO_Demo/871d9f5cce10af0d7642e1f81fcf6913bb4bf976/Client/Assets/Skybox/Sky_Cartoon_Airbrush_Day_NoSun_Cam_1_Back-Z.png -------------------------------------------------------------------------------- /Client/Assets/Skybox/Sky_Cartoon_Airbrush_Day_NoSun_Cam_1_Back-Z.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ccbc3f25708ed491e86a569f0a679e73 3 | labels: 4 | - Sky 5 | - Skies 6 | - AllSky 7 | - Skybox 8 | TextureImporter: 9 | fileIDToRecycleName: 10 | 2186277476908879412: ImportLogs 11 | externalObjects: {} 12 | serializedVersion: 5 13 | mipmaps: 14 | mipMapMode: 0 15 | enableMipMap: 0 16 | sRGBTexture: 1 17 | linearTexture: 0 18 | fadeOut: 0 19 | borderMipMap: 0 20 | mipMapsPreserveCoverage: 0 21 | alphaTestReferenceValue: 0.5 22 | mipMapFadeDistanceStart: 1 23 | mipMapFadeDistanceEnd: 3 24 | bumpmap: 25 | convertToNormalMap: 0 26 | externalNormalMap: 0 27 | heightScale: 0.25 28 | normalMapFilter: 0 29 | isReadable: 0 30 | grayScaleToAlpha: 0 31 | generateCubemap: 6 32 | cubemapConvolution: 0 33 | seamlessCubemap: 0 34 | textureFormat: -1 35 | maxTextureSize: 32 36 | textureSettings: 37 | serializedVersion: 2 38 | filterMode: -1 39 | aniso: -1 40 | mipBias: -1 41 | wrapU: 1 42 | wrapV: 1 43 | wrapW: 1 44 | nPOTScale: 1 45 | lightmap: 0 46 | compressionQuality: 50 47 | spriteMode: 0 48 | spriteExtrude: 1 49 | spriteMeshType: 1 50 | alignment: 0 51 | spritePivot: {x: 0.5, y: 0.5} 52 | spritePixelsToUnits: 100 53 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 54 | spriteGenerateFallbackPhysicsShape: 1 55 | alphaUsage: 1 56 | alphaIsTransparency: 0 57 | spriteTessellationDetail: -1 58 | textureType: 0 59 | textureShape: 1 60 | singleChannelComponent: 0 61 | maxTextureSizeSet: 0 62 | compressionQualitySet: 0 63 | textureFormatSet: 0 64 | platformSettings: 65 | - serializedVersion: 2 66 | buildTarget: DefaultTexturePlatform 67 | maxTextureSize: 2048 68 | resizeAlgorithm: 0 69 | textureFormat: -1 70 | textureCompression: 1 71 | compressionQuality: 50 72 | crunchedCompression: 0 73 | allowsAlphaSplitting: 0 74 | overridden: 0 75 | androidETC2FallbackOverride: 0 76 | - serializedVersion: 2 77 | buildTarget: Standalone 78 | maxTextureSize: 2048 79 | resizeAlgorithm: 0 80 | textureFormat: -1 81 | textureCompression: 1 82 | compressionQuality: 50 83 | crunchedCompression: 0 84 | allowsAlphaSplitting: 0 85 | overridden: 0 86 | androidETC2FallbackOverride: 0 87 | spriteSheet: 88 | serializedVersion: 2 89 | sprites: [] 90 | outline: [] 91 | physicsShape: [] 92 | bones: [] 93 | spriteID: 94 | vertices: [] 95 | indices: 96 | edges: [] 97 | weights: [] 98 | spritePackingTag: 99 | userData: 100 | assetBundleName: 101 | assetBundleVariant: 102 | -------------------------------------------------------------------------------- /Client/Assets/Skybox/Sky_Cartoon_Airbrush_Day_NoSun_Cam_2_Left+X.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saarg/Unity_MMO_Demo/871d9f5cce10af0d7642e1f81fcf6913bb4bf976/Client/Assets/Skybox/Sky_Cartoon_Airbrush_Day_NoSun_Cam_2_Left+X.png -------------------------------------------------------------------------------- /Client/Assets/Skybox/Sky_Cartoon_Airbrush_Day_NoSun_Cam_2_Left+X.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 530cdbf9e0f2f45239f957330e5cb249 3 | labels: 4 | - Sky 5 | - Skies 6 | - AllSky 7 | - Skybox 8 | TextureImporter: 9 | fileIDToRecycleName: 10 | 2186277476908879412: ImportLogs 11 | externalObjects: {} 12 | serializedVersion: 5 13 | mipmaps: 14 | mipMapMode: 0 15 | enableMipMap: 0 16 | sRGBTexture: 1 17 | linearTexture: 0 18 | fadeOut: 0 19 | borderMipMap: 0 20 | mipMapsPreserveCoverage: 0 21 | alphaTestReferenceValue: 0.5 22 | mipMapFadeDistanceStart: 1 23 | mipMapFadeDistanceEnd: 3 24 | bumpmap: 25 | convertToNormalMap: 0 26 | externalNormalMap: 0 27 | heightScale: 0.25 28 | normalMapFilter: 0 29 | isReadable: 0 30 | grayScaleToAlpha: 0 31 | generateCubemap: 6 32 | cubemapConvolution: 0 33 | seamlessCubemap: 0 34 | textureFormat: -1 35 | maxTextureSize: 32 36 | textureSettings: 37 | serializedVersion: 2 38 | filterMode: -1 39 | aniso: -1 40 | mipBias: -1 41 | wrapU: 1 42 | wrapV: 1 43 | wrapW: 1 44 | nPOTScale: 1 45 | lightmap: 0 46 | compressionQuality: 50 47 | spriteMode: 0 48 | spriteExtrude: 1 49 | spriteMeshType: 1 50 | alignment: 0 51 | spritePivot: {x: 0.5, y: 0.5} 52 | spritePixelsToUnits: 100 53 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 54 | spriteGenerateFallbackPhysicsShape: 1 55 | alphaUsage: 1 56 | alphaIsTransparency: 0 57 | spriteTessellationDetail: -1 58 | textureType: 0 59 | textureShape: 1 60 | singleChannelComponent: 0 61 | maxTextureSizeSet: 0 62 | compressionQualitySet: 0 63 | textureFormatSet: 0 64 | platformSettings: 65 | - serializedVersion: 2 66 | buildTarget: DefaultTexturePlatform 67 | maxTextureSize: 2048 68 | resizeAlgorithm: 0 69 | textureFormat: -1 70 | textureCompression: 1 71 | compressionQuality: 50 72 | crunchedCompression: 0 73 | allowsAlphaSplitting: 0 74 | overridden: 0 75 | androidETC2FallbackOverride: 0 76 | - serializedVersion: 2 77 | buildTarget: Standalone 78 | maxTextureSize: 2048 79 | resizeAlgorithm: 0 80 | textureFormat: -1 81 | textureCompression: 1 82 | compressionQuality: 50 83 | crunchedCompression: 0 84 | allowsAlphaSplitting: 0 85 | overridden: 0 86 | androidETC2FallbackOverride: 0 87 | spriteSheet: 88 | serializedVersion: 2 89 | sprites: [] 90 | outline: [] 91 | physicsShape: [] 92 | bones: [] 93 | spriteID: 94 | vertices: [] 95 | indices: 96 | edges: [] 97 | weights: [] 98 | spritePackingTag: 99 | userData: 100 | assetBundleName: 101 | assetBundleVariant: 102 | -------------------------------------------------------------------------------- /Client/Assets/Skybox/Sky_Cartoon_Airbrush_Day_NoSun_Cam_3_Right-X.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saarg/Unity_MMO_Demo/871d9f5cce10af0d7642e1f81fcf6913bb4bf976/Client/Assets/Skybox/Sky_Cartoon_Airbrush_Day_NoSun_Cam_3_Right-X.png -------------------------------------------------------------------------------- /Client/Assets/Skybox/Sky_Cartoon_Airbrush_Day_NoSun_Cam_3_Right-X.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad1066355bbf24261a04760a57add9b0 3 | labels: 4 | - Sky 5 | - Skies 6 | - AllSky 7 | - Skybox 8 | TextureImporter: 9 | fileIDToRecycleName: 10 | 2186277476908879412: ImportLogs 11 | externalObjects: {} 12 | serializedVersion: 5 13 | mipmaps: 14 | mipMapMode: 0 15 | enableMipMap: 0 16 | sRGBTexture: 1 17 | linearTexture: 0 18 | fadeOut: 0 19 | borderMipMap: 0 20 | mipMapsPreserveCoverage: 0 21 | alphaTestReferenceValue: 0.5 22 | mipMapFadeDistanceStart: 1 23 | mipMapFadeDistanceEnd: 3 24 | bumpmap: 25 | convertToNormalMap: 0 26 | externalNormalMap: 0 27 | heightScale: 0.25 28 | normalMapFilter: 0 29 | isReadable: 0 30 | grayScaleToAlpha: 0 31 | generateCubemap: 6 32 | cubemapConvolution: 0 33 | seamlessCubemap: 0 34 | textureFormat: -1 35 | maxTextureSize: 32 36 | textureSettings: 37 | serializedVersion: 2 38 | filterMode: -1 39 | aniso: -1 40 | mipBias: -1 41 | wrapU: 1 42 | wrapV: 1 43 | wrapW: 1 44 | nPOTScale: 1 45 | lightmap: 0 46 | compressionQuality: 50 47 | spriteMode: 0 48 | spriteExtrude: 1 49 | spriteMeshType: 1 50 | alignment: 0 51 | spritePivot: {x: 0.5, y: 0.5} 52 | spritePixelsToUnits: 100 53 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 54 | spriteGenerateFallbackPhysicsShape: 1 55 | alphaUsage: 1 56 | alphaIsTransparency: 0 57 | spriteTessellationDetail: -1 58 | textureType: 0 59 | textureShape: 1 60 | singleChannelComponent: 0 61 | maxTextureSizeSet: 0 62 | compressionQualitySet: 0 63 | textureFormatSet: 0 64 | platformSettings: 65 | - serializedVersion: 2 66 | buildTarget: DefaultTexturePlatform 67 | maxTextureSize: 2048 68 | resizeAlgorithm: 0 69 | textureFormat: -1 70 | textureCompression: 1 71 | compressionQuality: 50 72 | crunchedCompression: 0 73 | allowsAlphaSplitting: 0 74 | overridden: 0 75 | androidETC2FallbackOverride: 0 76 | - serializedVersion: 2 77 | buildTarget: Standalone 78 | maxTextureSize: 2048 79 | resizeAlgorithm: 0 80 | textureFormat: -1 81 | textureCompression: 1 82 | compressionQuality: 50 83 | crunchedCompression: 0 84 | allowsAlphaSplitting: 0 85 | overridden: 0 86 | androidETC2FallbackOverride: 0 87 | spriteSheet: 88 | serializedVersion: 2 89 | sprites: [] 90 | outline: [] 91 | physicsShape: [] 92 | bones: [] 93 | spriteID: 94 | vertices: [] 95 | indices: 96 | edges: [] 97 | weights: [] 98 | spritePackingTag: 99 | userData: 100 | assetBundleName: 101 | assetBundleVariant: 102 | -------------------------------------------------------------------------------- /Client/Assets/Skybox/Sky_Cartoon_Airbrush_Day_NoSun_Cam_4_Up+Y.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saarg/Unity_MMO_Demo/871d9f5cce10af0d7642e1f81fcf6913bb4bf976/Client/Assets/Skybox/Sky_Cartoon_Airbrush_Day_NoSun_Cam_4_Up+Y.png -------------------------------------------------------------------------------- /Client/Assets/Skybox/Sky_Cartoon_Airbrush_Day_NoSun_Cam_4_Up+Y.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b733fcd5d5b54a4d8f2dff5482e0126 3 | labels: 4 | - Sky 5 | - Skies 6 | - AllSky 7 | - Skybox 8 | TextureImporter: 9 | fileIDToRecycleName: 10 | 2186277476908879412: ImportLogs 11 | externalObjects: {} 12 | serializedVersion: 5 13 | mipmaps: 14 | mipMapMode: 0 15 | enableMipMap: 0 16 | sRGBTexture: 1 17 | linearTexture: 0 18 | fadeOut: 0 19 | borderMipMap: 0 20 | mipMapsPreserveCoverage: 0 21 | alphaTestReferenceValue: 0.5 22 | mipMapFadeDistanceStart: 1 23 | mipMapFadeDistanceEnd: 3 24 | bumpmap: 25 | convertToNormalMap: 0 26 | externalNormalMap: 0 27 | heightScale: 0.25 28 | normalMapFilter: 0 29 | isReadable: 0 30 | grayScaleToAlpha: 0 31 | generateCubemap: 6 32 | cubemapConvolution: 0 33 | seamlessCubemap: 0 34 | textureFormat: -1 35 | maxTextureSize: 32 36 | textureSettings: 37 | serializedVersion: 2 38 | filterMode: -1 39 | aniso: -1 40 | mipBias: -1 41 | wrapU: 1 42 | wrapV: 1 43 | wrapW: 1 44 | nPOTScale: 1 45 | lightmap: 0 46 | compressionQuality: 50 47 | spriteMode: 0 48 | spriteExtrude: 1 49 | spriteMeshType: 1 50 | alignment: 0 51 | spritePivot: {x: 0.5, y: 0.5} 52 | spritePixelsToUnits: 100 53 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 54 | spriteGenerateFallbackPhysicsShape: 1 55 | alphaUsage: 1 56 | alphaIsTransparency: 0 57 | spriteTessellationDetail: -1 58 | textureType: 0 59 | textureShape: 1 60 | singleChannelComponent: 0 61 | maxTextureSizeSet: 0 62 | compressionQualitySet: 0 63 | textureFormatSet: 0 64 | platformSettings: 65 | - serializedVersion: 2 66 | buildTarget: DefaultTexturePlatform 67 | maxTextureSize: 2048 68 | resizeAlgorithm: 0 69 | textureFormat: -1 70 | textureCompression: 1 71 | compressionQuality: 50 72 | crunchedCompression: 0 73 | allowsAlphaSplitting: 0 74 | overridden: 0 75 | androidETC2FallbackOverride: 0 76 | - serializedVersion: 2 77 | buildTarget: Standalone 78 | maxTextureSize: 2048 79 | resizeAlgorithm: 0 80 | textureFormat: -1 81 | textureCompression: 1 82 | compressionQuality: 50 83 | crunchedCompression: 0 84 | allowsAlphaSplitting: 0 85 | overridden: 0 86 | androidETC2FallbackOverride: 0 87 | spriteSheet: 88 | serializedVersion: 2 89 | sprites: [] 90 | outline: [] 91 | physicsShape: [] 92 | bones: [] 93 | spriteID: 94 | vertices: [] 95 | indices: 96 | edges: [] 97 | weights: [] 98 | spritePackingTag: 99 | userData: 100 | assetBundleName: 101 | assetBundleVariant: 102 | -------------------------------------------------------------------------------- /Client/Assets/Skybox/Sky_Cartoon_Airbrush_Day_NoSun_Cam_5_Down-Y.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saarg/Unity_MMO_Demo/871d9f5cce10af0d7642e1f81fcf6913bb4bf976/Client/Assets/Skybox/Sky_Cartoon_Airbrush_Day_NoSun_Cam_5_Down-Y.png -------------------------------------------------------------------------------- /Client/Assets/Skybox/Sky_Cartoon_Airbrush_Day_NoSun_Cam_5_Down-Y.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0986bee61deb042389dfc7a860a1fa3a 3 | labels: 4 | - Sky 5 | - Skies 6 | - AllSky 7 | - Skybox 8 | TextureImporter: 9 | fileIDToRecycleName: 10 | 2186277476908879412: ImportLogs 11 | externalObjects: {} 12 | serializedVersion: 5 13 | mipmaps: 14 | mipMapMode: 0 15 | enableMipMap: 0 16 | sRGBTexture: 1 17 | linearTexture: 0 18 | fadeOut: 0 19 | borderMipMap: 0 20 | mipMapsPreserveCoverage: 0 21 | alphaTestReferenceValue: 0.5 22 | mipMapFadeDistanceStart: 1 23 | mipMapFadeDistanceEnd: 3 24 | bumpmap: 25 | convertToNormalMap: 0 26 | externalNormalMap: 0 27 | heightScale: 0.25 28 | normalMapFilter: 0 29 | isReadable: 0 30 | grayScaleToAlpha: 0 31 | generateCubemap: 6 32 | cubemapConvolution: 0 33 | seamlessCubemap: 0 34 | textureFormat: -1 35 | maxTextureSize: 32 36 | textureSettings: 37 | serializedVersion: 2 38 | filterMode: -1 39 | aniso: -1 40 | mipBias: -1 41 | wrapU: 1 42 | wrapV: 1 43 | wrapW: 1 44 | nPOTScale: 1 45 | lightmap: 0 46 | compressionQuality: 50 47 | spriteMode: 0 48 | spriteExtrude: 1 49 | spriteMeshType: 1 50 | alignment: 0 51 | spritePivot: {x: 0.5, y: 0.5} 52 | spritePixelsToUnits: 100 53 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 54 | spriteGenerateFallbackPhysicsShape: 1 55 | alphaUsage: 1 56 | alphaIsTransparency: 0 57 | spriteTessellationDetail: -1 58 | textureType: 0 59 | textureShape: 1 60 | singleChannelComponent: 0 61 | maxTextureSizeSet: 0 62 | compressionQualitySet: 0 63 | textureFormatSet: 0 64 | platformSettings: 65 | - serializedVersion: 2 66 | buildTarget: DefaultTexturePlatform 67 | maxTextureSize: 2048 68 | resizeAlgorithm: 0 69 | textureFormat: -1 70 | textureCompression: 1 71 | compressionQuality: 50 72 | crunchedCompression: 0 73 | allowsAlphaSplitting: 0 74 | overridden: 0 75 | androidETC2FallbackOverride: 0 76 | - serializedVersion: 2 77 | buildTarget: Standalone 78 | maxTextureSize: 2048 79 | resizeAlgorithm: 0 80 | textureFormat: -1 81 | textureCompression: 1 82 | compressionQuality: 50 83 | crunchedCompression: 0 84 | allowsAlphaSplitting: 0 85 | overridden: 0 86 | androidETC2FallbackOverride: 0 87 | spriteSheet: 88 | serializedVersion: 2 89 | sprites: [] 90 | outline: [] 91 | physicsShape: [] 92 | bones: [] 93 | spriteID: 94 | vertices: [] 95 | indices: 96 | edges: [] 97 | weights: [] 98 | spritePackingTag: 99 | userData: 100 | assetBundleName: 101 | assetBundleVariant: 102 | -------------------------------------------------------------------------------- /Client/Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /Client/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 1024 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_AmbisonicDecoderPlugin: 16 | m_DisableAudio: 0 17 | m_VirtualizeEffects: 1 18 | -------------------------------------------------------------------------------- /Client/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /Client/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 1 23 | m_ClothInterCollisionSettingsToggle: 0 24 | m_ContactPairsMode: 0 25 | m_BroadphaseType: 0 26 | m_WorldBounds: 27 | m_Center: {x: 0, y: 0, z: 0} 28 | m_Extent: {x: 250, y: 250, z: 250} 29 | m_WorldSubdivisions: 8 30 | -------------------------------------------------------------------------------- /Client/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/Scenes/MainScene.unity 10 | guid: 99c9720ab356a0642a771bea13969a05 11 | - enabled: 1 12 | path: Assets/Scenes/Server1.unity 13 | guid: 08c048535083a44cab9a0ff7cf311c0e 14 | - enabled: 1 15 | path: Assets/Scenes/Server2.unity 16 | guid: 349a4eeaf39b44e5a9cf61ad3c80db61 17 | m_configObjects: {} 18 | -------------------------------------------------------------------------------- /Client/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 0 11 | m_SpritePackerMode: 0 12 | m_SpritePackerPaddingPower: 1 13 | m_EtcTextureCompressorBehavior: 1 14 | m_EtcTextureFastCompressor: 1 15 | m_EtcTextureNormalCompressor: 2 16 | m_EtcTextureBestCompressor: 4 17 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 18 | m_ProjectGenerationRootNamespace: 19 | m_UserGeneratedProjectSuffix: 20 | m_CollabEditorSettings: 21 | inProgressEnabled: 1 22 | -------------------------------------------------------------------------------- /Client/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 40 | m_PreloadedShaders: [] 41 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 42 | type: 0} 43 | m_CustomRenderPipeline: {fileID: 0} 44 | m_TransparencySortMode: 0 45 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 46 | m_DefaultRenderingPath: 1 47 | m_DefaultMobileRenderingPath: 1 48 | m_TierSettings: [] 49 | m_LightmapStripping: 0 50 | m_FogStripping: 0 51 | m_InstancingStripping: 0 52 | m_LightmapKeepPlain: 1 53 | m_LightmapKeepDirCombined: 1 54 | m_LightmapKeepDynamicPlain: 1 55 | m_LightmapKeepDynamicDirCombined: 1 56 | m_LightmapKeepShadowMask: 1 57 | m_LightmapKeepSubtractive: 1 58 | m_FogKeepLinear: 1 59 | m_FogKeepExp: 1 60 | m_FogKeepExp2: 1 61 | m_AlbedoSwatchInfos: [] 62 | m_LightsUseLinearIntensity: 0 63 | m_LightsUseColorTemperature: 0 64 | -------------------------------------------------------------------------------- /Client/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /Client/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /Client/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /Client/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_AutoSimulation: 1 23 | m_QueriesHitTriggers: 1 24 | m_QueriesStartInColliders: 1 25 | m_ChangeStopsCallbacks: 0 26 | m_CallbacksOnDisable: 1 27 | m_AutoSyncTransforms: 1 28 | m_AlwaysShowColliders: 0 29 | m_ShowColliderSleep: 1 30 | m_ShowColliderContacts: 0 31 | m_ShowColliderAABB: 0 32 | m_ContactArrowScale: 0.2 33 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 34 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 35 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 36 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 37 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 38 | -------------------------------------------------------------------------------- /Client/ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: 7 | - type: 8 | m_NativeTypeID: 108 9 | m_ManagedTypePPtr: {fileID: 0} 10 | m_ManagedTypeFallback: 11 | defaultPresets: 12 | - m_Preset: {fileID: 2655988077585873504, guid: c1cf8506f04ef2c4a88b64b6c4202eea, 13 | type: 2} 14 | - type: 15 | m_NativeTypeID: 1020 16 | m_ManagedTypePPtr: {fileID: 0} 17 | m_ManagedTypeFallback: 18 | defaultPresets: 19 | - m_Preset: {fileID: 2655988077585873504, guid: 0cd792cc87e492d43b4e95b205fc5cc6, 20 | type: 2} 21 | - type: 22 | m_NativeTypeID: 1006 23 | m_ManagedTypePPtr: {fileID: 0} 24 | m_ManagedTypeFallback: 25 | defaultPresets: 26 | - m_Preset: {fileID: 2655988077585873504, guid: 7a99f8aa944efe94cb9bd74562b7d5f9, 27 | type: 2} 28 | -------------------------------------------------------------------------------- /Client/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2018.1.2f1 2 | -------------------------------------------------------------------------------- /Client/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | particleRaycastBudget: 4 33 | asyncUploadTimeSlice: 2 34 | asyncUploadBufferSize: 4 35 | resolutionScalingFixedDPIFactor: 1 36 | excludedTargetPlatforms: [] 37 | - serializedVersion: 2 38 | name: Low 39 | pixelLightCount: 0 40 | shadows: 0 41 | shadowResolution: 0 42 | shadowProjection: 1 43 | shadowCascades: 1 44 | shadowDistance: 20 45 | shadowNearPlaneOffset: 3 46 | shadowCascade2Split: 0.33333334 47 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 48 | shadowmaskMode: 0 49 | blendWeights: 2 50 | textureQuality: 0 51 | anisotropicTextures: 0 52 | antiAliasing: 0 53 | softParticles: 0 54 | softVegetation: 0 55 | realtimeReflectionProbes: 0 56 | billboardsFaceCameraPosition: 0 57 | vSyncCount: 0 58 | lodBias: 0.4 59 | maximumLODLevel: 0 60 | particleRaycastBudget: 16 61 | asyncUploadTimeSlice: 2 62 | asyncUploadBufferSize: 4 63 | resolutionScalingFixedDPIFactor: 1 64 | excludedTargetPlatforms: [] 65 | - serializedVersion: 2 66 | name: Medium 67 | pixelLightCount: 1 68 | shadows: 1 69 | shadowResolution: 0 70 | shadowProjection: 1 71 | shadowCascades: 1 72 | shadowDistance: 20 73 | shadowNearPlaneOffset: 3 74 | shadowCascade2Split: 0.33333334 75 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 76 | shadowmaskMode: 0 77 | blendWeights: 2 78 | textureQuality: 0 79 | anisotropicTextures: 1 80 | antiAliasing: 0 81 | softParticles: 0 82 | softVegetation: 0 83 | realtimeReflectionProbes: 0 84 | billboardsFaceCameraPosition: 0 85 | vSyncCount: 1 86 | lodBias: 0.7 87 | maximumLODLevel: 0 88 | particleRaycastBudget: 64 89 | asyncUploadTimeSlice: 2 90 | asyncUploadBufferSize: 4 91 | resolutionScalingFixedDPIFactor: 1 92 | excludedTargetPlatforms: [] 93 | - serializedVersion: 2 94 | name: High 95 | pixelLightCount: 2 96 | shadows: 2 97 | shadowResolution: 1 98 | shadowProjection: 1 99 | shadowCascades: 2 100 | shadowDistance: 40 101 | shadowNearPlaneOffset: 3 102 | shadowCascade2Split: 0.33333334 103 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 104 | shadowmaskMode: 1 105 | blendWeights: 2 106 | textureQuality: 0 107 | anisotropicTextures: 1 108 | antiAliasing: 2 109 | softParticles: 0 110 | softVegetation: 1 111 | realtimeReflectionProbes: 1 112 | billboardsFaceCameraPosition: 1 113 | vSyncCount: 1 114 | lodBias: 1 115 | maximumLODLevel: 0 116 | particleRaycastBudget: 256 117 | asyncUploadTimeSlice: 2 118 | asyncUploadBufferSize: 4 119 | resolutionScalingFixedDPIFactor: 1 120 | excludedTargetPlatforms: [] 121 | - serializedVersion: 2 122 | name: Very High 123 | pixelLightCount: 3 124 | shadows: 2 125 | shadowResolution: 2 126 | shadowProjection: 1 127 | shadowCascades: 2 128 | shadowDistance: 40 129 | shadowNearPlaneOffset: 3 130 | shadowCascade2Split: 0.33333334 131 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 132 | shadowmaskMode: 1 133 | blendWeights: 4 134 | textureQuality: 0 135 | anisotropicTextures: 1 136 | antiAliasing: 4 137 | softParticles: 1 138 | softVegetation: 1 139 | realtimeReflectionProbes: 1 140 | billboardsFaceCameraPosition: 1 141 | vSyncCount: 1 142 | lodBias: 1.5 143 | maximumLODLevel: 0 144 | particleRaycastBudget: 1024 145 | asyncUploadTimeSlice: 2 146 | asyncUploadBufferSize: 4 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Ultra 151 | pixelLightCount: 4 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 4 156 | shadowDistance: 150 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 1 164 | antiAliasing: 4 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 2 171 | maximumLODLevel: 0 172 | particleRaycastBudget: 4096 173 | asyncUploadTimeSlice: 2 174 | asyncUploadBufferSize: 4 175 | resolutionScalingFixedDPIFactor: 1 176 | excludedTargetPlatforms: [] 177 | m_PerPlatformDefaultQuality: 178 | Android: 2 179 | Nintendo 3DS: 5 180 | Nintendo Switch: 5 181 | PS4: 5 182 | PSP2: 2 183 | Standalone: 5 184 | Tizen: 2 185 | WebGL: 3 186 | WiiU: 5 187 | Windows Store Apps: 5 188 | XboxOne: 5 189 | iPhone: 2 190 | tvOS: 2 191 | -------------------------------------------------------------------------------- /Client/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - PostProcessing 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /Client/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.0167 7 | Maximum Allowed Timestep: 0.1 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /Client/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | m_TestInitMode: 0 11 | CrashReportingSettings: 12 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 13 | m_NativeEventUrl: https://perf-events.cloud.unity3d.com/symbolicate 14 | m_Enabled: 0 15 | m_CaptureEditorExceptions: 1 16 | UnityPurchasingSettings: 17 | m_Enabled: 0 18 | m_TestMode: 0 19 | UnityAnalyticsSettings: 20 | m_Enabled: 1 21 | m_InitializeOnStartup: 1 22 | m_TestMode: 0 23 | m_TestEventUrl: 24 | m_TestConfigUrl: 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /Images/4Clients.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saarg/Unity_MMO_Demo/871d9f5cce10af0d7642e1f81fcf6913bb4bf976/Images/4Clients.png -------------------------------------------------------------------------------- /Images/ServerLogs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saarg/Unity_MMO_Demo/871d9f5cce10af0d7642e1f81fcf6913bb4bf976/Images/ServerLogs.png -------------------------------------------------------------------------------- /Images/arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saarg/Unity_MMO_Demo/871d9f5cce10af0d7642e1f81fcf6913bb4bf976/Images/arch.png -------------------------------------------------------------------------------- /Images/distributed_concept.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saarg/Unity_MMO_Demo/871d9f5cce10af0d7642e1f81fcf6913bb4bf976/Images/distributed_concept.png -------------------------------------------------------------------------------- /Images/goal_arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saarg/Unity_MMO_Demo/871d9f5cce10af0d7642e1f81fcf6913bb4bf976/Images/goal_arch.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unity MMO Demo 2 | 3 | This project is a client authoritative event based multiplayer implementation. The idea is to keep the server load as light as possible and divide the load across multiple servers. Instead of having one big server doing all the work we have multiple servers as shown in this picture: 4 | 5 | ![concept illustration](Images/distributed_concept.png) 6 | 7 | ## Client 8 | The client is a unity package made with unity 2018.1 but should worlk with all the recent versions of Unity. It is inspired by Unet's implementation as we wanted to use it in the same way. Each server is a scene loaded as an additive scene. The idea is that the connection to the server is linked to the world and not the player. 9 | 10 | For now we only provide spawning and moving player objects but this project could be extended for objects and other messages, the next messages that would need to be added would be RPC's, SyncVar and NetworkedAnimators. 11 | 12 | The result on a scaled down world with 4 clients is shown on the next screenshot: 13 | 14 | ![concept illustration](Images/4Clients.png) 15 | 16 | ### Setup 17 | Just clone the repo and open the Client folder with Unity 18 | 19 | ## Server 20 | The current Server architechture is a simple 2 servers side by side implementation with a lot of hardcoded values. The clients are only connected to one server at a time and if the player is on the border to the other server it's messages are sent by the server to the other server. 21 | 22 | ![concept illustration](Images/arch.png) 23 | 24 | To this project in a live environment we would need to add some flexibility on the placement and number of servers. In order to do that we would need to make an hypervisor in charge of distributing id's and creating/stopping servers using a cloud API. This would allow us to optimise the server time and manage player id's and databases. 25 | 26 | ![concept illustration](Images/goal_arch.png) 27 | 28 | ### Setup 29 | The Server is Unix only, it was made on Ubuntu so it should work on all debian distros but i'm nut sure about other os's (Windows go away). 30 | 31 | Compile: `make` 32 | 33 | Start server 1: `./Server 9501 9502` 34 | 35 | Start server 2: `./Server 9502 9501` 36 | 37 | technicly you could add server and change ports of the server but the border managment is hardcoded for server 9501 and 9502. This is due to the fact that this project was a short term school project. 38 | 39 | ![concept illustration](Images/ServerLogs.png) 40 | 41 | ## Licence / Contribute 42 | This is all free to fork/use with no licence do as you want. You can fork, improve and do pull requests as you want and give us a shoutout if you use this. -------------------------------------------------------------------------------- /Server/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | .vscode 3 | *.exe 4 | Server 5 | -------------------------------------------------------------------------------- /Server/makefile: -------------------------------------------------------------------------------- 1 | CC = g++ 2 | CFLAGS= -std=c++11 -Wall -g 3 | EXEC_NAME = Server 4 | INCLUDES = 5 | LIBS = -pthread 6 | OBJ_FILES = $(patsubst %.cpp,%.o,$(wildcard src/**/*.cpp)) \ 7 | $(patsubst %.cpp,%.o,$(wildcard src/*.cpp)) 8 | INSTALL_DIR = /usr/bin 9 | 10 | all : $(EXEC_NAME) 11 | 12 | clean : 13 | rm $(EXEC_NAME) $(OBJ_FILES) 14 | 15 | $(EXEC_NAME) : $(OBJ_FILES) 16 | $(CC) -o $(EXEC_NAME) $(OBJ_FILES) $(LIBS) 17 | 18 | %.o: %.cpp 19 | $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< 20 | 21 | install : 22 | cp $(EXEC_NAME) $(INSTALL_DIR)gm -------------------------------------------------------------------------------- /Server/src/NetworkMessages/despawnMessage.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DESPAWN_MESSAGE_HPP 2 | #define DESPAWN_MESSAGE_HPP 3 | 4 | #include 5 | 6 | #include "networkMessage.hpp" 7 | 8 | class DespawnMessage: public NetworkMessage { 9 | public: 10 | DespawnMessage(): NetworkMessage(3, 1 + sizeof(int)) {} 11 | 12 | ~DespawnMessage() {} 13 | 14 | virtual char* Serialize() { 15 | short offset = 0; 16 | 17 | (*(int*)(buffer + offset)) = size; 18 | offset += sizeof(int); 19 | 20 | buffer[offset++] = id; 21 | 22 | // client id 23 | (*(int*)(buffer + offset)) = objectId; 24 | offset += sizeof(int); 25 | 26 | 27 | return buffer; 28 | } 29 | 30 | virtual void Deserialize(char* buffer) { 31 | short offset = 1; 32 | 33 | // client id 34 | objectId = (*(int*)(buffer + offset)); 35 | offset += sizeof(int); 36 | } 37 | 38 | int objectId = -1; 39 | }; 40 | #endif -------------------------------------------------------------------------------- /Server/src/NetworkMessages/enableMessage.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ENABLE_MESSAGE_HPP 2 | #define ENABLE_MESSAGE_HPP 3 | 4 | #include 5 | 6 | #include "networkMessage.hpp" 7 | 8 | class EnableMessage: public NetworkMessage { 9 | public: 10 | EnableMessage(): NetworkMessage(4, 1 + sizeof(int) + 7*sizeof(float) + sizeof(bool)) {} 11 | 12 | ~EnableMessage() {} 13 | 14 | virtual char* Serialize() { 15 | short offset = 0; 16 | 17 | (*(int*)(buffer + offset)) = size; 18 | offset += sizeof(int); 19 | 20 | buffer[offset++] = id; 21 | 22 | (*(int*)(buffer + offset)) = objectId; 23 | offset += sizeof(int); 24 | (*(bool*)(buffer + offset)) = toEnable; 25 | offset += sizeof(bool); 26 | 27 | (*(float*)(buffer + offset)) = position[0]; 28 | offset += sizeof(float); 29 | (*(float*)(buffer + offset)) = position[1]; 30 | offset += sizeof(float); 31 | (*(float*)(buffer + offset)) = position[2]; 32 | offset += sizeof(float); 33 | 34 | (*(float*)(buffer + offset)) = rotation[0]; 35 | offset += sizeof(float); 36 | (*(float*)(buffer + offset)) = rotation[1]; 37 | offset += sizeof(float); 38 | (*(float*)(buffer + offset)) = rotation[2]; 39 | offset += sizeof(float); 40 | (*(float*)(buffer + offset)) = rotation[3]; 41 | offset += sizeof(float); 42 | 43 | 44 | return buffer; 45 | } 46 | 47 | virtual void Deserialize(char* buffer) { 48 | short offset = 1; 49 | 50 | objectId = (*(int*)(buffer + offset)); 51 | offset += sizeof(int); 52 | 53 | toEnable = (*(bool*)(buffer + offset)); 54 | offset += sizeof(bool); 55 | 56 | position[0] = (*(float*)(buffer + offset)); 57 | offset += sizeof(float); 58 | position[1] = (*(float*)(buffer + offset)); 59 | offset += sizeof(float); 60 | position[2] = (*(float*)(buffer + offset)); 61 | offset += sizeof(float); 62 | 63 | rotation[0] = (*(float*)(buffer + offset)); 64 | offset += sizeof(float); 65 | rotation[1] = (*(float*)(buffer + offset)); 66 | offset += sizeof(float); 67 | rotation[2] = (*(float*)(buffer + offset)); 68 | offset += sizeof(float); 69 | rotation[3] = (*(float*)(buffer + offset)); 70 | offset += sizeof(float); 71 | } 72 | 73 | int objectId = -1; 74 | bool toEnable = false; 75 | 76 | float position[3]; 77 | float rotation[4]; 78 | }; 79 | #endif 80 | -------------------------------------------------------------------------------- /Server/src/NetworkMessages/networkMessage.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NETWORK_MESSAGE_HPP 2 | #define NETWORK_MESSAGE_HPP 3 | 4 | #include 5 | 6 | class NetworkMessage { 7 | public: 8 | NetworkMessage(int id, int size): id(id), size(size) { 9 | buffer = new char[size]; 10 | } 11 | 12 | ~NetworkMessage() { 13 | delete[] buffer; 14 | } 15 | 16 | virtual char* Serialize() { return nullptr; } 17 | virtual void Deserialize(char* buffer) { } 18 | 19 | inline void Send(int socket) { send(socket, Serialize(), size + sizeof(int), 0); } 20 | 21 | inline int Id() { return id; } 22 | inline int Size() { return size; } 23 | 24 | protected: 25 | int id = 0; 26 | int size = 1; 27 | 28 | char* buffer; 29 | }; 30 | 31 | #endif -------------------------------------------------------------------------------- /Server/src/NetworkMessages/spawnMessage.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SPAWN_MESSAGE_HPP 2 | #define SPAWN_MESSAGE_HPP 3 | 4 | #include 5 | 6 | #include "networkMessage.hpp" 7 | 8 | class SpawnMessage: public NetworkMessage { 9 | public: 10 | SpawnMessage(): NetworkMessage(2, 1 + 2 * sizeof(int) + sizeof(bool)) {} 11 | 12 | ~SpawnMessage() {} 13 | 14 | virtual char* Serialize() { 15 | short offset = 0; 16 | 17 | (*(int*)(buffer + offset)) = size; 18 | offset += sizeof(int); 19 | 20 | buffer[offset++] = id; 21 | 22 | // player prefab id is 0 23 | (*(int*)(buffer + offset)) = prefabId; 24 | offset += sizeof(int); 25 | // client id 26 | (*(int*)(buffer + offset)) = objectId; 27 | offset += sizeof(int); 28 | 29 | (*(bool*)(buffer + offset)) = hasAuthority; 30 | offset += sizeof(bool); 31 | 32 | return buffer; 33 | } 34 | 35 | virtual void Deserialize(char* buffer) { 36 | short offset = 1; 37 | 38 | // player prefab id is 0 39 | prefabId = (*(int*)(buffer + offset)); 40 | offset += sizeof(int); 41 | // object requesting spawn or id of new object 42 | objectId = (*(int*)(buffer + offset)); 43 | offset += sizeof(int); 44 | 45 | hasAuthority = (*(bool*)(buffer + offset)); 46 | offset += sizeof(bool); 47 | } 48 | 49 | int prefabId = -1; 50 | int objectId = -1; 51 | bool hasAuthority = false; 52 | }; 53 | #endif -------------------------------------------------------------------------------- /Server/src/NetworkMessages/transformMessage.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TRANSFORM_MESSAGE_HPP 2 | #define TRANSFORM_MESSAGE_HPP 3 | 4 | #include 5 | 6 | #include "networkMessage.hpp" 7 | #include "../player.hpp" 8 | 9 | class TransformMessage: public NetworkMessage { 10 | public: 11 | TransformMessage(): NetworkMessage(1, 1 + sizeof(int) + 7*sizeof(float)) {} 12 | 13 | ~TransformMessage() {} 14 | 15 | virtual char* Serialize() { 16 | short offset = 0; 17 | 18 | (*(int*)(buffer + offset)) = size; 19 | offset += sizeof(int); 20 | 21 | buffer[offset++] = id; 22 | 23 | 24 | (*(int*)(buffer + offset)) = sourceId; 25 | offset += sizeof(int); 26 | 27 | (*(float*)(buffer + offset)) = position[0]; 28 | offset += sizeof(float); 29 | (*(float*)(buffer + offset)) = position[1]; 30 | offset += sizeof(float); 31 | (*(float*)(buffer + offset)) = position[2]; 32 | offset += sizeof(float); 33 | 34 | (*(float*)(buffer + offset)) = rotation[0]; 35 | offset += sizeof(float); 36 | (*(float*)(buffer + offset)) = rotation[1]; 37 | offset += sizeof(float); 38 | (*(float*)(buffer + offset)) = rotation[2]; 39 | offset += sizeof(float); 40 | (*(float*)(buffer + offset)) = rotation[3]; 41 | offset += sizeof(float); 42 | 43 | return buffer; 44 | } 45 | 46 | virtual void Deserialize(char* buffer) { 47 | short offset = 1; 48 | 49 | sourceId = (*(int*)(buffer + offset)); 50 | offset += sizeof(int); 51 | 52 | position[0] = (*(float*)(buffer + offset)); 53 | offset += sizeof(float); 54 | position[1] = (*(float*)(buffer + offset)); 55 | offset += sizeof(float); 56 | position[2] = (*(float*)(buffer + offset)); 57 | offset += sizeof(float); 58 | 59 | rotation[0] = (*(float*)(buffer + offset)); 60 | offset += sizeof(float); 61 | rotation[1] = (*(float*)(buffer + offset)); 62 | offset += sizeof(float); 63 | rotation[2] = (*(float*)(buffer + offset)); 64 | offset += sizeof(float); 65 | rotation[3] = (*(float*)(buffer + offset)); 66 | offset += sizeof(float); 67 | } 68 | 69 | int sourceId; 70 | float position[3]; 71 | float rotation[4]; 72 | }; 73 | #endif -------------------------------------------------------------------------------- /Server/src/game.cpp: -------------------------------------------------------------------------------- 1 | #include "game.hpp" 2 | 3 | #include "NetworkMessages/despawnMessage.hpp" 4 | #include "NetworkMessages/enableMessage.hpp" 5 | #include "NetworkMessages/spawnMessage.hpp" 6 | #include "NetworkMessages/transformMessage.hpp" 7 | 8 | #include "player.hpp" 9 | #include "playerThread.hpp" 10 | 11 | Game::Game(int serverId, std::vector& clients, std::map& servers, std::map& players): 12 | server(serverId, 0), clients(clients), servers(servers), players(players) { 13 | 14 | server.SetPlayers(&players); 15 | } 16 | 17 | void Game::Run() { 18 | loop = new std::thread(&Game::Loop, this); 19 | } 20 | 21 | void Game::Spawn(int prefabId, int owner, bool hasAuthority) { 22 | objects[++lastValidId] = owner; 23 | 24 | SpawnMessage msg; 25 | msg.prefabId = prefabId; 26 | msg.objectId = lastValidId; 27 | 28 | for (std::vector::iterator jt = clients.begin(); jt != clients.end(); jt++) { 29 | msg.hasAuthority = (owner == *jt && hasAuthority); 30 | 31 | msg.Send(*jt); 32 | } 33 | } 34 | 35 | void Game::SpawnPlayer(int clientSocket) { 36 | // Init player 37 | Player& p1 = players[clientSocket] = Player(clientSocket); 38 | 39 | // Sending spawn message to all clients including myself 40 | SpawnMessage msg; 41 | 42 | msg.prefabId = 0; 43 | msg.objectId = clientSocket; 44 | 45 | msg.hasAuthority = true; 46 | msg.Send(clientSocket); 47 | 48 | for (std::vector::iterator it = clients.begin(); it != clients.end(); it++) { 49 | msg.hasAuthority = false; 50 | 51 | msg.Send(*it); 52 | } 53 | 54 | // Spawn all already spawned players 55 | SpawnMessage msg2; 56 | 57 | msg2.prefabId = 0; 58 | msg2.hasAuthority = false; 59 | 60 | for (std::vector::iterator it = clients.begin(); it != clients.end(); it++) { 61 | if (clientSocket == *it) 62 | continue; 63 | 64 | msg2.objectId = *it; 65 | 66 | msg2.Send(clientSocket); 67 | 68 | Player& p2 = players[*it]; 69 | float distVector[3] = {p1.position[0], p1.position[1], p1.position[2]}; 70 | 71 | distVector[0] -= p2.position[0]; 72 | distVector[1] -= p2.position[1]; 73 | distVector[2] -= p2.position[2]; 74 | 75 | float sqrMagnitude = distVector[0]*distVector[0] + distVector[1]*distVector[1] + distVector[2]*distVector[2]; 76 | float sqrRadius = p1.interestRadius*p1.interestRadius; 77 | 78 | if (sqrMagnitude > sqrRadius) { // Player not in interest radius 79 | EnableMessage emsg; 80 | emsg.objectId = *it; 81 | emsg.toEnable = false; 82 | 83 | emsg.position[0] = p2.position[0]; 84 | emsg.position[1] = p2.position[1]; 85 | emsg.position[2] = p2.position[2]; 86 | 87 | emsg.rotation[0] = p2.rotation[0]; 88 | emsg.rotation[1] = p2.rotation[1]; 89 | emsg.rotation[2] = p2.rotation[2]; 90 | emsg.rotation[3] = p2.rotation[3]; 91 | 92 | p1.playerSeen.erase(*it); 93 | 94 | emsg.Send(clientSocket); 95 | 96 | emsg.objectId = clientSocket; 97 | emsg.Send(*it); 98 | } 99 | } 100 | 101 | // Player can now be seen by others 102 | clients.push_back(clientSocket); 103 | 104 | players[clientSocket].pthread = new PlayerThread(clientSocket, players[clientSocket], *this); 105 | players[clientSocket].pthread->Run(); 106 | 107 | for (std::map::iterator it=servers.begin(); it!=servers.end(); it++) { 108 | it->second->SpawnFor(players[clientSocket]); 109 | } 110 | } 111 | 112 | void Game::Despawn(int objectId) { 113 | DespawnMessage msg; 114 | msg.objectId = objectId; 115 | 116 | for (std::vector::iterator jt = clients.begin(); jt != clients.end(); jt++) { 117 | msg.Send(*jt); 118 | } 119 | } 120 | 121 | void Game::DespawnPlayer(int clientSocket) { 122 | clients.erase(std::remove(clients.begin(), clients.end(), clientSocket), clients.end()); 123 | 124 | if (players.count(clientSocket) != 0) { 125 | players[clientSocket].pthread->running = false; 126 | } 127 | players.erase(clientSocket); 128 | 129 | DespawnMessage msg; 130 | msg.objectId = clientSocket; 131 | 132 | for (std::vector::iterator jt = clients.begin(); jt != clients.end(); jt++) { 133 | msg.Send(*jt); 134 | } 135 | 136 | close(clientSocket); 137 | 138 | for (std::map::iterator it=servers.begin(); it!=servers.end(); it++) { 139 | it->second->RemovePlayer(clientSocket, false); 140 | msg.Send(it->second->GetSocket()); 141 | } 142 | } 143 | 144 | void Game::SendMsgTo(NetworkMessage* msg, int targetId) { 145 | int socket = players[targetId].pthread->GetSocket(); 146 | 147 | if (socket > 0) 148 | msg->Send(socket); 149 | } 150 | 151 | void Game::SendMsgTo(NetworkMessage* msg, Player& target) { 152 | int socket = target.pthread->GetSocket(); 153 | 154 | if (socket > 0) 155 | msg->Send(socket); 156 | } 157 | 158 | void Game::SendMsgToAllInterested(NetworkMessage* msg, Player* p1) { 159 | SendMsgToAll(msg, p1); 160 | } 161 | 162 | void Game::SendMsgToAllNotInterested(NetworkMessage* msg, Player* p1) { 163 | SendMsgToAll(msg, p1, false); 164 | } 165 | 166 | void Game::SendMsgToAll(NetworkMessage* msg, Player* p1, bool interestedOnly) { 167 | for (std::map::iterator it=players.begin(); it!=players.end(); it++) { 168 | int id = it->first; 169 | Player& p2 = it->second; 170 | 171 | if (p1 == NULL) { 172 | SendMsgTo(msg, id); 173 | continue; 174 | } 175 | 176 | int p1Id = p1->id; 177 | 178 | float distVector[3] = {p2.position[0], p2.position[1], p2.position[2]}; 179 | 180 | distVector[0] -= p1->position[0]; 181 | distVector[1] -= p1->position[1]; 182 | distVector[2] -= p1->position[2]; 183 | 184 | float sqrMagnitude = distVector[0]*distVector[0] + distVector[1]*distVector[1] + distVector[2]*distVector[2]; 185 | float sqrRadius = p2.interestRadius*p2.interestRadius; 186 | 187 | if (sqrMagnitude > sqrRadius) { // Player not in interest radius 188 | if (p2.playerSeen.count(p1Id) != 0) { 189 | EnableMessage emsg; 190 | emsg.objectId = p1Id; 191 | emsg.toEnable = false; 192 | 193 | emsg.position[0] = p1->position[0]; 194 | emsg.position[1] = p1->position[1]; 195 | emsg.position[2] = p1->position[2]; 196 | 197 | emsg.rotation[0] = p1->rotation[0]; 198 | emsg.rotation[1] = p1->rotation[1]; 199 | emsg.rotation[2] = p1->rotation[2]; 200 | emsg.rotation[3] = p1->rotation[3]; 201 | 202 | p2.playerSeen.erase(p1Id); 203 | SendMsgTo(&emsg, id); 204 | } 205 | 206 | if (!interestedOnly) 207 | SendMsgTo(msg, id); 208 | } else { // Player in interest radius 209 | if (p2.playerSeen.count(p1Id) == 0) { 210 | EnableMessage emsg; 211 | emsg.objectId = p1Id; 212 | emsg.toEnable = true; 213 | 214 | emsg.position[0] = p1->position[0]; 215 | emsg.position[1] = p1->position[1]; 216 | emsg.position[2] = p1->position[2]; 217 | 218 | emsg.rotation[0] = p1->rotation[0]; 219 | emsg.rotation[1] = p1->rotation[1]; 220 | emsg.rotation[2] = p1->rotation[2]; 221 | emsg.rotation[3] = p1->rotation[3]; 222 | 223 | p2.playerSeen[p1Id] = p1; 224 | SendMsgTo(&emsg, id); 225 | } 226 | 227 | if (interestedOnly) 228 | SendMsgTo(msg, id); 229 | } 230 | } 231 | } 232 | 233 | void Game::RegisterServer(int id, int serverSocket) { 234 | std::cout << "\033[1;33m New server added with id " << id << " on socket " << serverSocket << "\033[1;37m" << std::endl; 235 | 236 | while (servers.count(id) != 0) { 237 | servers.erase(id); 238 | } 239 | 240 | servers[id] = new Server(id, serverSocket, this); 241 | } 242 | 243 | void Game::Loop() { 244 | while (true) { 245 | std::chrono::high_resolution_clock::time_point start = std::chrono::high_resolution_clock::now(); 246 | 247 | // Server tick start. 248 | for (std::map::iterator it=players.begin(); it!=players.end(); it++) { 249 | int p1Id = it->first; 250 | Player& p1 = it->second; 251 | 252 | // Update dirty pos 253 | if (p1.posDirty) { 254 | p1.posDirty = false; 255 | 256 | TransformMessage msg; 257 | msg.sourceId = p1Id; 258 | msg.position[0] = p1.position[0]; 259 | msg.position[1] = p1.position[1]; 260 | msg.position[2] = p1.position[2]; 261 | 262 | msg.rotation[0] = p1.rotation[0]; 263 | msg.rotation[1] = p1.rotation[1]; 264 | msg.rotation[2] = p1.rotation[2]; 265 | msg.rotation[3] = p1.rotation[3]; 266 | 267 | for (std::vector::iterator jt = clients.begin(); jt != clients.end(); jt++) { 268 | if (p1Id == *jt) 269 | continue; 270 | 271 | Player& p2 = players[*jt]; 272 | float distVector[3] = {p2.position[0], p2.position[1], p2.position[2]}; 273 | 274 | distVector[0] -= p1.position[0]; 275 | distVector[1] -= p1.position[1]; 276 | distVector[2] -= p1.position[2]; 277 | 278 | float sqrMagnitude = distVector[0]*distVector[0] + distVector[1]*distVector[1] + distVector[2]*distVector[2]; 279 | float sqrRadius = p2.interestRadius*p2.interestRadius; 280 | 281 | if (sqrMagnitude > sqrRadius) { // Player not in interest radius 282 | if (p2.playerSeen.count(p1Id) != 0) { 283 | EnableMessage emsg; 284 | emsg.objectId = p1Id; 285 | emsg.toEnable = false; 286 | 287 | emsg.position[0] = p1.position[0]; 288 | emsg.position[1] = p1.position[1]; 289 | emsg.position[2] = p1.position[2]; 290 | 291 | emsg.rotation[0] = p1.rotation[0]; 292 | emsg.rotation[1] = p1.rotation[1]; 293 | emsg.rotation[2] = p1.rotation[2]; 294 | emsg.rotation[3] = p1.rotation[3]; 295 | 296 | p2.playerSeen.erase(p1Id); 297 | 298 | emsg.Send(*jt); 299 | } 300 | } else { // Player in interest radius 301 | if (p2.playerSeen.count(p1Id) == 0) { 302 | EnableMessage emsg; 303 | emsg.objectId = p1Id; 304 | emsg.toEnable = true; 305 | 306 | emsg.position[0] = p1.position[0]; 307 | emsg.position[1] = p1.position[1]; 308 | emsg.position[2] = p1.position[2]; 309 | 310 | emsg.rotation[0] = p1.rotation[0]; 311 | emsg.rotation[1] = p1.rotation[1]; 312 | emsg.rotation[2] = p1.rotation[2]; 313 | emsg.rotation[3] = p1.rotation[3]; 314 | 315 | p2.playerSeen[p1Id] = &p1; 316 | 317 | emsg.Send(*jt); 318 | } else { 319 | msg.Send(*jt); 320 | } 321 | } 322 | } 323 | 324 | // Update for borders 325 | if (server.Id() == 9501 and servers.count(9502) != 0) { 326 | Server* s = servers[9502]; 327 | 328 | if (p1.position[0] + p1.interestRadius > server.X() + server.Size_x()/2) { 329 | msg.Send(s->GetSocket()); 330 | 331 | s->AddPlayer(p1Id, false); 332 | } else if(s->ContainsPlayer(p1Id)) { 333 | DespawnMessage msg; 334 | msg.objectId = p1Id; 335 | msg.Send(s->GetSocket()); 336 | 337 | s->RemovePlayer(p1Id, false); 338 | } 339 | } else if(server.Id() == 9502 and servers.count(9501) != 0) { 340 | Server* s = servers[9501]; 341 | 342 | if (p1.position[0] - p1.interestRadius < server.X() - server.Size_x()/2) { 343 | msg.Send(s->GetSocket()); 344 | 345 | s->AddPlayer(p1Id, false); 346 | } else { 347 | DespawnMessage msg; 348 | msg.objectId = p1Id; 349 | msg.Send(s->GetSocket()); 350 | 351 | s->RemovePlayer(p1Id, false); 352 | } 353 | } 354 | } 355 | } 356 | 357 | for (std::map::iterator it=servers.begin(); it!=servers.end(); it++) { 358 | it->second->Update(); 359 | } 360 | // Server tick end. 361 | 362 | std::chrono::high_resolution_clock::time_point end = std::chrono::high_resolution_clock::now(); 363 | 364 | int duration = std::chrono::duration_cast( end - start ).count(); 365 | 366 | if (duration > 10) { 367 | std::cout << "\033[1;31m GameLoop took " << duration << " milliseconds \033[1;37m" << std::endl; 368 | } else { 369 | std::this_thread::sleep_for (std::chrono::milliseconds(33 - duration)); 370 | } 371 | } 372 | } 373 | -------------------------------------------------------------------------------- /Server/src/game.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GAME_HPP 2 | #define GAME_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "player.hpp" 24 | #include "server.hpp" 25 | #include "NetworkMessages/networkMessage.hpp" 26 | 27 | class Game { 28 | public: 29 | Game(int serverId, std::vector& clients, std::map& servers, std::map& players); 30 | 31 | void Run(); 32 | 33 | void Spawn(int prefabId, int owner, bool hasAuthority = false); 34 | void SpawnPlayer(int client); 35 | void Despawn(int objectId); 36 | void DespawnPlayer(int clientSocket); 37 | 38 | void SendMsgTo(NetworkMessage* msg, int targetId); 39 | void SendMsgTo(NetworkMessage* msg, Player& target); 40 | void SendMsgToAllInterested(NetworkMessage* msg, Player* p1); 41 | void SendMsgToAllNotInterested(NetworkMessage* msg, Player* p1); 42 | void SendMsgToAll(NetworkMessage* msg, Player* p1 = NULL, bool interestedOnly = true); 43 | 44 | void RegisterServer(int id, int serverSocket); 45 | 46 | private: 47 | void Loop(); 48 | 49 | std::thread* loop; 50 | 51 | Server server; 52 | 53 | std::vector& clients; 54 | std::map& servers; 55 | std::map& players; 56 | 57 | int lastValidId = 10000; 58 | std::map objects; // objectId, ownerId TODO: networkedObject (json data?) 59 | }; 60 | 61 | #endif -------------------------------------------------------------------------------- /Server/src/login.cpp: -------------------------------------------------------------------------------- 1 | #include "login.hpp" 2 | 3 | #include "NetworkMessages/spawnMessage.hpp" 4 | 5 | Login::Login(int const port, Game& game): 6 | game(game) { 7 | /* 8 | * AF_INET => IPv4 || AF_INET6 => IPv6 9 | * SOCK_STREAM: TCP || SOCK_DGRAM: UDP 10 | * man protocols 11 | */ 12 | sockfd = socket(AF_INET, SOCK_STREAM, 0); 13 | if (sockfd == 0) { 14 | perror("Failed to create socket"); 15 | exit(EXIT_FAILURE); 16 | } else { 17 | std::cout << "Server socket created." << std::endl; 18 | } 19 | 20 | /* 21 | * Setup port with reuse 22 | */ 23 | int opt = 1; // Black magic 24 | if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT, &opt, sizeof(opt))) { 25 | perror("Failed to attached socket to port"); 26 | exit(EXIT_FAILURE); 27 | } 28 | 29 | /* 30 | * Setup address, port etc 31 | */ 32 | address.sin_family = AF_INET; 33 | address.sin_addr.s_addr = INADDR_ANY; 34 | address.sin_port = htons(port); 35 | // Bin socket to address and port 36 | if (bind(sockfd, (struct sockaddr *) &address, sizeof(address)) < 0) { 37 | perror("Failed to bin socket to port"); 38 | exit(EXIT_FAILURE); 39 | } else { 40 | std::cout << "Server binded to port " << port << "." << std::endl; 41 | } 42 | 43 | /* 44 | * Socket listen with up to 10 clients waiting 45 | */ 46 | if (listen(sockfd, 10) < 0) { 47 | perror("Failed to listen to socket"); 48 | exit(EXIT_FAILURE); 49 | } else { 50 | std::cout << "Server waiting for clients." << std::endl; 51 | } 52 | } 53 | 54 | void Login::Run() { 55 | loop = new std::thread(&Login::Loop, this); 56 | } 57 | 58 | void Login::Loop() { 59 | // Main loop 60 | while (true) { 61 | /* 62 | * Wait for a new client to accept 63 | * addrlen ends up with the clients address length 64 | */ 65 | socklen_t addrlen = sizeof(address); 66 | int clientSocket = accept(sockfd, (struct sockaddr *)&address, &addrlen); 67 | if (clientSocket < 0) { 68 | perror("Failed to get client socket"); 69 | exit(EXIT_FAILURE); 70 | } else { 71 | /* 72 | * Handcheck 73 | * Read buffer send by client 74 | * Send id 75 | */ 76 | int socketType; 77 | read(clientSocket, &socketType, sizeof(int)); 78 | 79 | if (socketType == 0) { 80 | printf("\033[1;32m New client added with id %d \033[1;37m\n", clientSocket); 81 | game.SpawnPlayer(clientSocket); 82 | } else if (socketType == 1) { 83 | int id; 84 | read(clientSocket, &id, sizeof(int)); 85 | 86 | game.RegisterServer(id, clientSocket); 87 | } else { 88 | close(clientSocket); 89 | continue; 90 | } 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /Server/src/login.hpp: -------------------------------------------------------------------------------- 1 | #ifndef LOGIN_HPP 2 | #define LOGIN_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include "game.hpp" 18 | 19 | class Login { 20 | public: 21 | Login(int const port, Game& game); 22 | 23 | void Run(); 24 | void Loop(); 25 | 26 | private: 27 | int sockfd; 28 | struct sockaddr_in address; 29 | 30 | std::thread* loop; 31 | 32 | Game& game; 33 | }; 34 | 35 | #endif -------------------------------------------------------------------------------- /Server/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "login.hpp" 4 | #include "game.hpp" 5 | #include "player.hpp" 6 | #include "server.hpp" 7 | 8 | std::vector clients; 9 | std::map servers; 10 | std::map players; 11 | 12 | int main(int argc, char const *argv[]) 13 | { 14 | std::cout << "\033[1;37m"; 15 | if (argc < 2) { 16 | std::cout << "Usage: Server port oherServerPort" << std::endl; 17 | return 0; 18 | } 19 | 20 | Game game(atoi(argv[1]), clients, servers, players); 21 | Login login(atoi(argv[1]), game); 22 | 23 | login.Run(); 24 | game.Run(); 25 | 26 | for (int i = 2; i < argc; i++) { 27 | std::cout << "Trying to join server on " << atoi(argv[2]) << ": "; 28 | 29 | int sockfd = socket(AF_INET, SOCK_STREAM, 0); 30 | if (sockfd == 0) { 31 | perror("Failed to create socket"); 32 | exit(EXIT_FAILURE); 33 | } else { 34 | struct sockaddr_in address; 35 | address.sin_family = AF_INET; 36 | address.sin_addr.s_addr = INADDR_ANY; 37 | address.sin_port = htons(atoi(argv[i])); 38 | 39 | if(connect(sockfd, (struct sockaddr *) &address, sizeof(address)) == 0) 40 | { 41 | int id = atoi(argv[i]); 42 | int curId = atoi(argv[1]); 43 | 44 | int socketType[2] = {1, curId}; 45 | send(sockfd, &socketType, 2*sizeof(int), 0); 46 | 47 | servers[id] = new Server(id, sockfd, &game); 48 | 49 | std::cout << "\033[1;32m SUCCESS \033[1;37m" << std::endl; 50 | } else { 51 | close(sockfd); 52 | std::cout << "\033[1;33m FAIL \033[1;37m" << std::endl; 53 | } 54 | } 55 | } 56 | 57 | std::cout << "Press [ENTER] to quit" << std::endl; 58 | while (std::cin.get() != '\n') { 59 | std::cout << "Press [ENTER] to quit" << std::endl; 60 | } 61 | 62 | std::cout << "Shuting down all sockets"; 63 | for (std::vector::iterator it = clients.begin(); it != clients.end(); it++) { 64 | close(*it); 65 | std::cout << "."; 66 | } 67 | 68 | std::cout << "." << std::endl; 69 | 70 | 71 | for (std::map::iterator it=servers.begin(); it!=servers.end(); it++) { 72 | std::cout << "."; 73 | delete it->second; 74 | } 75 | 76 | std::cout << "." << std::endl; 77 | } -------------------------------------------------------------------------------- /Server/src/player.cpp: -------------------------------------------------------------------------------- 1 | #include "player.hpp" 2 | 3 | #include "playerThread.hpp" 4 | 5 | Player::Player(int id): id(id), playerSeen() { 6 | 7 | } 8 | 9 | Player::~Player() { 10 | 11 | } 12 | 13 | short Player::Serialize(char* buffer, short offset) { 14 | (*(float*)(buffer + offset)) = position[0]; 15 | offset += sizeof(float); 16 | (*(float*)(buffer + offset)) = position[1]; 17 | offset += sizeof(float); 18 | (*(float*)(buffer + offset)) = position[2]; 19 | offset += sizeof(float); 20 | 21 | (*(float*)(buffer + offset)) = rotation[0]; 22 | offset += sizeof(float); 23 | (*(float*)(buffer + offset)) = rotation[1]; 24 | offset += sizeof(float); 25 | (*(float*)(buffer + offset)) = rotation[2]; 26 | offset += sizeof(float); 27 | (*(float*)(buffer + offset)) = rotation[3]; 28 | offset += sizeof(float); 29 | 30 | return offset; 31 | } 32 | 33 | short Player::Deserialize(char* buffer, short offset) { 34 | position[0] = (*(float*)(buffer + offset)); 35 | offset += sizeof(float); 36 | position[1] = (*(float*)(buffer + offset)); 37 | offset += sizeof(float); 38 | position[2] = (*(float*)(buffer + offset)); 39 | offset += sizeof(float); 40 | 41 | rotation[0] = (*(float*)(buffer + offset)); 42 | offset += sizeof(float); 43 | rotation[1] = (*(float*)(buffer + offset)); 44 | offset += sizeof(float); 45 | rotation[2] = (*(float*)(buffer + offset)); 46 | offset += sizeof(float); 47 | rotation[3] = (*(float*)(buffer + offset)); 48 | offset += sizeof(float); 49 | 50 | return offset; 51 | } 52 | 53 | int Player::GetSocket() { 54 | return pthread != NULL ? pthread->GetSocket() : 0; 55 | } -------------------------------------------------------------------------------- /Server/src/player.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PLAYER_HPP 2 | #define PLAYER_HPP 3 | 4 | #include 5 | 6 | class PlayerThread; 7 | 8 | class Player { 9 | public: 10 | Player(int id = 0); 11 | ~Player(); 12 | 13 | short Serialize(char* buffer, short offset); 14 | short Deserialize(char* buffer, short offset); 15 | 16 | int GetSocket(); 17 | 18 | int id = 0; 19 | 20 | PlayerThread* pthread; 21 | 22 | bool posDirty = false; 23 | 24 | float position[3]; 25 | float rotation[4]; 26 | 27 | float interestRadius = 10; 28 | std::map playerSeen; 29 | }; 30 | 31 | #endif -------------------------------------------------------------------------------- /Server/src/playerThread.cpp: -------------------------------------------------------------------------------- 1 | #include "playerThread.hpp" 2 | #include 3 | 4 | #include "NetworkMessages/spawnMessage.hpp" 5 | #include "NetworkMessages/despawnMessage.hpp" 6 | 7 | PlayerThread::PlayerThread(int client, Player& player, Game& game): client(client), player(player), game(game) { 8 | 9 | } 10 | 11 | PlayerThread::~PlayerThread() { 12 | 13 | } 14 | 15 | void PlayerThread::Run() { 16 | running = true; 17 | 18 | loop = new std::thread(&PlayerThread::Loop, this); 19 | loop->detach(); 20 | } 21 | 22 | void PlayerThread::Loop() { 23 | while (running) { 24 | int length = 0; 25 | read(client, &length, sizeof(int)); 26 | 27 | char* buffer = new char[length]; 28 | read(client, buffer, length); 29 | 30 | short id = buffer[0]; 31 | 32 | if (id == 1) { 33 | player.Deserialize(buffer, 1 + sizeof(int)); 34 | player.posDirty = true; 35 | } else if (id == 2) { 36 | SpawnMessage msg; 37 | msg.Deserialize(buffer); 38 | 39 | if (msg.objectId == client) { 40 | std::cout << "\033[1;32m client: " << client << " requested spawn of prefab:" << msg.prefabId << " \033[1;37m" << std::endl; 41 | game.Spawn(msg.prefabId, msg.objectId); 42 | } 43 | } else if (id == 3) { 44 | DespawnMessage msg; 45 | msg.Deserialize(buffer); 46 | 47 | if (msg.objectId == client) { 48 | std::cout << "\033[1;32m client: " << client << " gracefully disconected \033[1;37m" << std::endl; 49 | game.DespawnPlayer(client); 50 | } else if (msg.objectId >= 10000) { 51 | std::cout << "\033[1;32m client: " << client << " requested despawn of object:" << msg.objectId << " \033[1;37m" < 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "game.hpp" 19 | #include "player.hpp" 20 | 21 | class PlayerThread { 22 | public: 23 | PlayerThread(int client, Player& player, Game& game); 24 | ~PlayerThread(); 25 | 26 | int GetSocket() { return client; } 27 | 28 | void Run(); 29 | 30 | bool running = false; 31 | private: 32 | void Loop(); 33 | 34 | std::thread* loop; 35 | 36 | int client; 37 | Player& player; 38 | 39 | Game& game; 40 | }; 41 | 42 | #endif -------------------------------------------------------------------------------- /Server/src/server.cpp: -------------------------------------------------------------------------------- 1 | #include "server.hpp" 2 | 3 | #include 4 | 5 | #include "game.hpp" 6 | #include "NetworkMessages/transformMessage.hpp" 7 | #include "NetworkMessages/spawnMessage.hpp" 8 | #include "NetworkMessages/despawnMessage.hpp" 9 | #include "NetworkMessages/enableMessage.hpp" 10 | 11 | Server::Server(int id, int socket, Game* game): id(id), socket(socket), game(game), players() { 12 | if (id == 9501) { 13 | x = -20; 14 | z = 0; 15 | 16 | size_x = 39; 17 | size_y = 40; 18 | size_z = 39; 19 | } else if (id == 9502) { 20 | x = 20; 21 | z = 0; 22 | 23 | size_x = 39; 24 | size_y = 40; 25 | size_z = 39; 26 | } 27 | 28 | if (socket > 0) { 29 | msgReceptionThread = new std::thread(&Server::MsgReception, this); 30 | } 31 | 32 | players = new std::map(); 33 | } 34 | 35 | Server::~Server() { 36 | if (socket > 0) { 37 | close(socket); 38 | delete players; 39 | 40 | socket = 0; 41 | } 42 | } 43 | 44 | void Server::Update() { 45 | for (std::map::iterator it=players->begin(); it!=players->end(); it++) { 46 | int id = it->first; 47 | Player& p = it->second; 48 | 49 | if (p.posDirty) { 50 | p.posDirty = false; 51 | 52 | TransformMessage msg; 53 | msg.sourceId = id; 54 | msg.position[0] = p.position[0]; 55 | msg.position[1] = p.position[1]; 56 | msg.position[2] = p.position[2]; 57 | 58 | msg.rotation[0] = p.rotation[0]; 59 | msg.rotation[1] = p.rotation[1]; 60 | msg.rotation[2] = p.rotation[2]; 61 | msg.rotation[3] = p.rotation[3]; 62 | 63 | game->SendMsgToAllInterested(&msg, &p); 64 | } 65 | } 66 | } 67 | 68 | void Server::MsgReception() { 69 | while (socket > 0) { 70 | int length = 0; 71 | read(socket, &length, sizeof(int)); 72 | 73 | if (length <= 0) 74 | continue; 75 | 76 | char* buffer = new char[length]; 77 | read(socket, buffer, length); 78 | 79 | short id = buffer[0]; 80 | 81 | if (id == 1) { 82 | TransformMessage msg; 83 | msg.Deserialize(buffer); 84 | msg.sourceId = -msg.sourceId; 85 | 86 | if (players->count(msg.sourceId) == 0) { 87 | std::cout << "\033[1;33m Player " << -msg.sourceId << " from server " << this->id << " entered the border \033[1;37m" << std::endl; 88 | 89 | AddPlayer(msg.sourceId); 90 | } 91 | 92 | players->at(msg.sourceId).Deserialize(buffer, 1 + sizeof(int)); 93 | players->at(msg.sourceId).posDirty = true; 94 | } else if (id == 3) { 95 | DespawnMessage msg; 96 | msg.Deserialize(buffer); 97 | 98 | msg.objectId = -msg.objectId; 99 | 100 | if (players->count(msg.objectId) != 0) { 101 | std::cout << "\033[1;33m Player " << -msg.objectId << " from server " << this->id << " left the border \033[1;37m" << std::endl; 102 | 103 | RemovePlayer(msg.objectId); 104 | } 105 | } 106 | 107 | std::this_thread::sleep_for (std::chrono::milliseconds(10)); 108 | } 109 | 110 | std::cout << "\033[1;33m Server " << id << "'s thread dying \033[1;37m" << std::endl; 111 | } 112 | 113 | void Server::SpawnFor(Player& p1) { 114 | for (std::map::iterator it=players->begin(); it!=players->end(); it++) { 115 | int id = it->first; 116 | // Player& p = it->second; 117 | 118 | SpawnMessage spawnMsg; 119 | spawnMsg.prefabId = 0; 120 | spawnMsg.objectId = id; 121 | spawnMsg.hasAuthority = false; 122 | 123 | // Send Spawn 124 | game->SendMsgTo(&spawnMsg, p1); 125 | } 126 | } 127 | 128 | void Server::AddPlayer(int index, bool withMsg) { 129 | players->insert(std::pair(index, Player(index))); 130 | 131 | if (socket <= 0 || !withMsg) 132 | return; 133 | 134 | SpawnMessage spawnMsg; 135 | spawnMsg.prefabId = 0; 136 | spawnMsg.objectId = index; 137 | spawnMsg.hasAuthority = false; 138 | 139 | // Send Spawn 140 | game->SendMsgToAll(&spawnMsg); 141 | 142 | Player& p = players->at(index); 143 | 144 | EnableMessage emsg; 145 | emsg.objectId = index; 146 | emsg.toEnable = false; 147 | 148 | emsg.position[0] = p.position[0]; 149 | emsg.position[1] = p.position[1]; 150 | emsg.position[2] = p.position[2]; 151 | 152 | emsg.rotation[0] = p.rotation[0]; 153 | emsg.rotation[1] = p.rotation[1]; 154 | emsg.rotation[2] = p.rotation[2]; 155 | emsg.rotation[3] = p.rotation[3]; 156 | 157 | game->SendMsgToAllNotInterested(&emsg, &p); 158 | } 159 | 160 | 161 | void Server::RemovePlayer(int index, bool withMsg) { 162 | players->erase(index); 163 | 164 | if (socket <= 0 || !withMsg) 165 | return; 166 | 167 | DespawnMessage despawnMsg; 168 | 169 | despawnMsg.objectId = index; 170 | 171 | // Send Despawn 172 | game->SendMsgToAll(&despawnMsg); 173 | } -------------------------------------------------------------------------------- /Server/src/server.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SERVER_INCLUDE 2 | #define SERVER_INCLUDE 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "player.hpp" 9 | 10 | class Game; 11 | 12 | class Server { 13 | public: 14 | Server(int id = -1, int socket = 0, Game* game = nullptr); 15 | ~Server(); 16 | 17 | void Update(); 18 | 19 | inline int GetSocket() { return socket; } 20 | 21 | void MsgReception(); 22 | 23 | void SpawnFor(Player& p); 24 | 25 | void AddPlayer(int index, bool withMsg = true); 26 | void RemovePlayer(int index, bool withMsg = true); 27 | inline bool ContainsPlayer(int index) { return players->count(index) != 0; } 28 | 29 | private: 30 | int id; 31 | int socket; 32 | Game* game; 33 | 34 | float x = 0; 35 | float z = 0; 36 | 37 | float size_x = 10; 38 | float size_y = 10; 39 | float size_z = 10; 40 | 41 | std::map* players; 42 | 43 | std::thread* msgReceptionThread; 44 | 45 | public: 46 | inline int Id() { return id; } 47 | 48 | inline float X() { return x; } 49 | inline float Z() { return z; } 50 | 51 | inline float Size_x() { return size_x; } 52 | inline float Size_y() { return size_y; } 53 | inline float Size_z() { return size_z; } 54 | inline void SetPlayers(std::map* p) { delete players; players = p; } 55 | }; 56 | 57 | #endif --------------------------------------------------------------------------------