forked from unfa/liblast
Fixed basic multiplayer. Mivement is a bit jittery, but overall works.
parent
651c582ce6
commit
cfaa3e2ba1
|
@ -82,9 +82,12 @@ var gravity_vec := Vector3.ZERO
|
|||
func _ready() -> void:
|
||||
#Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
view_zoom = 1.0
|
||||
|
||||
rpc_config(&"move_and_slide", MultiplayerAPI.RPC_MODE_REMOTESYNC)
|
||||
|
||||
rpc_config(&"move_and_slide", MultiplayerAPI.RPC_MODE_PUPPETSYNC)
|
||||
rpc_config(&"aim", MultiplayerAPI.RPC_MODE_PUPPETSYNC)
|
||||
rpc_config(&"set_global_transform", MultiplayerAPI.RPC_MODE_PUPPET)
|
||||
rpc_config(&"set_linear_velocity", MultiplayerAPI.RPC_MODE_PUPPET)
|
||||
head.rpc_config(&"set_rotation", MultiplayerAPI.RPC_MODE_PUPPETSYNC)
|
||||
|
||||
func aim(event) -> void:
|
||||
var mouse_motion = event as InputEventMouseMotion
|
||||
|
@ -110,10 +113,11 @@ func _input(event) -> void:
|
|||
tween.interpolate_property(self, "view_zoom", view_zoom, 1.0, 0.25, Tween.TRANS_SINE, Tween.EASE_IN_OUT)
|
||||
tween.start()
|
||||
|
||||
aim(event)
|
||||
|
||||
rpc_unreliable(&'aim', event)
|
||||
|
||||
func _physics_process(delta):
|
||||
rpc_unreliable(&'set_global_transform', global_transform)
|
||||
head.rpc_unreliable(&'set_rotation', head.get_rotation())
|
||||
|
||||
direction = Vector3.ZERO
|
||||
|
||||
|
@ -150,7 +154,8 @@ func _physics_process(delta):
|
|||
|
||||
linear_velocity = velocity + gravity_vec
|
||||
#slide = move_and_slide_with_snap(movement, snap, Vector3.UP)
|
||||
rpc(&"move_and_slide")
|
||||
rpc_unreliable(&'set_linear_velocity', linear_velocity)
|
||||
rpc_unreliable(&"move_and_slide")
|
||||
#move_and_slide()
|
||||
|
||||
if not is_on_floor() and not ground_check.is_colliding(): # while in mid-air collisions affect momentum
|
||||
|
|
|
@ -44,7 +44,7 @@ func _input(_event) -> void:
|
|||
focus = GameFocus.GAME
|
||||
|
||||
|
||||
func create_player(id: int, is_local) -> void:
|
||||
func create_player(id: int, is_local: bool) -> void:
|
||||
var new_player = player_scene.instance()
|
||||
var spawnpoint = $Map/SpawnPoints.get_children()[randi() % len($Map/SpawnPoints.get_children())]
|
||||
new_player.name = str(id)
|
||||
|
@ -57,6 +57,8 @@ func create_player(id: int, is_local) -> void:
|
|||
local_player.get_node("Head/Camera").current = true
|
||||
else:
|
||||
$Players.get_node(str(id) + "/Head/Camera").current = false
|
||||
if local_player:
|
||||
local_player.get_node("Head/Camera").current = true
|
||||
|
||||
func _on_Host_pressed():
|
||||
$NetworkTesting/Host.disabled = true
|
||||
|
|
|
@ -128,7 +128,7 @@ anti_aliasing/screen_space_roughness_limiter/enabled=false
|
|||
global_illumination/sdfgi/probe_ray_count=2
|
||||
global_illumination/sdfgi/frames_to_converge=0
|
||||
global_illumination/sdfgi/frames_to_update_lights=4
|
||||
anti_aliasing/quality/msaa=1
|
||||
anti_aliasing/quality/msaa=2
|
||||
anti_aliasing/quality/screen_space_aa=1
|
||||
anti_aliasing/quality/use_debanding=true
|
||||
occlusion_culling/use_occlusion_culling=true
|
||||
|
|
Loading…
Reference in New Issue