-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
[EPIC] Creature Sync
Supersedes #113
For version 1.8, efforts were made to begin synchronizing creatures in order to make multiplayer gameplay more immersive. Previously, some creature movements were indirectly synchronized, which could give the illusion that they were synchronized.
Point of Interests for the current system :
- Creature_ChooseBestAction_Patch
- CreatureAction_Perform, StartPerform, StopPerform
- NitroxClient.AI
How ?
Before starting work on synchronizing a creature, it is necessary to provide a status report in the PullRequest.
This should include a list of behaviors (detailed in steps below). For each one, mention if there are things to synchronize, if it is unnecessary, if it is being added to the whitelist, if it is already synchronized, etc.
i.e:
O => Things to sync
X => Nothing to do
CAW => Needs Creature Action Whitelisting
* Stalker : **[O]** FindNest can change leashPosition
* StayAtLeashPosition : **[X]** Nothing interesting
* SwimToHeroPeeper **[CAW]** Only activating animations, which is safe
* PrisonPredatorSwimToPlayer **[O]** Evaluate and Perform need to be adapted so they can also target remote player
* ...-
You can add the creature you're syncing inside
AI.syncedCreatureWhitelist, that will allowCreature.ChooseBestAction()to run for such creature, allowing you to test your CreatureAction you'll synced. -
For a given creature, list all MonoBehaviors (i.e: using debugger) that are either a
CreatureActionor responsible for a specific behavior of the creature.
Note
Don't forget to look at methods inside the class representing the Creature. Class technical names are listed in this issue.
-
For MonoBehaviors that ARE NOT
CreatureAction: Check if some methods should be cancelled/broadcasted depending on the simulation state of the creature (i.e: StalkerTooth Drop can't be played by all players, that would duplicate tooth) -
For MonoBehaviors that ARE
CreatureAction: Check if StartPerform/StopPerform are doing some processing that needs proper syncing (i.e: creature state : leash position, target, ...) not animations or visual stuff, if those two methods are safe and don't need any sync : They can be added toAI.creatureActionWhitelist
Note
Creature Action Whitelist allows CreatureActions to run StartPerform/StopPerform on remote clients. Most of the time those are useless and might cause data desync . For example, FleeOnDamage will set the leashPosition to something that is likely different than the other users' leashPosition for the same creature. Thus we cannot add this behaviour to creatureActionWhitelist.
Actions concerning the creature movement should be ignored as it's already done through SplineFollowing
-
For all MonoBehaviors check if some methods might need to be adapted, for example some methods creature will use to scan for targets might use hardcoded Player class, which will cause the host to be the only one attacked, since RemotePlayer won't be scanned by simulated entities : i.e:
SeaDragonAggressiveTowardsSharks_GetAggressionTarget_Patch -
All done, thank's :D
Creature List
List extracted from Creature file, those are technical names that do not necessarily correspond to the name by which they are known.
https://subnautica.fandom.com/wiki/Fauna
Warning
Some creatures might been already partially synced and this list doesn't reflect that (i.e: CrashFish, Stalker, basic fishes like Peeper)
- BloomCreature
- Boomerang
- LavaLarva
- OculusFish
- Eyeye
- Garryfish
- Gasopod
- Grabcrab
- Grower
- Holefish
- Hoverfish
- Jellyray
- Jumper
- Peeper
- RabbitRay
- Reefback
- Reginald
- SandShark
- Spadefish
- Stalker : Worked on Add sync for stalkers #2255
- Bladderfish
- Hoopfish
- Mesmer
- Bleeder
- Slime
- Crash
- CuteFish
- Leviathan : Done by Sync leviathans gameplay #2106
- ReaperLeviathan : Done by Sync leviathans gameplay #2106
- CaveCrawler
- Bird
- BoneShark
- Biter
- Shocker
- CrabSnake
- SpineEel
- SeaTreader : Done by Sync leviathans gameplay #2106
- CrabSquid
- Warper
- LavaLizard
- SeaDragon : Done by Sync leviathans gameplay #2106
- GhostRay
- SeaEmperorBaby
- GhostLeviathan : Done by Sync leviathans gameplay #2106
- SeaEmperorJuvenile
- GhostLeviathanVoid
CreatureAction
- AttachAndSuck
- AttachToVehicle
- AttackCyclops : Done by Sync leviathans gameplay #2106
- AttackLastTarget : Done by Sync leviathans gameplay #2106
- AvoidEscapePod : Worked on Add sync for stalkers #2255
- AvoidObstacles
- AvoidPosition
- AvoidTerrain
- BirdsFlapping
- Breach
- BurryInSand
- CircleAroundPlayer
- CircleAroundPlayerWhenCurious
- CircleAroundSameKind
- Coil
- CollectShiny
- CrawlerAttackLastTarget
- CrawlerAvoidEdges
- CrawlerJumpRandom
- DescendToGround
- DescentToLava
- EMPAttack
- FeedOnGroundWhenHungry
- FleeOnDamage : Worked on Add sync for stalkers #2255
- FleeWhenScared
- FlyAboveMinHeight
- FlyAwayWhenScared
- Hide
- JumperDrift
- JumperWalkOnGround
- LavaLiazardRangedAttack
- MoveOnGround
- MoveOnSurface
- MoveTowardsTarget
- MushroomAttack
- PlayAnimation
- Poop : Done by Sync leviathans gameplay #2106
- PrisonPredatorSwimToPlayer : Worked on Add sync for stalkers #2255
- ProtectCrashHome
- PullCreatures
- RangedAttackLastTarget : Done by Sync leviathans gameplay #2106
- Roost
- StareAtNearbyPlayer
- StayAtLeashPosition
- SwimFigureEight
- SwimInGroup
- SwimInSchool
- SwimRandom
- SwimToEnzymeCloud
- SwimToEnzymes
- SwimToHeroPeeper
- SwimToMeat
- SwimToMushroom
- SwimToTarget
- SwimToVent
- TreaderMoveOnSurface
- TreaderStayAtLeashPosition
- WalkOnGroud
- WarperInspectPlayer
- WarpOut