Skip to content
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

Add basic sync for PvP #2107

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tornac1234
Copy link
Collaborator

@tornac1234 tornac1234 commented Jan 10, 2024

  • Basic sync for PvP (only allowed with knifes and heatblades for now)
  • Maybe: add sync for propulsion and repulsion cannon

To be tested (and merged) upon #2106 (won't work without it)

@tornac1234 tornac1234 added the Area: player Related to player character actions label Jan 10, 2024
@tornac1234 tornac1234 force-pushed the sync-pvp branch 2 times, most recently from df9fb08 to eb16f7b Compare January 10, 2024 20:19
@ywgATustcbbs
Copy link

ywgATustcbbs commented Jan 29, 2024

is there really one who likes pvp in Subnautica? if one wants pvp, why not go ahead to play pvp games? there are tons of such games. i don't think core players of Subnautica are interested in pvp.

@NinjaPedroX
Copy link
Contributor

is there really one who likes pvp in Subnautica? if one wants pvp, why not go ahead to play pvp games? there are tons of such games. i don't think core players of Subnautica are interested in pvp.

Most multiplayer games have ways for players to damage each other. Even if it's not the main focus of the game, it gives players more options to have fun with their friends. Having a last man standing battle within a large base or picking people up and repelling them far away with the propulsion cannon is the kind of thing people (like myself) like to do with our friends. I don't think the argument of "if you want to do PvP, play a PvP game" is a good reason to stop this.

Besides, you can just turn PvP off in the configs if you don't want it.

@tornac1234
Copy link
Collaborator Author

Waiting for #2106 to be merged, then this will get some tests and will be ready to be merged

@Measurity Measurity added this to the 1.8 milestone Aug 9, 2024
[Serializable]
public class PvPAttack : Packet
{
public string TargetPlayerName { get; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we send the name and not the playerId? Seems unnessary to have so many bytes in the packet...

private readonly PlayerManager playerManager;

// TODO: In the future, do a whole config for damage sources
private static readonly Dictionary<PvPAttack.AttackType, float> DamageMultiplierByType = new()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be lower case

Type = type;
}

public enum AttackType
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would define it as a byte sized enum to reduce space.

{
public override void Process(PvPAttack packet)
{
if (Player.main && Player.main.liveMixin)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would log not finding this as an error bc the damage is disappearing without the player sending a health update back to the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: player Related to player character actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants