-
-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Combat - Basic syncing #652
Conversation
- Create/Remove of trash now have to approve by the server first - Planet trash will only send to the players on that planet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made it to file 116 of 152 however have to sleep soon so I will submit this as the first part.
Code looks good overall! Added a bunch of comments only almost everything are minor nitpicks, so take them with a grain of salt :)
NebulaNetwork/PacketProcessors/Combat/DFRelay/DFRelayLeaveBaseProcessor.cs
Outdated
Show resolved
Hide resolved
NebulaNetwork/PacketProcessors/Combat/DFRelay/DFRelayArriveBaseProcessor.cs
Outdated
Show resolved
Hide resolved
NebulaNetwork/PacketProcessors/Combat/DFRelay/DFRelayArriveDockProcessor.cs
Outdated
Show resolved
Hide resolved
NebulaNetwork/PacketProcessors/Combat/DFRelay/DFRelayLeaveBaseProcessor.cs
Outdated
Show resolved
Hide resolved
var num10 = ((__instance.hatred.max.targetType == ETargetType.Player) ? 1f : 0.8f); | ||
if (num9 < (double)(num2 * num10)) | ||
{ | ||
var num11 = Maths.Clamp01(((double)num2 - num9) / (double)(num2 - 5500f)) * 15.0 + 3.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpick, might be nice to note where these magic numbers 5500f
, 15.0
and 3.0
come form (or put them into constants)?
if (num9 < (double)(num2 * num10)) | ||
{ | ||
var num11 = Maths.Clamp01(((double)num2 - num9) / (double)(num2 - 5500f)) * 15.0 + 3.0; | ||
var num12 = Maths.Clamp01(((double)num3 - num5) / (double)(num3 - 1500f)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpick, might be nice to note where this magic number comes form (or put it into a constant)?
var magnitude = (vectorLF * (__instance.orbitRadius / num14) + __instance.starData.uPosition - uPos).magnitude; | ||
if (magnitude < (double)num2) | ||
{ | ||
var num16 = Maths.Clamp01(((double)num2 - magnitude) / (double)(num2 - 5500f)) * 15.0 + 3.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpick, might be nice to note where these magic numbers 5500f, 15.0 and 3.0 come form (or put them into constants)?
if (magnitude < (double)num2) | ||
{ | ||
var num16 = Maths.Clamp01(((double)num2 - magnitude) / (double)(num2 - 5500f)) * 15.0 + 3.0; | ||
var num17 = Maths.Clamp01(((double)num3 - num15) / (double)(num3 - 1500f)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpick, might be nice to note where this magic number comes form (or put it into a constant)?
{ | ||
var num16 = Maths.Clamp01(((double)num2 - magnitude) / (double)(num2 - 5500f)) * 15.0 + 3.0; | ||
var num17 = Maths.Clamp01(((double)num3 - num15) / (double)(num3 - 1500f)); | ||
var num18 = __instance.sector.skillSystem.maxHatredSpaceTmp * num17 * num16 * 0.6; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpick, might be nice to note where this magic number comes form (or put it into a constant)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finished the second part of my review :) I opted not to make comments about the magic numbers since I don't think there that relevant. Again mostly nitpicky stuff.
One thing I did notice is that there might be some prefix and postfix patches that could potentially be turned into transpiler patches. I did not comment about them explicitly, however if you want I could go through them again after the weekend and add a comment to them?
Co-authored-by: mmjr-x <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the great work on this and all the time you put into it!
This is a branch for combat framework and basic unit syncing.
Video demo: Ground Unit Syncing
The roadmap can be found here. The work includes in this PR:
Initial handshake
Basic syncing
Mecha
Ground
DF aggro
DF/Building interaction
Space
DF aggro
Temporarily Disable
Implement Detail
Dark Fog Ground Unit syncing
The goal is to let
PlanetFactory.enemyPool
stay in sync. So every function that callPlanetFactory.AddEnemyDataWithComponents
andPlanetFactory.RemoveEnemyWithComponents
need to approve by the server first.For example, when a client sees an enemy reduce HP to 0, it will set the enemy to a frozen state and request the server to kill it. When the server receives the valid request, it will broadcast the kill event to clients. After receiving the event, the client will kill it and process the following effect.
Dark Fog Space Unit syncing
Similar to the ground unit, let
SpaceSector.enemyPool
stay in sync.Here are patch to functions:
CSE_
is just for demo so they can be ignored.Dark Fog Planetary Base Exp and Threat
The client doesn't update exp level and threat locally. It will wait for the server to send
DFGUpdateBaseStatusPacket
every 5s to update those values. TheLaunchAsssult
event is trigger by the server too.Mecha
RemotePlayerModel.PlayerInstance
now hascontroller
member to use more vanilla properties.The weapon is client triggered, that local will fire first then broadcast to other players.
CombatManager
This stores some players' variables that are frequently used in combat systems. For example,
PlayerPosition
cache the player position and states.The positions of other players are using the delayed interpolated position therefore they may cause some distortion.
EnemyMananger
This stores the status of Dark Fog bases and hive, and sends updates to clients every 5 seconds.
Also, it has the common functions that will try to pre-assign the enemyId before creating the enemy.
Skill System
This system in the game manages all kinds of projectiles and stores the properties of the player.
The default player id is 1. In multiplayer it is changed to playerId. The local playerId will be
Multiplayer.Session.LocalPlayer.Id
.Rework
GlobalGameDataRequest/GlobalGameDataResponse
When client join, after the initial handshake, it will now request the global data from the server first (History, SpaceSector, MilestoneSystem, TrashSystem). After those binary data are collected, the client will then proceed
DSPGame.StartGameSkipPrologue
to start the game loader sequence. BeforeGameData.NewGame
, the client will import those binary data.TrashSystem
Now trash will be separated into two types: Those that have lifetime (Dark Fog drop), and those that have no lifetime (normal). The Dark Fog drop are now partially syncing for clients to only sync on the drop on the local planet.