Skip to content

spread is not synced #2

@Solaris11Gamer

Description

@Solaris11Gamer

From buu2 base in GM:ShootCode

bullet.Dir        = (self.Owner:EyeAngles() + viewp + Angle(math.Rand(-cone, cone), math.Rand(-cone, cone), 0)*33):Forward()

You are using math.Rand to help determine the spread/bullet dir, the problem is, math.Rand is not synced client to server

so the spread on the client will not be anything near that of the server.

so to ensure consistent behavior between the client and server, you should use a shared random seed or a deterministic method for generating random numbers. This way, the same random numbers will be generated on both the client and server, resulting in consistent bullet directions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions