uSurvival - the new Unity Multiplayer Survival Asset from the creator of uMMORPG. (Asset Store) (WebGL) (Chat) (Documentation) All the architecture was designed with simplicity in mind. The code is as short and as simple as possible. Screenshots: Features: * You can kill Zombies with an Axe * Same Scripts for Client & Server * Friendly Discord Community * Uses Unity's new UI system * Zombies & AI * Secure: Server Authoritative * Players with Jump, Climb, Crouch, Run, Strafe Movement * Third & First Person * Health, Nutrition, Hydration * Axe, Pistol & Rifle Weapons * Hand to Hand combat (Punching) * Scriptable Items -> [ Fully customizable ] -> [ Supports ALL Item Types ] * Reloading & Progress Bar * Item Drops & Spawns * Hotbar * Networked Doors * Great Blood Splatter Effect * Free Look Camera Key * Retargetable Humanoid Animations via Mecanim * Beautiful 3D Models * Local, Whisper, Info Chat * Crafting * PvP * Death and Respawning * SQLite Database * Simple Account System * 5000 Lines of carefully crafted C# Code * Server Selection * Server can run on Linux in Headless mode * Configurable Server Tick Rate * Login, Character Selection & Creation * Start as Host/Client/Dedicated * Network Time Synchronization * Platform Independent * Free of Deadlocks & Race Conditions * Documentation with Tutorials Changelog V1.0 [released 2018-06-05] First release V1.1 [released 2018-06-07] Wall Boundary prefab collider changed to mesh collider for more detailed decal placement Disabled item spawn log messages NetworkTime.Update added to make sure that the client doesn't get out of sync Chat.MessageInfo renamed to ChatMessage Chat messages can now be clicked to reply UIDragAndDropable: OnDragAndClear isn't called anymore if the slot is dragged onto itself UIDragAndDropable: Button interactable set to false while dragging so that the item isn't used when dragged onto itself Horizontal/Vertical input axes gravity increased so that the player responds faster when stopping movement Animation controller: Blend Type changed to 2D Freeform Directional because that's the proper one for movement directions Animation controller: added more walk/run/sprint motions for grounded blend tree. They simply play the same motion with different speeds for now, which already feels a lot better. V1.2 [released 2018-06-15] Combat.DealDamageAt health>0 check so dead zombies can't be shot anymore and RPCs aren't sent unnecessarily Zombie collider disabled while dead so that it doesn't block movement or shots anymore Interaction panel: removed content size fitter from ActionText RecipeTemplate renamed to ScriptableRecipe for consistency with ScriptableItem Fixed locked cursor still being visible on Windows PlayerAnimation uses local player values for local player to avoid latency V1.3 [released 2018-06-16] Fixed first person hands/weapon clipping through walls by adding a WeaponCamera that only draws the NoDepthInFirstPerson layer without depth check; changed all weapons and volund hands/leather to the new layer RangedWeaponItem: Raycast starts from head bone now to avoid shooting through walls. WeaponModel.MuzzleLocation not needed anymore. PlayerMovement: climbing movement uses inputDir instead of horizontal/vertical input directly to make sure that diagonal movement is normalized PlayerMovement.FixedUpdate always update even while dead, only ignores input while dead. Fixes a bug where a player would get stuck in the air if he died while jumping/falling V1.4 [released 2018-06-18] Player prefab IK body weight disabled and shoulders now have ShoulderLookAt component instead. Fixes issues where looking downwards would make the player bend over forward and be able to look through walls etc. Player firstpersonclipping doesn't clip legs anymore so we can see them while running etc. First person camera now follows the eyes, not the head bone (neck) so that it moves slightly forward when looking downward because of the head IK, so that we don't look into our own body anymore, but in front of it like in real life. Camera Field of View increased. Feels a lot better in first person now. Disabled Free Look in first person Punching attack range decreased Fixed camera looking through walls when standing close (min clip plane decreased) V1.5 [released 2018-06-21] PlayerHotbar.GetCurrentUsableItem that returns item or hands. Simplifies the rest of the code. RpcOnUsedItem only sends item hash now to reduce bandwidth (saves 4 bytes each time a weapon is fired etc.) and to make it more logical Punching animation rotation fixed so the player punches directly forward again (thumbs still oddly rotated but can't fix atm) ShoulderLookAt.Awake uses localRotation instead of rotation to fix a weapon rotation bug that happened if Editor ran as host and build ran as client NoDepth drawing is limited to local player first person instead of just first person. Fixes a bug where players playing in first person would see nodepth drawings in other players, e.g. the hair ring in front of the face etc. ZombieFSM: kiting protection disabled. Players can now dodge zombie attacks by running out of their attack range while they attack. ZombieFSM.attackToMoveRangeRatio so that the zombie runs closer than attack range towards the target, so that it can still finish the attack even if the target moves backwards only a little bit ZombieFSM.IsReachable: fixed top/bottom points calculations by using .extents instead of .size ZombieFSM.IsReachable fixed: ignores own collider and compares hit.collider with other collider to see if anything is between us and target or not. Fixes several reachability bugs, like the one where we could crouch away from a monster without being reachable. NetworkTransformRubberbanding, IKHandling, PlayerMovement channels set to StateUpdate with manual delay check before Cmds; added StateUpdate channel to NetworkManager. This way the Cmds aren't sent from client to server every Update (hence almost DDOS if people have fast computers). Reduces bandwidth from 25KB/s to 8KB/s on my slow computer. V1.6 [released 2018-06-26] NetworkTransformRubberbanding: start, goal, previousPosition are now public in case other components need it PlayerMovement: MoveState enum type changed to byte instead of default int to save 3 bytes for each Cmd/SyncVar IKHandling: only call CmdSetLookAt if lookAt position changed PlayerMovement.CmdSetAnimData doesn't send velocity and jumpLeg anymore. PlayerAnimation guesses it based on NetworkTransform to save a lot of bandwidth NetworkTransformRubberbanding sync rotation X/Y/Z component flags to save bandwidth. Volund only syncs Y rotation now. PlayerMovement.Update: CmdSetAnimData is called while dead too now Reverted usage of StateUpdate channel everywhere and removed it from NetworkManager channels. Caused bugs where other clients would be left in the air because clients wouldn't alwasy receive new SyncVar values Disabled item use while free looking, so people don't fire into free look direction when clicking the mouse button while free looking PlayerMovement: fixed NullReferenceException on server if client started climbing because server tried to initialize free look too V1.7 [released 2018-07-01] Upgraded to Unity 2017.4.6f1 LTS Documentation updated (HLAPI CE, server hosting) Chat info messages simplified Inventory.Add tries to add to ALL existing stacks FIRST and THEN tries the EMPTY stacks instead of only looping once and adding to the first existing OR empty slot. Fixes a bug where an item would be added to slot0 even though slot1 had the same stack, only because slot0 was already empty. Crafting probabilities UI background/windows/foreground/login hints added in hierarchy V1.8 [released 2018-07-02] NetworkManager UnityVersionCheck version updated to 2017.4.6 too UI Hotbar moved to foreground so items can be dragged from main UI to hotbar again V1.9 [released 2018-07-04] Item Use (Firing) Prediction UsableItem.CanUse now returns Usability.Usable/Cooldown/Empty/Never instead of a simple bool. This way we can play the weapon's empty clicking sound only if it's really empty, not while only on cooldown etc. AlsoSprachZarathrustra isn't played by default anymore UsableItem.cooldown added and reused by weapon items instead of attackInterval in WeaponItem Cooldown added to axe/stg44/beretta tooltips (as attack interval) Damage added to axe tooltip PlayerHotbar.CmdUseItem resets cooldown for all usable items now, instead of MeleeWeaponItem/RangedWeaponItem Use() resetting it themselves PlayerHotbar.usageEndTime is not a SyncVar anymore and is set on server after usage and on client in RpcUsed call instead. Saves 4 bytes bandwidth each time and allows us to set it directly for local player in TryUseItem, which fixes issues where clients couldn't shoot as fast as the fire interval because the useEndTime took too long to be synced to the client. Also added a server message if usage was rejected, which might still happen if two usage packets arrive at the same time on the server, etc. V1.10 [released 2018-07-05] Fixed upper body climbing animation when climbing while holding a weapon Axe zombie hit sound improved Hydration increased to 2000 to make it less stressful Fixed ground flickering where floor and ground overlapped Item drops don't drop through walls anymore Camera view block check only happens in third person now to save computations Fixed Camera going through walls in third person when looking downwards Added 'Doors' layer to camera view block layers so it doesn't go through doors in third person V1.11 [released 2018-07-06] PlayerLook component contains all camera logic now and syncs the lookDirection instead of IKHandling syncing the lookPosition. Saves bandwidth and greatly reduces complexity. PlayerLook synced look direction is compressed from 12 into 2 bytes by converting it to a rotation and then compressing the X and Y angles into bytes Utils.PackTwoFloatsIntoByte and unpack added PlayerLook syncs free look state over the network, so that other player's arms don't follow the look direction while they are free looking MeleeWeapon.SphereCastToLookAt: behindOrigin is now really behind us, not just in the opposite look direction, which caused bugs where we would try to cast the sphere from our feet when looking upwards, then the sphere would ignore the wall in front of us and we could hit zombies behind the wall PlayerLook.LateUpdate: removed unnecessary 'newPosition' variables PlayerLook.LateUpdate first person code simplified PlayerLook offsets changed to Vector2. Z offsets shouldn't be allowed, otherwise people can look through walls by tilting their head forward (from looking downwards). Avoiding this in camera logic is way too complex otherwise. Also changed volund third person X offset so that the crosshair is slightly next to his head, to allow easier item pick up. This also allows for way easier view block raycast logic and fixes all kinds of weird issues like the camera sometimes going through the ceiling, etc. View blocking now always uses the exact line to the crosshair position, which feels perfect. ZombieFSM.IsReachable moved to Utils Interaction uses IsReachable, so that items can't be picked up through walls anymore. Checks happen on client(so that the interaction text isn't shown through walls) and on server, so that hackers can't pick items through walls without entering the building, etc. V1.12 [released 2018-07-10] Updated Documentation (added Networking Benchmark and Interaction system) Utils.IsReachable Debug.DrawLines added Interaction system redesigned. Door/ItemDrop inherit from abstract Interactable now Interactable.OnInteract function used by inheriting classes Interaction.cs only has one CmdInteract command now and calls OnInteract if allowed Interaction.cs only uses one Raycast into look direction instead of Utils.IsReachable now, fixes a bug where doors couldn't be opened again because they weren't detected as reachable Interaction Raycast uses all Layers now so we can't pick things through walls, etc. PlayerHotbar CmdUseItem gets usable item at index now, instead of at selection. Fixes a bug where potions/food couldn't be used from the hotbar anymore. PlayerHotbar.OnUsed now fires UPPERBODY_USED trigger so we don't need the PlayerAnimation workaround to detect usage. Also only fires usage for weapons now, so that the axe attack animation isn't played if we use a potion from the hotbar while holding the axe. V1.13 [released 2018-07-12] Temperature + Heat Sources added (Barrel + Fire) Hydration, Nutrition default recovery rates set to -1 instead of 1 in scripts Main UI background RaycastTarget disabled to prepare for OnDragAndClear fix UIDragAndDropable: OnDragAndClear is only fired when dropping a slot into nirvana, not when dropping it on a panel. Fixes issues where OnDragAndClear would be called if we'd drop something in the space between two item slots, etc. This just feels a lot more solid. PlayerHotbar.OnDragAndClear added so items can be dragged out of their hotbar slots to drop them to the ground Beretta92, Stg44 scriptable items: fixed bullet decal assignment being the mesh instead of the prefab. Fixes a bug where bullet decals wouldn't disappear after 10s. BulletDecal prefab: removed MeshCollider from Mesh child to make sure that bullet decals never interfere with Player's Physics (e.g. getting stuck on bullet decals in the air) RangedWeaponItem: BulletDecal is now parented to the collider that we hit to make sure that they stick on Doors and other moving objects Sliding door BoxCollider replaced with detailed MeshCollider to improve decal positioning on doors. Utils.IsReachable renamed to IsReachableVertically because that's what it really checks Energy.Recover code simplified Player Prefab Nutrition, Hydration overflowInto cleared because recovery rate is negative and it will never overflow Energy.recovery bool SyncVar removed because it wasn't used anymore and would require unnecessary bandwidth Energy.recoveryTickRate added for cases where we don't want 1/s frequency; Energy.recoveryRate renamed to recoveryPerTick to make it more obvious V1.14 [released 2018-07-15] NetworkTransformRubberbanding.RpcForcePosition reuses SetPositionAndRotation for consistency and to make sure that all 'set position' code is in one place NetworkTransformRubberbanding: 'fake move' CharacterController after each change so that controller.isGrounded etc. are available on other clients/server too without having to sync those flags manually PlayerMovement doesn't sync controller.isGrounded anymore since that's not needed after NetworkTransformRubberbanding 'fake move' of controller. Saves 1 byte per observer and per Cmd. PlayerMovement.state is now synced via OnSerialize/OnDeserialize without an extra animState SyncVar. Also fixes capsule not being resized for other players when crouching because it checked the unsynchronized .state before. NetworkTransformRubberbanding.EstimateVelocity() added and PlayerAnimation.GetVelocity simplified PlayerMovement.velocity that returns controller velocity or NetworkTransformRubberbanding estimated velocity; used in PlayerAnimation to simplify code PlayerMovement.Update/FixedUpdate rewritten from scratch, uses clean state machine code now; removed jumpRequested and stickToGroundForce; added MoveState.IDLE and MoveState.RUNNING for consistency. V1.15 [released 2018-07-16] Upgraded to Unity 2017.4.7 LTS PlayerMovement.Update SetDirtyBit uses uint instead of ulong for compatibility with original HLAPI V1.16 [released 2018-07-17] NetworkManagerSurvival.OnServerCharacterCreate fills all components of type Energy when creating a player now Endurance energy added V1.17 [released 2018-07-24] Energy send interval changed from 100ms to 500ms because it usually only changes once per second anyway, 500ms is still enough in case of damage etc. PlayerRespawning send interval changed from 100ms to 1s because respawn time just doesn't change that often NetworkTransformRubberbanding, PlayerLook, PlayerMovement send intervals changed from 50ms to 100ms because that's enough UILogin.registerButton not interactable while connecting anymore NetworkManagerSurvival.state added so that Login/CharacterCreation/CharacterSelection UIs know when to be visible. Fixes a bug where character selection would be shown while server closed and disconnect wasn't detected yet. UILogin status shows 'Handshake' now too UILogin status text position fixed Dark UI Energy icons UI Hud is not shown during login anymore PlayerLook.OnNetworkDestroy releases camera to fix a bug where there would be no more camera after the server died and the client's player was destroyed PlayerLook.LateUpdate: don't zoom while cursor over a UI UI temperature decimal digits configurable (reduced from 2 to 1 so that they don't overlap with the status panel temperature icon) V1.18 [released 2018-08-24] Login UI quit button now calls NetworkManagerSurvival.Quit so it works in the editor too PlayerMeta.nextRiskyActionTime [SyncVar] removed because it wasn't used anymore UIDragAndDropable: added origin.dragable check to fix a bug where undragable items could still be dragged to the Hotbar because Unity called OnDrop even if our object's dragable was set to false NetworkNavMeshAgent send interval changed from 0 to 100ms so it doesn't ddos the server with the latest HLAPI CE fixes where sendInterval actually works NetworkNavMeshAgent reimplemented: huge bandwidth reduction because click movement only syncs when destination changed now, not while velocity changes (all the time previously). Also fixes several twitches for wasd moving clients. Added perfect warp detection + Rpc now too. Removed channel tags to prepare for new networking. Removed unreliable channel from NetworkManager so it only uses one ReliableFragmented channel for everything now. NetworkTransformRubberbanding: interpolation points are reset after a force position change. Fixes a bug where other clients would slide to the respawn position after respawning V1.19 [released 2018-08-29] Changed Networking from UNET to Mirror. Watch the manual upgrade guide if you are updating your custom project from V1.18 to V1.19. Fixed 'ClientScene::AddPlayer: playerControllerId of 0 already in use.' bug when pressing character selection select button too fast while on low fps or high latency. The button is now disabled after pressing select. Documentation updated V1.20 [released 2018-09-02] Mirror updated to latest version NetworkManagerSurvival.OnServerDisconnect: removed the old workaround to avoid error message on disconnect because it was fixed in latest Mirror version now Removed redundant WeaponItem check because all WeaponItems are UsableItems UsableItem.useDirectly option instead of UIHotbar check that always selects weapons and always uses other usable items directly. V1.21 [released 2018-09-03] Build System PlayerLook.headPosition added to simplify code Added missing 'cast / receive shadows' properties on some prefabs V1.22 [released 2018-09-11] Mirror updated to latest version (NetworkManager shows max connections again) PlayerHotbar.TryUseItem: disabled debug.drawline because it used camera.main, which is very slow Ranged Weapon zoom Item Durability Documentation updated Fall damage Damage Areas (Player and Zombie head shots cause more damage now) Crouch Key changed to C Crouching state is now toggled when pressing C, instead of having to hold the key down. This is better because laying down will work the same way later, instead of holding a laying-down key Removed MinimapTexture because it was never used UI Equipment Avatar Battle Royale Addon Crawling; Moved Volund CapsuleCollider to hips so it follows crouch/crawling animations properly; increased Volund CharacterController radius so monster doesn't slide to him now that this is the main collider; Replaced fence mesh collider with a more generous box collider so player still fits through the entry. PlayerMovement.OnTriggerExit: set state to IDLE Swimming & Water V1.23 [released 2018-09-12] Mirror updated to latest version (WebGL host mode fix) Swimming idle animation speed set to 0.5 for a better feel PlayerLook.LookRotation: removed unnecessary 'camera' parameter RangedWeapon recoil Build System: available rotations have positionOffset field, which is sometimes needed for different grid resolutions Documentation updated V1.24 [released 2018-09-18] Harvesting Storage Structures are now destroyable Structures don't need a preview prefab anymore Structures are now saved to the database Updated Mirror Smaller improvements V1.25 [released 2018-09-19] Falling Tree position is now reset when respawning Trees now have NetworkTransform component to fix sync issues Storage prefab renamed Storage NetworkProximityChecker update interval set to 5 Tree NetworkProximityChecker update interval set to 5 V1.26 [released 2018-10-20] Updated Mirror & Telepathy Upgraded to Unity 2017.4.13 LTS Database.LoadInventory/LoadEquipment/LoadHotbar: added warnings in case items can't be loaded because they were deleted or aren't in the resources folder Removed unused Item.cs SyncListItem definition Item.data access now throws are useful error message if the item with that hash was never loaded NavMeshAgent.ResetMovement() extension to properly clear path AND velocity to fix FSM issues Removed NetworkTime component. Use Mirror's NetworkTime instead Latency indicator Removed deprecated GUI Layer from Main Camera Utils.ClosestDistance uses ClosestPoint and returns 0 for intersections. collider.ClosestPointOnBounds replaced with Collider.ClosestPoint everywhere for improved accuracy. Also reduced all normal attack skill ranges a bit to adjust for it. V1.27 [released 2018-11-20] Interaction Raycasts fixed. Own animations don't block them anymore. Climbing direction is now relative to ladder rotation, so it works for rotated ladders too UIEquipmentSlot overlays raycast targets disabled so drag and drop is easier Unity Essentials/Blacksmith/Features removed Fixed application identifier V1.28 [released 2018-11-27] Removed unused assets in project ScriptableRecipe var replaced with actual type Documentation updated (Script Events added) PlayerStorageCommands renamed to PlayerStorageUsage for consistency WeaponModel renamed to WeaponDetails so it's more obvious Fixed ground panel flickering by moving one of the ground elements a bit higher UIProgressBar code simplified Utils.Raycast/Linecast/SpherecastWithout layerMask parameter added Standing in shallow water instead of swimming as soon as we touch water Climbing fixed: climb-exit is now checked via !Intersects instead of OnTriggerExit; rotation is now also reset when exiting rotated ladders UIChat.singleton to avoid FindObjectOfType calls V1.29 [released 2018-12-25] PlayerMeta.localPlayer added to replace Utils.ClientLocalPlayer() function. This is easier to use. Upgraded to Unity 2017.4.17 LTS Mirror updated to latest version (huge performance improvements) Player UI windows are now hidden after disconnecting NetworkNavMeshAgent: fixed dead monster sliding on clients if monster died while running V1.30 [released 2018-12-31] Removed unused OnDeathDestroy script ItemDropSpawner.netIdentity field removed because it's in NetworkBehaviour now Converted SendMessage events to UnityEvents for 500-1000x performance improvement when calling events Combat: removed unused invincible variable Documentation updated Fixed EnduranceBar tooltip PlayerLook simplified. No more strange LookRotation / LookRotationChangeBy functions that do all kinds of weird things like store rotations for both character and freeLookParent in one variable. Character/freeLookParent/Camera rotations are set directly now and LateUpdate clamps camera rotation in all cases. V1.31 [released 2019-01-03] Mirror updated to latest version (RPC hashing, SyncInterval) Fixed PlayerLook rotating camera while moving mouse in UI V1.32 [released 2019-01-10] PlayerMovement: removed unused capsule field ShoulderLookAt renamed to ShouldersLookAt and placed on root GameObject for easier configuration. No need to put the component onto each shoulder anymore. ShouldersLookAt rotation code simplified. Always uses initial position now, and calculates LookAt result manually ShouldersLookAt rotation offset added in case it's needed. And improved comment. PlayerEquipment: removed unused ik field PlayerEquipment.rightHandLocation renamed to WeaponMount to make it more obvious that this should be an empty GameObject somewhere PlayerEquipment weaponMount childCount check added to Awake, just to be sure. Documentation updated (player modification tutorial) Mirror updated to 1076 V1.33 [released 2019-01-19] Mirror updated to latest version. Endless list of fixes and improvements and source drop in. Upgrade info: drag all your networked prefabs into the scene, go to Inspector debug view, replace the missing NetworkIdentity/NetworkProximityChecker/NetworkTransform components. Also replace Respawn's NetworkStartPosition. Mirror is now a source drop in, so we will never have to do component replacements again. Fixed missing component on structures by adding OnDeathDestroy again NetworkManagerSurvival: removed auto start if headless because Mirror's NetworkManager takes care of it now V1.34 [released 2019-01-28] PlayerHotabar: only set usageEndTime for local player Fix clients being affected by other client's recoil Mirror updated to latest version (weaver as DLL again to fix first time import issues) NetworkProximityGridChecker: 30x performance increase when checking 1000 monsters and almost half GC Upgrade to Unity 2018.2.20f1 Change .NET version to 4.X to fix a bug where a build client would often freeze while sending/receiving over the network. Reproduceable on OSX + macbook pro + editor=server, client=build, after 3-15 minutes. Fix shoulder look at for other players V1.35 [released 2019-02-01] Mirror updated to latest version ShouldersLookAt rotation fix V1.36 [released 2019-02-01] PlayerAnimation: remove unused netTransform field PlayerAnimation: fix other players briefly showing jump animation when moving over small obstacles PlayerAnimation: removed unused lastPosition and lastVelocity Fix camera being destroyed after disconnect V1.37 [released 2019-02-02] Fixed Zombie/Tree OnDeathRespawn component's missing proximity checker fields for all the prefabs and objects in scene. V1.38 [released 2019-02-19] Crossbow & Projectile system V1.39 [released 2019-02-21] Documentation updated (monster creation video) Mirror updated to latest version (server tick rate etc.) Chat renamed to PlayerChat because it's a player component PlayerChat.CmdMsgWhisper: use TryGetValue for maximum performance NetworkNavMeshAgent.OnDeserialize warning message fixed Grid: remove HashSet at position if empty so we don't keep them in memory forever. NetworkProximityGridChecker.OnDestroy: remove no matter what Fix crossbow item tooltip Arrow layer changed to 'Projectile' so it actually hits the monster's body too (physics matrix ignores default<->monster layers, so it would only hit it in the head because the head uses a DamageArea layer) NetworkManagerSurvival: removed tick rate setting because Mirror handles it now Utils: remove unused functions, improve syntax Utils.IsNullOrWhiteSpace removed, NET 4.5 has string.IsNullOrWhiteSpace now. V1.40 [released 2019-01-03] Upgraded to Unity 2018.3.6 to prepare for LTS, and to avoid 2018.2 memory leak bug (https://github.com/vis2k/Mirror/issues/427) Player, Zombie, Arrow rigidbody collision detection changed to 'Continous Speculative' to avoid 2018.3.6 warning PlayerAnimation: apply to all animators to properly animated skinned mesh equipment PlayerHotbar: call UPPERBODY_USED trigger in all animators to work with skinned meshes too V1.41 [released 2019-03-17] Mirror updated to latest version (sceneID fix, Websockets, source based Weaver) removd message ids fixed missing NetworkIdentity component in battle royale sphere FSM._state and .state merged into one variable Net 4.X syntax for Item.cs getters Database.ExecuteReader: add comment on why we keep the current solution NetworkManager.OnClientReceivePopup renamed to OnClientError NetworkManager.ClientSendPopup renamed to ServerSendError CharacterDeleteMessages inherits from IntegerMessage to simplify code Use nameof(function) for Invoke/InvokeRepeating. also fixes a bug where NetworkManagerSurvival.OnStopServer would try to cancel the wrong save function UI singletons: only assign once to fix Network Zone errors where UI elements would refer the destroyed panels instead of the ones in DontDestroyOnLoad NetworkNavMeshAgent: add agent.ResetPath detection. it only works right now because agent.velocity is != 0 after resetting the path for some reason V1.42 [released 2019-04-09] Mirror updated to latest version (lots of fixes and improvements) Use SyncList<struct> instead of SyncListSTRUCT everywhere NetworkProximityGridChecker: playerController != null check not needed anymore NetworkManagerSurvival.OnServerAddPlayer: null check message.value bytes UILogin: disabled host, dedicated buttons if webgl because webgl can't start a server PlayerChat: local chat uses [ClientRpc] instead of sending a [TargetRpc] to each observer manually [TargetRPC] NetworkConnection parameter removed everywhere because it's optional now Grid renamed to Grid2D to avoid Unity 'Grid class already exists' warning NavmeshPathGizmo renamed to NavMeshPathGizmo Fixed NavMeshPathGizmo NullReferenceExeption after rebuilding scripts sometimes Change enum types to byte to minimize bandwidth Zombie.startPosition is now set in Start instead of Awake, because that's what Start is for. Fixes a bug where runtime spawned monsters weren't respawning properly. Fixed UI Chat activating during WASD movement because the scrollbar Navigation setting was set to Automatic, also enabling keyboard navigation. Setting it to None disables it and fixes the bug. Player default inventory items are now configurable with amount by using ScriptableItemAndAmount type PlayerInventory.CmdSwapInventoryEquip moved into separate SwapInventoryEquip function that can also be used on the server EquipmentItem.Use reuses PlayerEquipment.SwapInventoryEquip function for proper validation and proper health > 0 checks etc. PlayerEquipment default item reuses ScriptableItemAndAmount. Make sure to reassign your player prefab's default equipment items and amounts when upgrading. UI Confirmation window, used in UICharacterSelection to delete characters with less risk for accidental clicks. Database: characters.name field is created with COLLATE NOCASE so that CharacterExists is case insensitive and we can't create both 'Volund' and 'volund' characters. V1.43 [released 2019-04-10] NetworkManagerSurvival: password salt is now configurable in the Inspector Chat: use different text prefabs for different channels. This way the color, font type, background, etc. can be different for different channels. PlayerChat: ChatMessage class converted to struct to avoid GC Database converted to MonoBehaviour component that is added to the NetworkManager. This allows for future abstract Database type with different implementations like MYSQL. It also allows us to customize properties in the Inspector (like Database file name) and to make use of MonoBehaviour functions like Update. MAKE SURE TO MODIFY DATABASE ADDON HOOK FUNCTIONS TO NOT BE STATIC ANYMORE WHEN UPGRADING. Database: add index on 'account' for 'characters.account' to avoid full scans when loading characters in CharactersForAccount function Database: online string code moved into separate function Database: character.online field is set immediately after joining the world already. Otherwise it would only be set after the next CharacterSave call, which could easily take another 5-10 minutes. Database: accounts.created DATETIME added for statistics Database.IsValidAccount improved and renamed to TryLogin Database: characters.online is now an INTEGER (0 or 1), and characters.lastsaved DATETIME added. This is more cleaner than writing the datetime as string only while online, and allows for lastsaved time checks even while offline. Documentation updated (recommended version) NetworkProximityGridChecker: force hidden doesn't need to add own connection anymore after latest Mirror change Use out variable inline declarations List.FindDuplicates extension added ScriptableItem/Recipe: check for duplicates when loading from resources. This allows us to use subfolders safely. Moved resources skills into subfolders Mirror reverted to the version before the Asset Store import bug V1.44 [released 2019-04-18] UIPopup singleton added UI Crafting: show amount overlays in slots Crafting with ingredient amounts. Make sure to reassign all recipe ingredients with their amount. Combat.lastCombatTime added Combat Disconnect delay prevents players from fleeing combat by disconnecting immediately. Player.allowedLogoutTime + remainingLogoutTime based on lastCombatTime added. NetworkManager only logs out the player after that time. UI quit button shows tooltip on clients too. Mirror updated to latest version (Weaver Unity.Cecil replaced with Cecil, Stack Overflow fix, OnDeserialize GC removed) UI: move latency to background so it doesn't show when hovering the quit button Fix player gravity calculation causing too rapid falls from edges and too much fall damage too early Only use y direction for fall magnitude. Fixes a bug where fall damage would be applied when jumping into a wall horizontally. default fall damage reduced from 15 to 13 to match building height Combat.RpcOnDamageReceived renamed to RpcOnReceivedDamage for consistency Combat.onReceivedDamage event renamed to onReceivedDamageServer because it's a server event Combat.onClientReceivedDamage added in case it's needed by addons or other components Construction component renamed to PlayerConstruction because it's a player component Crafting renamed to PlayerCrafting because it's a player component Database.CharactersForAccount simplified DropRandomItemsOnDeath: simplified code FirstPersonClipping: remove unused DisableWeaponDepthCheck field FSM: remove unused functions FSM component renamed to FiniteStateMachine for ease of use. Reassign the ZombieAnimation component's Fsm field if necessary. PlayerMeta.localPlayer simplified: points to ClientScene.localPlayer.gameObject now PlayerMeta: Destroy simplified PlayerMeta component renamed to Player for ease of use BattleRoyaleSphere: simplify code ZombieFSM component renamed to Zombie for ease of use Hydration: simplified code IKHandling: added OnAnimatorIK parameter for consistency with Unity's function Interaction renamed to PlayerInteraction because it's a player component NetworkManagerSurvival.IsConnecting syntax improved Extensions.FindIndex isn't needed anymore, it's in Mirror now Storage.OnDestroy simplified Structure component added to PaletteStructure in order to keep track of all structures at runtime NetworkManagerSurvival.Save uses Structure.structures instead of FindObjectsWithTag to greatly improve saving performance NetworkManagerSurvival.Save: avoid expensive .ToList calls by passing the IEnumerable to Database NetworkManagerSurvival: use public override for OnApplicationQuit and OnValidate Utils.Raycast/Linecast/SpherecastWithout: huge performance improvements by caching the backups dictionary V1.45 [released 2019-04-23] NetworkTransformRubberbanding: removed 'Some' compression level for consistency with Mirror's NetworkTransform Utils Float packing functions removed. Use Mirror's built in FloatBytePacker instead. PlayerAnimation: use left jump leg by default, instead of using no jump leg Mirror updated to latest version (2019 support) V1.46 [released 2019-04-24] Mirror updated to latest version (server-only movement fix) V1.47 [released 2019-04-27] New Movement synchronization: works perfectly smooth now, even while jumping Server interpolates movement now too, this way it's easier to hit players that are running. Previously they would do warps between positions. PlayerMovement: DEAD state to fix being able to jump while dead V1.48 [released 2019-05-02] Volund charactercontroller radius decreased to 0.2 to fit better Logo file updated. Doesn't show UNET anymore. Volund prefab Endurance component: fix second drain state using CRAWLING instead of JUMPING. now jumping reduces endurance again. Fix poster flickering by moving it further out of the wall PlayerMovement: JUMPING state renamed to AIRBORNE so it can be used for falling too PlayerMovement: EventFalling is checked from all states, and EventLanded is only checked in AIRBORNE state. Fixes issues where the landing sound and falling animation were played when walking down tiny cliffs like stairs. Also fixes a bug where the falling animation wouldn't be shown for other players unless they jumped (not if they just well). PlayerMovement: scale CharacterController collider at runtime to fix a bug where someone could fire above a crawling player and still hit him, because the CharacterController collider was still in standing pose. PlayerMovement.Update: remove old code SetDirtyBit code. NetworkTransformRubberbanding does that now. This way we don't always set self to dirty if not idle. Volund prefab: set Heartbeat AudioSource default volume to 0 so we don't hear a loud heartbeat sound upon joining the game V1.49 [released 2019-05-14] New character controller to fix all kinds of movement bugs Sliding Fixed fall damage not being applied to clients when in host mode Upgrade to Unity 2018.4.0 LTS V1.50 [released 2019-05-22] Fixed floating boxes Fixed flickering poster Idle turn animation PlayerAnimation dampening for Direction, and Dampening is configurable in the Inspector now. Makes Idle->Walk transition look a lot more smooth Movement acceleration/deceleration for a less rapid, smoother feeling Reduce footstep/landing sounds volume by -5dB Rotation via QE keys while walking so the player can be rotated without the mouse, only with the keyboard. This makes it more fun sometimes. Database.OnApplicationQuit closes the connection to prevent locking. V1.51 [released 2019-05-27] Disabled climbing acceleration for a better feeling Set jumping max speed when starting to jump so players can't press the shift key to suddenly jump faster while in the air Jog backward Animation Landing Roll Animation Mirror updated to latest version Move CharacterController in FixedUpdate instead of Update. Fixes a bug where movement speed would be significantly slower in builds. Fixes rapid twitching when sliding down some slides. NetworkTransformRubberbanding uses FixedUpdate too, just to be sure isGroundedWithinTolerance uses networked velocity V1.52 [released 2019-06-05] New FixedUpdate based movement synchronization with Rubberbanding Removed NetworkTransformRubberbanding component Downgraded to Unity 2018.3.6 to avoid linux UI StackOverflowException bug PlayerMovement: if not localplayer then adjust collider before moving, not after PlayerMovement.OnTriggerExit: add ClientCallback for consistency with OnTriggerEnter Remove pool door to avoid unrealistic edge cases when starting/stopping swimming V1.53 [released 2019-06-11] Adjusted water collider so it doesn't go through the wall Save and load y rotation too for a better feeling between sessions. it feels too strange when spawning while looking into the wrong direction. Make sure to delete the old database file when upgrading manually. Set crawling to grounded transition to fixed duration for a smoother transition. otherwise it's too instant because the crawling idle animation is only 1 frame long. Mirror updated to latest version (forceHidden fix etc.) Replace Skinned Mesh Equipment bones if possible in order to follow IK if needed V1.54 [released 2019-06-14] Added Gizmo to respawn point Respawn point moved into the compound Added more zombies around the compound Fix door not opening in server-only mode because the animation wasn't played Rebaked navmesh after pool modification so zombies can't walk through the wall anymore Make RangedWeaponItem Raycast layers configurable and remove Water, UI from them to fix a bug where bullets wouldn't go through a water surface. Set server tick rate to 50Hz, which is common for fast paced / shooter servers. V1.55 [released 2019-06-23] Fix fall damage on clients sometimes not being applied because we calculated it AFTER calling controller.move on the server, even though we call it BEFORE controller.move for the local player. PlayerMovement.OnGUI: add more debug info OpenCharacterController: GroundedTestDistance made configurable OpenCharacterController: groundedTestDistance default value set to 0.002 and added comment. Fixes a bug where fall controller.isGrounded would constantly switch between true/false while standing on the Floor BoxCollider, even though it works fine with MeshColliders. Zombie prefab attack range reduced from 3 to 2 for a more realistic value Utils.IsReachableVertically adjusts head distance checks by size/2 for a more realistic reachability. Fixes a bug where a zombie could attack a player standing on the battle bus. PlayerMovement.EventLadderEnter added so that OnTriggerEnter doesn't start it no matter what. Instead the state machine takes care of it as it should. Fixes a bug where the collider wouldn't be reset when going from crawling/crouching to climbing. Also allows for underwater climbing now. PlayerMovement: don't decelerate with run speed when starting to crawl while running. limit speed to the state's max speed. feels better for the gameplay, and allows for easier speedhack protection later on if we can always assume a max speed for a state. V1.56 [released 2019-06-24] Fix hidden objects still showing because NetworkProximityGridChecker used to return false instead of true when forceHidden PlayerMovement: .collider replaced with .controllerCollider, which is not affected by animations Player animation controller: disabled HasExitTime for swim state exit transition. Fixes a bug where the swim animation would sometimes be played for way too long even after standing on the ground already. Adjusted water exit plane PlayerMovement.OnGUI: wider area so that lastFall fits in one line Player prefab: underwater threshold set to 0.9 for a better feeling V1.57 [released 2019-06-28] Mirror updated to latest version (reduced allocations, several fixes) Zombie MOVING state: if target is unreachable then stop movement before going back to IDLE. Fixes a bug where the zombie would be sliding to players sometimes. Zombie ATTACKING state: go directly to MOVING if target is too far away. It's more robust this way and avoids one unnecessary transition to IDLE. Utils.IsReachableVertically: originTop reuses originCenter for consistency with otherCenter calculation Zombie collider field replaced with mainCollider, and added a CapsuleCollider (trigger) to the main Zombie prefab. This is easier to work with for distance calculations like attack range. Zombie/Player: target collider is now found via GetComponent instead of GetComponentInChildren because all entities have main colliders now (instead of only having animated hip colliders) Utils.IsReachableVertically: color code the DrawLine calls for significantly(!) easier debugging. Now what we see has meaning. Utils.IsReachableVertically factors in the collider size via ClosestPoint to fix a bug where it would return false even though it was reachable, simply because the maxDistance wasn't enough to include both colliders in it since we previously calculated from center to center. Zombie.EventTargetUnreachable: consider attack range too to fix a bug where a zombie considers a player unreachable if he is out of attack range due to the latest maxDistance parameter in IsReachable. Zombie attack speed and animation speed doubled Zombie: remove EventTargetUnreachable. Always run as close to target as possible instead and only attack once we are in attack range and if reachable. Fixes a bug where a zombie wouldn't stand idly if a player is behind a corner, only to follow it and stand idly again if the player moved out of attack range. Zombie IDLE/ATTACKING states: don't go to MOVING while the path is pending. Fixes a bug where the zombie would constantly switch between IDLE->MOVING->IDLE->... if the target is behind a wall with no path to it, which would cause strange behavior and constant state resync. Utils.IsPointInScreen helper function added PlayerMovement.OnGUI: only show debug info if in screen. Fixes a bug where debug guis would be shown in wrong places. PlayerMovement.OnGUI: improved debug gui color readability PlayerMovement.OnGUI: only show lastFall.y Zombie.OnGUI: added visual debug info too. debugVisibilityCurves to fade debug GUI in and out and only display if any alpha to avoid computations. Volund body part colliders (as trigger). Make sure to add trigger colliders to the body parts when updating manually. Zombie body part colliders (as trigger). Make sure to add trigger colliders to the body parts when updating manually. Zombie main collider/gameobject set to IgnoreRaycast layer, while child objects all have Zombie layer so that body parts are getting hit properly, and main collider is only used for movement. Player main collider/gameobject set to IgnoreRaycast layer, while child objects all have Player layer so that body parts are getting hit properly, and main collider is only used for movement. Utils.IsReachableVertically: check 'if nothing is inbetween' instead of checking 'if linecast hits other collider'. This way it works for IgnoreRaycast main colliders again. This is also faster because we only linecast if within distance. Also fixes a bug where zombies previously would be able to attack the player through the fence. Utils.IsReachableVertically uses Physics.Linecast directly now. This is possible because the zombie/player main colliders are on IgnoreRaycast layers and the body parts are triggers, so we can simply ignore triggers while casting. This makes zombie IsReachable checks SIGNIFICANTLY faster and fixes a performance regression where the server would completely slow down if one zombie constantly does IsReachable checks between two aggro players. NetworkManagerSurvival.showDebugGUI option added Documentation updated (character creation updated to use body parts etc.) Health component: avoid Sum to fix performance regression and GC Endurance component: avoid Linq to fix performance regression and GC Hydration component: avoid Linq to fix performance regression and GC Nutrition component: avoid Linq to fix performance regression and GC Temperature component: avoid Linq to fix performance regression and GC Equipment.GetItemIndexByName: avoid Linq Equipment bonus: avoid Linq V1.58 [released 2019-07-03] Zombie AggroArea layer changed to new AggroArea layer that only collides with the Player layer. Improves performance because previously the AggroArea would collide with anything. PlayerLook.raycastLayers LayerMask added and used in PlayerLook.lookPositionRaycasted. This way we can exclude the AggroArea layer and not raycast against it when doing melee hits etc. RangedWeaponItem.raycastLayers removed. It uses PlayerLook.raycastLayers instead. This is overall more consistent and avoids having to configure each weapon's raycast layers separately. PlayerInteraction uses PlayerLook.raycastLayers for consistency. This way items can be picked through AggroAreas too. MeleeWeaponItem uses PlayerLook.raycastLayers for consistency. This way melee weapons can hit through the AggroArea too. Build system (StructureItem, PlayerConstruction) use Look.raycastLayers for consistency. This way structures can be built within AggroAreas too. Zombie.allowKiting option V1.59 [released 2019-07-09] Combat: avoid Linq for performance and to reduce GC CursorLocking: avoid Linq Inventory: avoid Linq NetworkManagerSurvival: avoid Linq NetworkMessages: avoid Linq PlayerEquipment: avoid Linq Utils: avoid Linq UIUtils: avoid Linq V1.60 [released 2019-07-18] Entity.GetInventoryIndexByName: avoid allocations Mirror updated to latest version (performance improvements, NetworkWriter pooling, SyncList no observers memory fix, etc.) Database.Connect function called from NetworkManagerMMO.OnStartServer to only connect on server, not on clients. Fixes the WebGL error. NetworkManagerSurvival: disable some log messages to not spam the server logs NetworkManagerSurvival.OnApplicationQuit removed because Mirror handles it now NetworkManagerMMO.DoServerDisconnect: don't log if no playercontroller because that happens if a player disconnects while in lobby. Database: forgot to initialize singleton in Awake after recent Connect change Zombie class renamed to Monster because not all monsters will be zombies, and for consistency with uRPG/uMMORPG EquipmentItem.category moved to UsableItem.category Hotbar location models V1.61 [released 2019-07-31] Inventory.SlotsOccupied added ScriptableRecipe made abstract, added CraftingRecipe to prepare for Furnace ScriptableRecipe.OnValidate: set ingredient amount to at least 1 after assigning a new ingredient. ScriptableRecipe.CanCraftWith: filter out empty slots to prepare for furnace CraftingRecipe.FindForIngredients function that is used by PlayerCrafting and UICrafting. Also avoids Linq for performance. PlayerStorageUsage: use look.headPosition instead of transform.position in Cmds. Fixes a bug where we could open the storage but not modify slots because we were in PlayerInteraction's raycast range but not in Cmd's range. Also makes interacting with storages above the player easier. Crafting at Furnace V1.62 [released 2019-08-17] Fix UIInventory slots being used when dragged onto themselves because button.interactable was set and would overwrite UIDragAndDropable's interactable while dragged. NetworkProximityGridChecker: reduce OnRebuildObservers allocations from 9.6KB to 8.1KB by reusing the HashSet NetworkProximityGridChecker: reduce Grid2D Get allocations from 8.1KB to 3.5KB by reusing empty HashSet fix Furnace.Update warning by using ServerCallback fix Furnace not rebaking after dragging item out of it while baking. last slots are now assigned all the time no matter what. V1.63 [released 2019-09-21] Equipment: check durability > 0 in bonus calculation to exclude broken items from boni V1.64 [released 2019-09-30] Mirror updated to latest version (auth, sync-to-owner, allocation-free send) Hydration/Nutrition/Temperature/Endurance energies sync mode set to Owner to save bandwidth PlayerRespawning/Inventory/Combat/Construction sync mode set to owner to save bandwidth NetworkAuthenticatorSurvival component added to NetworkManager. takes care of all the authentication, and unauthenticated connections can't send messages (or bypass authentication) anymore; OnServerLogin addon hook renamed to OnServerConnect. V1.65 [released 2019-10-01] Item cooldowns Weapons use new item cooldowns too. Fixes a bug where having one 10s cooldown on one item would require 10s before using the next item of a different type too Fixed some build warnings Save and load hotbar selection in Database for a better user experience FirstPersonClipping uses a new HideInFirstPerson layer to hide meshes in first person. Main Camera clips this layer, Volund Prefab's Equipment Avatar camera shows this layer. Fixes a bug where the player head in first person would be hidden in the equipment avatar. Also improves performance because less draw calls and no material swaps are needed. Football helmet equipment item for easier testing FirstPersonClipping: use transforms instead of renderers and hide all renderers in children. this way it works for equipments lots (like head slot) too. Make sure to reassign the hideRenderers in the player prefab's FirstPersonClipping component when upgrading. FirstPersonClipping: calculate nodepth layer name only once ItemModel layer created and assigned to all item models. Both main camera and player prefab's avatar camera show the ItemModel layer now. fixes a bug where the helmet wouldn't be shown in the equipment avatar unless in first person. Equipment slots can now be dragged out of the window to drop the item to the ground V1.66 [released 2019-10-04] ItemDropSpawners removed. ItemDrops now have a 'respawn' and 'respawnInterval' property. They can be placed directly in the scene for an easier workflow, and instead of Destroying+Spawning, they are simply hidden for much better performance. Additionally we avoid lots of unnecessary ItemSpawner NetworkIdentities in the scene too. When upgrading manually: make sure to reassign the proximityChecker field in each ItemDrop and replace your ItemDropSpawners with the ItemDrops directly and enable respawn and respawnInterval for them in the scene. Removed Outline shader for compatibility with Standard Shader and future rendering pipelines. NetworkManagerSurvival: character creation code moved into separate function Reimplemented SQLite database for 10x performance improvements. make sure to delete your old database file when upgrading manually. Database: renamed structure x/y/zRot to x/y/zrotation for consistency Database: renamed character table's class field to classname to avoid C# name collisions with built in 'class' football helmet: added durability to tooltip ScriptableItem.OnValidate: disallow durability for stackable items to avoid confusion when people can't stack the same item types with different durabilities. UIEquipment, UIHotbar: reset image color to white for no-durability items. Fixes a bug where no-durability items could still have the wrong color when dragging them into a slot where a durability item was before. V1.67 [released 2019-10-08] NetworkmanagerSurvival.OnClientDisconnect: remove redundant StopClient call because base function already does so Database.CharacterLoad: add missing deleted check Mirror updated to latest version UsableItem: only modify cooldown dict if we have a cooldown. avoids resync for 0 cooldown items. NetworkManagerSurvival.OnStart/StopServer: remove unnecessary base calls NetworkManagerSurvival.OnServerAddPlayer replaced with OnServerCharacterSelect and CharacterSelectMsg to avoid obsolete Mirror warnings. NetworkManagerMMO.OnServerCharacterSelect addon hook added too. NetworkManagerSurvival: set client ready after selecting a character. not after connecting. Database: character_equipment inherits from character_inventory to save code Database: character_hotbar inherits from character_inventory to save code CraftingRecipe.FindForIngrediends renamed to Find for consistency with uMMORPG FurnaceRecipe.FindForIngrediends renamed to Find for consistency with uMMORPG CraftingRecipe.IngredientsNotEmpty function that avoids Linq PlayerCrafting.CmdCraft: pass recipe name so that the server doesn't have to search the whole recipe dict, which would potentially slow down the whole world NetworkManagerSurvival: cache player classes in Awake GUIConsole updated: usable with F12 hotkey, limit memory usage, etc.