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

Needless authority check on repulse effect #273

Open
TheYellowArchitect opened this issue Sep 4, 2024 · 0 comments
Open

Needless authority check on repulse effect #273

TheYellowArchitect opened this issue Sep 4, 2024 · 0 comments

Comments

@TheYellowArchitect
Copy link
Contributor

TheYellowArchitect commented Sep 4, 2024

Not sure, its a question but if I'm correct, 1 line change is needed.
So, on the class repulse-effect.gd there is the following code

func _rollback_tick(tick):
	super._rollback_tick(tick)

	if not is_active():
		return
	
	for body in area.get_overlapping_bodies():
                #Question on the below line.
		if body is BrawlerController and body.is_multiplayer_authority() and body != get_parent_node_3d():
			var displaceable = body.get_node("Displaceable") as Displaceable
			if not displaceable:
				continue

			var diff: Vector3 = body.global_position - global_position
			var f = clampf(1.0 / (1.0 + diff.length_squared()), 0.0, 1.0)
			diff.y = max(0, diff.y)
			displaceable.displace(diff.normalized() * strength * f * NetworkTime.ticktime)
			
			if body is BrawlerController and body != get_parent_node_3d():
				body.register_hit(get_parent_node_3d())
if body is BrawlerController and body.is_multiplayer_authority() and body != get_parent_node_3d():

If I remove the authority check

if body is BrawlerController and body != get_parent_node_3d():

doesn't the server still override the client? I tried removing the authority check and ran at 150 ms delay and there was no jitter or anything, so unless I am missing something, this seems a good change, as its basically local state prediction, and when the server overrides the client, the position is closer to truth.

Related: Local prediction is already done in powerup.gd (see comment #predict)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant