فهرست منبع

:fire: Remove other experiment projects

DricomDragon 1 سال پیش
والد
کامیت
814dc70b00
36فایلهای تغییر یافته به همراه0 افزوده شده و 1132 حذف شده
  1. 0 2
      godot/.gitattributes
  2. 0 2
      godot/.gitignore
  3. 0 17
      godot/component/entity/ball/Ball.tscn
  4. 0 127
      godot/component/entity/land/land_tile_set.tres
  5. BIN
      godot/component/entity/land/tileset_image.png
  6. 0 34
      godot/component/entity/land/tileset_image.png.import
  7. 0 45
      godot/component/entity/player/Player.gd
  8. 0 21
      godot/component/entity/player/Player.tscn
  9. BIN
      godot/component/entity/player/smiley_character.png
  10. 0 34
      godot/component/entity/player/smiley_character.png.import
  11. 0 1
      godot/icon.svg
  12. 0 37
      godot/icon.svg.import
  13. 0 16
      godot/project.godot
  14. 0 31
      godot/world.tscn
  15. BIN
      netnet/component/entity/jumper/blue_astronaut.png
  16. 0 34
      netnet/component/entity/jumper/blue_astronaut.png.import
  17. BIN
      netnet/component/entity/jumper/green_astronaut.png
  18. 0 34
      netnet/component/entity/jumper/green_astronaut.png.import
  19. 0 38
      netnet/component/entity/jumper/jumper.gd
  20. 0 52
      netnet/component/entity/jumper/jumper.tscn
  21. 0 50
      netnet/component/entity/jumper/jumper_input.gd
  22. BIN
      netnet/component/entity/jumper/pink_astronaut.png
  23. 0 34
      netnet/component/entity/jumper/pink_astronaut.png.import
  24. BIN
      netnet/component/entity/jumper/yellow_astronaut.png
  25. 0 34
      netnet/component/entity/jumper/yellow_astronaut.png.import
  26. 0 49
      netnet/component/entity/player/player.gd
  27. 0 48
      netnet/component/entity/player/player.tscn
  28. 0 25
      netnet/component/entity/player/player_input.gd
  29. 0 42
      netnet/component/entity/sphere/sphere.tscn
  30. 0 36
      netnet/project.godot
  31. 0 29
      netnet/run/levels/destination/final.tscn
  32. 0 43
      netnet/run/levels/flatland/level.gd
  33. 0 46
      netnet/run/levels/flatland/level.tscn
  34. 0 46
      netnet/run/levels/player_manager.gd
  35. 0 69
      netnet/run/multiplayer.gd
  36. 0 56
      netnet/run/multiplayer.tscn

+ 0 - 2
godot/.gitattributes

@@ -1,2 +0,0 @@
-# Normalize EOL for all files that Git considers text files.
-* text=auto eol=lf

+ 0 - 2
godot/.gitignore

@@ -1,2 +0,0 @@
-# Godot 4+ specific ignores
-.godot/

+ 0 - 17
godot/component/entity/ball/Ball.tscn

@@ -1,17 +0,0 @@
-[gd_scene load_steps=3 format=3 uid="uid://b4cy6e2mi1i51"]
-
-[ext_resource type="Texture2D" uid="uid://dy5g3iswdrc1t" path="res://icon.svg" id="1_81xv1"]
-
-[sub_resource type="CircleShape2D" id="CircleShape2D_unjtu"]
-
-[node name="Ball" type="RigidBody2D"]
-gravity_scale = 0.0
-linear_damp = 1.0
-angular_damp = 0.1
-
-[node name="Box" type="CollisionShape2D" parent="."]
-shape = SubResource("CircleShape2D_unjtu")
-
-[node name="Sprite2D" type="Sprite2D" parent="."]
-scale = Vector2(0.148438, 0.148438)
-texture = ExtResource("1_81xv1")

+ 0 - 127
godot/component/entity/land/land_tile_set.tres

@@ -1,127 +0,0 @@
-[gd_resource type="TileSet" load_steps=4 format=3 uid="uid://c1wnvwl4fiyqa"]
-
-[ext_resource type="Texture2D" uid="uid://bw0b0ornoeb4m" path="res://component/entity/land/tileset_image.png" id="1_lvbaa"]
-
-[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_7xaig"]
-resource_name = "Ground"
-texture = ExtResource("1_lvbaa")
-texture_region_size = Vector2i(65, 89)
-0:0/0 = 0
-0:0/0/texture_origin = Vector2i(0, -10)
-1:0/0 = 0
-1:0/0/texture_origin = Vector2i(0, -10)
-2:0/0 = 0
-2:0/0/texture_origin = Vector2i(0, -10)
-4:0/0 = 0
-4:0/0/texture_origin = Vector2i(0, -10)
-0:1/0 = 0
-0:1/0/texture_origin = Vector2i(0, -10)
-1:1/0 = 0
-1:1/0/texture_origin = Vector2i(0, -10)
-2:1/0 = 0
-2:1/0/texture_origin = Vector2i(0, -10)
-4:1/0 = 0
-4:1/0/texture_origin = Vector2i(0, -10)
-0:2/0 = 0
-0:2/0/texture_origin = Vector2i(0, -10)
-1:2/0 = 0
-1:2/0/texture_origin = Vector2i(0, -10)
-2:2/0 = 0
-2:2/0/texture_origin = Vector2i(0, -10)
-0:3/0 = 0
-0:3/0/texture_origin = Vector2i(0, -10)
-1:3/0 = 0
-1:3/0/texture_origin = Vector2i(0, -10)
-2:3/0 = 0
-2:3/0/texture_origin = Vector2i(0, -10)
-0:4/0 = 0
-0:4/0/texture_origin = Vector2i(0, -10)
-1:4/0 = 0
-1:4/0/texture_origin = Vector2i(0, -10)
-2:4/0 = 0
-2:4/0/texture_origin = Vector2i(0, -10)
-
-[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_0cmhd"]
-resource_name = "Rock"
-texture = ExtResource("1_lvbaa")
-margins = Vector2i(0, 61)
-texture_region_size = Vector2i(56, 64)
-0:0/0 = 0
-1:0/0 = 0
-2:0/0 = 0
-3:0/0 = 0
-4:0/0 = 0
-5:0/0 = 0
-6:0/0 = 0
-7:0/0 = 0
-8:0/0 = 0
-0:1/0 = 0
-1:1/0 = 0
-2:1/0 = 0
-3:1/0 = 0
-4:1/0 = 0
-5:1/0 = 0
-6:1/0 = 0
-7:1/0 = 0
-8:1/0 = 0
-0:2/0 = 0
-1:2/0 = 0
-2:2/0 = 0
-3:2/0 = 0
-4:2/0 = 0
-5:2/0 = 0
-6:2/0 = 0
-7:2/0 = 0
-8:2/0 = 0
-0:3/0 = 0
-1:3/0 = 0
-2:3/0 = 0
-3:3/0 = 0
-4:3/0 = 0
-6:3/0 = 0
-7:3/0 = 0
-8:3/0 = 0
-0:4/0 = 0
-1:4/0 = 0
-2:4/0 = 0
-3:4/0 = 0
-6:4/0 = 0
-7:4/0 = 0
-8:4/0 = 0
-0:5/0 = 0
-1:5/0 = 0
-2:5/0 = 0
-3:5/0 = 0
-4:5/0 = 0
-5:5/0 = 0
-6:5/0 = 0
-7:5/0 = 0
-8:5/0 = 0
-4:4/0 = 0
-5:3/0 = 0
-5:4/0 = 0
-0:6/next_alternative_id = 3
-0:6/0 = 0
-0:6/2 = 2
-1:6/next_alternative_id = 4
-1:6/0 = 0
-1:6/1 = 1
-1:6/1/flip_h = true
-1:6/2 = 2
-1:6/2/modulate = Color(1, 0.768627, 1, 1)
-1:6/3 = 3
-1:6/3/flip_h = true
-1:6/3/modulate = Color(1, 0.768627, 1, 1)
-2:6/0 = 0
-3:6/0 = 0
-4:6/0 = 0
-5:6/0 = 0
-6:6/0 = 0
-7:6/0 = 0
-8:6/0 = 0
-
-[resource]
-tile_shape = 3
-tile_size = Vector2i(65, 65)
-sources/0 = SubResource("TileSetAtlasSource_7xaig")
-sources/2 = SubResource("TileSetAtlasSource_0cmhd")

BIN
godot/component/entity/land/tileset_image.png


+ 0 - 34
godot/component/entity/land/tileset_image.png.import

@@ -1,34 +0,0 @@
-[remap]
-
-importer="texture"
-type="CompressedTexture2D"
-uid="uid://bw0b0ornoeb4m"
-path="res://.godot/imported/tileset_image.png-bc2248d47eda1485e8fb182d2ffd69f2.ctex"
-metadata={
-"vram_texture": false
-}
-
-[deps]
-
-source_file="res://component/entity/land/tileset_image.png"
-dest_files=["res://.godot/imported/tileset_image.png-bc2248d47eda1485e8fb182d2ffd69f2.ctex"]
-
-[params]
-
-compress/mode=0
-compress/lossy_quality=0.7
-compress/hdr_compression=1
-compress/bptc_ldr=0
-compress/normal_map=0
-compress/channel_pack=0
-mipmaps/generate=false
-mipmaps/limit=-1
-roughness/mode=0
-roughness/src_normal=""
-process/fix_alpha_border=true
-process/premult_alpha=false
-process/normal_map_invert_y=false
-process/hdr_as_srgb=false
-process/hdr_clamp_exposure=false
-process/size_limit=0
-detect_3d/compress_to=1

+ 0 - 45
godot/component/entity/player/Player.gd

@@ -1,45 +0,0 @@
-extends CharacterBody2D
-
-
-const SPEED = 300.0
-const SLIDE = 50.0
-const FORCE = 800.0
-
-
-
-func _physics_process(delta):
-	prepare_to_move()
-
-	var collided = move_and_slide()
-
-	if collided:
-		try_to_shoot()
-
-
-func prepare_to_move():
-	if Input.is_action_pressed("ui_right"):
-		velocity.x = SPEED
-	elif Input.is_action_pressed("ui_left"):
-		velocity.x = -SPEED
-	else:
-		velocity.x = move_toward(velocity.x, 0, SLIDE)
-
-	if Input.is_action_pressed("ui_down"):
-		velocity.y = SPEED
-	elif Input.is_action_pressed("ui_up"):
-		velocity.y = -SPEED
-	else:
-		velocity.y = move_toward(velocity.y, 0, SLIDE)
-
-
-func try_to_shoot():
-	var collision = get_last_slide_collision()
-	var target = collision.get_collider()
-	var normal = collision.get_normal()
-
-	if target is PhysicsBody2D:
-		shoot(target, -normal)
-
-
-func shoot(target: PhysicsBody2D, dir: Vector2) -> void:
-	target.apply_force(dir * FORCE)

+ 0 - 21
godot/component/entity/player/Player.tscn

@@ -1,21 +0,0 @@
-[gd_scene load_steps=4 format=3 uid="uid://b8og3wlgvihed"]
-
-[ext_resource type="Script" path="res://component/entity/player/Player.gd" id="1_364t3"]
-[ext_resource type="Texture2D" uid="uid://cwhw2rx7twu2e" path="res://component/entity/player/smiley_character.png" id="2_y6vu3"]
-
-[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_qfhl8"]
-radius = 18.0
-height = 52.0
-
-[node name="Player" type="CharacterBody2D"]
-slide_on_ceiling = false
-floor_stop_on_slope = false
-floor_block_on_wall = false
-script = ExtResource("1_364t3")
-
-[node name="Body" type="CollisionShape2D" parent="."]
-position = Vector2(0, -1)
-shape = SubResource("CapsuleShape2D_qfhl8")
-
-[node name="Skin" type="Sprite2D" parent="."]
-texture = ExtResource("2_y6vu3")

BIN
godot/component/entity/player/smiley_character.png


+ 0 - 34
godot/component/entity/player/smiley_character.png.import

@@ -1,34 +0,0 @@
-[remap]
-
-importer="texture"
-type="CompressedTexture2D"
-uid="uid://cwhw2rx7twu2e"
-path="res://.godot/imported/smiley_character.png-3e2048d5f97031b36131d4607f26b250.ctex"
-metadata={
-"vram_texture": false
-}
-
-[deps]
-
-source_file="res://component/entity/player/smiley_character.png"
-dest_files=["res://.godot/imported/smiley_character.png-3e2048d5f97031b36131d4607f26b250.ctex"]
-
-[params]
-
-compress/mode=0
-compress/lossy_quality=0.7
-compress/hdr_compression=1
-compress/bptc_ldr=0
-compress/normal_map=0
-compress/channel_pack=0
-mipmaps/generate=false
-mipmaps/limit=-1
-roughness/mode=0
-roughness/src_normal=""
-process/fix_alpha_border=true
-process/premult_alpha=false
-process/normal_map_invert_y=false
-process/hdr_as_srgb=false
-process/hdr_clamp_exposure=false
-process/size_limit=0
-detect_3d/compress_to=1

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 1
godot/icon.svg


+ 0 - 37
godot/icon.svg.import

@@ -1,37 +0,0 @@
-[remap]
-
-importer="texture"
-type="CompressedTexture2D"
-uid="uid://dy5g3iswdrc1t"
-path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
-metadata={
-"vram_texture": false
-}
-
-[deps]
-
-source_file="res://icon.svg"
-dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
-
-[params]
-
-compress/mode=0
-compress/lossy_quality=0.7
-compress/hdr_compression=1
-compress/bptc_ldr=0
-compress/normal_map=0
-compress/channel_pack=0
-mipmaps/generate=false
-mipmaps/limit=-1
-roughness/mode=0
-roughness/src_normal=""
-process/fix_alpha_border=true
-process/premult_alpha=false
-process/normal_map_invert_y=false
-process/hdr_as_srgb=false
-process/hdr_clamp_exposure=false
-process/size_limit=0
-detect_3d/compress_to=1
-svg/scale=1.0
-editor/scale_with_editor_scale=false
-editor/convert_colors_with_editor_theme=false

+ 0 - 16
godot/project.godot

@@ -1,16 +0,0 @@
-; Engine configuration file.
-; It's best edited using the editor UI and not directly,
-; since the parameters that go here are not all obvious.
-;
-; Format:
-;   [section] ; section goes between []
-;   param=value ; assign values to parameters
-
-config_version=5
-
-[application]
-
-config/name="Dricom Dragon"
-run/main_scene="res://world.tscn"
-config/features=PackedStringArray("4.0", "Forward Plus")
-config/icon="res://icon.svg"

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 31
godot/world.tscn


BIN
netnet/component/entity/jumper/blue_astronaut.png


+ 0 - 34
netnet/component/entity/jumper/blue_astronaut.png.import

@@ -1,34 +0,0 @@
-[remap]
-
-importer="texture"
-type="CompressedTexture2D"
-uid="uid://mk8mv84rjsu"
-path="res://.godot/imported/blue_astronaut.png-31bed93e30930e569a39acd39aff3cd3.ctex"
-metadata={
-"vram_texture": false
-}
-
-[deps]
-
-source_file="res://component/entity/jumper/blue_astronaut.png"
-dest_files=["res://.godot/imported/blue_astronaut.png-31bed93e30930e569a39acd39aff3cd3.ctex"]
-
-[params]
-
-compress/mode=0
-compress/high_quality=false
-compress/lossy_quality=0.7
-compress/hdr_compression=1
-compress/normal_map=0
-compress/channel_pack=0
-mipmaps/generate=false
-mipmaps/limit=-1
-roughness/mode=0
-roughness/src_normal=""
-process/fix_alpha_border=true
-process/premult_alpha=false
-process/normal_map_invert_y=false
-process/hdr_as_srgb=false
-process/hdr_clamp_exposure=false
-process/size_limit=0
-detect_3d/compress_to=1

BIN
netnet/component/entity/jumper/green_astronaut.png


+ 0 - 34
netnet/component/entity/jumper/green_astronaut.png.import

@@ -1,34 +0,0 @@
-[remap]
-
-importer="texture"
-type="CompressedTexture2D"
-uid="uid://cojbjngjjhoe0"
-path="res://.godot/imported/green_astronaut.png-ff14009a8ac3a35c99c20c60a9705796.ctex"
-metadata={
-"vram_texture": false
-}
-
-[deps]
-
-source_file="res://component/entity/jumper/green_astronaut.png"
-dest_files=["res://.godot/imported/green_astronaut.png-ff14009a8ac3a35c99c20c60a9705796.ctex"]
-
-[params]
-
-compress/mode=0
-compress/high_quality=false
-compress/lossy_quality=0.7
-compress/hdr_compression=1
-compress/normal_map=0
-compress/channel_pack=0
-mipmaps/generate=false
-mipmaps/limit=-1
-roughness/mode=0
-roughness/src_normal=""
-process/fix_alpha_border=true
-process/premult_alpha=false
-process/normal_map_invert_y=false
-process/hdr_as_srgb=false
-process/hdr_clamp_exposure=false
-process/size_limit=0
-detect_3d/compress_to=1

+ 0 - 38
netnet/component/entity/jumper/jumper.gd

@@ -1,38 +0,0 @@
-class_name Jumper
-extends RigidBody2D
-
-const SPEED = 5.0
-const JUMP_IMPULSE = 942.5
-const MOVE_FORCE = 1142
-
-@export var skins: Array[Texture2D]
-
-# Set by the authority, synchronized on spawn.
-@export var player := 1 :
-	set(id):
-		player = id
-		# Give authority over the player input to the appropriate peer.
-		$JumperInput.set_multiplayer_authority(id)
-		$Sprite2D.set_texture(skins[2])
-
-# Player synchronized input
-@onready var input: JumperInput = $JumperInput
-
-
-func _ready():
-	pass
-
-
-func _physics_process(delta):
-
-	# Handle Jump.
-	if input.jumping:
-		apply_impulse(Vector2.UP * JUMP_IMPULSE)
-
-	# Reset jump state.
-	input.jumping = false
-
-	# Handle movement.
-	var direction = input.direction
-	if direction:
-		apply_force(direction * MOVE_FORCE)

+ 0 - 52
netnet/component/entity/jumper/jumper.tscn

@@ -1,52 +0,0 @@
-[gd_scene load_steps=11 format=3 uid="uid://ckph60svia3xr"]
-
-[ext_resource type="Script" path="res://component/entity/jumper/jumper.gd" id="1_smoki"]
-[ext_resource type="Texture2D" uid="uid://cojbjngjjhoe0" path="res://component/entity/jumper/green_astronaut.png" id="2_xm8at"]
-[ext_resource type="Script" path="res://component/entity/jumper/jumper_input.gd" id="3_trrhr"]
-[ext_resource type="Texture2D" uid="uid://mk8mv84rjsu" path="res://component/entity/jumper/blue_astronaut.png" id="3_wegaa"]
-[ext_resource type="Texture2D" uid="uid://c07f5mop1rm1m" path="res://component/entity/jumper/pink_astronaut.png" id="4_v2rk1"]
-[ext_resource type="Texture2D" uid="uid://b0fdcrrluprxp" path="res://component/entity/jumper/yellow_astronaut.png" id="5_04xut"]
-
-[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_vgl4i"]
-friction = 0.5
-
-[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_raoy1"]
-radius = 18.0
-height = 50.0
-
-[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_wnop5"]
-properties/0/path = NodePath(".:position")
-properties/0/spawn = true
-properties/0/sync = true
-properties/0/watch = false
-properties/1/path = NodePath(".:player")
-properties/1/spawn = true
-properties/1/sync = false
-properties/1/watch = false
-
-[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_74ldf"]
-properties/0/path = NodePath("JumperInput:direction")
-properties/0/spawn = false
-properties/0/sync = true
-properties/0/watch = false
-
-[node name="Jumper" type="RigidBody2D"]
-physics_material_override = SubResource("PhysicsMaterial_vgl4i")
-lock_rotation = true
-linear_damp = 1.0
-script = ExtResource("1_smoki")
-skins = Array[Texture2D]([ExtResource("2_xm8at"), ExtResource("3_wegaa"), ExtResource("4_v2rk1"), ExtResource("5_04xut")])
-
-[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
-position = Vector2(0, -2)
-shape = SubResource("CapsuleShape2D_raoy1")
-
-[node name="Sprite2D" type="Sprite2D" parent="."]
-texture = ExtResource("2_xm8at")
-
-[node name="ServerSynchronizer" type="MultiplayerSynchronizer" parent="."]
-replication_config = SubResource("SceneReplicationConfig_wnop5")
-
-[node name="JumperInput" type="MultiplayerSynchronizer" parent="."]
-replication_config = SubResource("SceneReplicationConfig_74ldf")
-script = ExtResource("3_trrhr")

+ 0 - 50
netnet/component/entity/jumper/jumper_input.gd

@@ -1,50 +0,0 @@
-class_name JumperInput
-extends MultiplayerSynchronizer
-
-
-const STICK_DEADZONE: float = 0.5
-
-# Set via RPC to simulate is_action_just_pressed.
-@export var jumping: bool = false
-
-# Synchronized property.
-@export var direction := Vector2()
-
-
-func _ready():
-	# Only process for the local player
-	set_process(get_multiplayer_authority() == multiplayer.get_unique_id())
-
-
-@rpc("call_local")
-func jump() -> void:
-	jumping = true
-
-
-func _process(delta: float) -> void:
-	# Get the input direction and handle the movement/deceleration.
-
-	direction = _new_direction()
-	if Input.is_action_just_pressed("jump"):
-		jump.rpc()
-
-
-func _new_direction() -> Vector2:
-	var new_dir := Vector2.ZERO
-	#new_dir += _direction_from_axis()
-	new_dir += _direction_from_keys()
-
-	if new_dir == Vector2.ZERO:
-		return Vector2.ZERO
-
-	return new_dir.normalized()
-
-
-func _direction_from_axis() -> Vector2:
-	var axis_dir := Vector2(Input.get_joy_axis(0, JOY_AXIS_LEFT_X), 0.0)
-	if absf(axis_dir.x) < STICK_DEADZONE:
-		axis_dir.x = 0.0
-	return axis_dir
-
-func _direction_from_keys() -> Vector2:
-	return Vector2(Input.get_axis("move_left", "move_right"), 0)

BIN
netnet/component/entity/jumper/pink_astronaut.png


+ 0 - 34
netnet/component/entity/jumper/pink_astronaut.png.import

@@ -1,34 +0,0 @@
-[remap]
-
-importer="texture"
-type="CompressedTexture2D"
-uid="uid://c07f5mop1rm1m"
-path="res://.godot/imported/pink_astronaut.png-f5f91fd9ce5b19897c10f00d38153ee0.ctex"
-metadata={
-"vram_texture": false
-}
-
-[deps]
-
-source_file="res://component/entity/jumper/pink_astronaut.png"
-dest_files=["res://.godot/imported/pink_astronaut.png-f5f91fd9ce5b19897c10f00d38153ee0.ctex"]
-
-[params]
-
-compress/mode=0
-compress/high_quality=false
-compress/lossy_quality=0.7
-compress/hdr_compression=1
-compress/normal_map=0
-compress/channel_pack=0
-mipmaps/generate=false
-mipmaps/limit=-1
-roughness/mode=0
-roughness/src_normal=""
-process/fix_alpha_border=true
-process/premult_alpha=false
-process/normal_map_invert_y=false
-process/hdr_as_srgb=false
-process/hdr_clamp_exposure=false
-process/size_limit=0
-detect_3d/compress_to=1

BIN
netnet/component/entity/jumper/yellow_astronaut.png


+ 0 - 34
netnet/component/entity/jumper/yellow_astronaut.png.import

@@ -1,34 +0,0 @@
-[remap]
-
-importer="texture"
-type="CompressedTexture2D"
-uid="uid://b0fdcrrluprxp"
-path="res://.godot/imported/yellow_astronaut.png-862c8dce9e972ec0aea70f79899bd7db.ctex"
-metadata={
-"vram_texture": false
-}
-
-[deps]
-
-source_file="res://component/entity/jumper/yellow_astronaut.png"
-dest_files=["res://.godot/imported/yellow_astronaut.png-862c8dce9e972ec0aea70f79899bd7db.ctex"]
-
-[params]
-
-compress/mode=0
-compress/high_quality=false
-compress/lossy_quality=0.7
-compress/hdr_compression=1
-compress/normal_map=0
-compress/channel_pack=0
-mipmaps/generate=false
-mipmaps/limit=-1
-roughness/mode=0
-roughness/src_normal=""
-process/fix_alpha_border=true
-process/premult_alpha=false
-process/normal_map_invert_y=false
-process/hdr_as_srgb=false
-process/hdr_clamp_exposure=false
-process/size_limit=0
-detect_3d/compress_to=1

+ 0 - 49
netnet/component/entity/player/player.gd

@@ -1,49 +0,0 @@
-extends CharacterBody3D
-
-const SPEED = 5.0
-const JUMP_VELOCITY = 4.5
-
-# Get the gravity from the project settings to be synced with RigidBody nodes.
-var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
-
-# Set by the authority, synchronized on spawn.
-@export var player := 1 :
-	set(id):
-		player = id
-		# Give authority over the player input to the appropriate peer.
-		$PlayerInput.set_multiplayer_authority(id)
-
-# Player synchronized input.
-@onready var input = $PlayerInput
-
-func _ready():
-	# Set the camera as current if we are this player.
-	if player == multiplayer.get_unique_id():
-		$Camera3D.current = true
-	# Only process on server.
-	# EDIT: Left the client simulate player movement too to compesate network latency.
-	# set_physics_process(multiplayer.is_server())
-
-
-func _physics_process(delta):
-	# Add the gravity.
-	if not is_on_floor():
-		velocity.y -= gravity * delta
-
-	# Handle Jump.
-	if input.jumping and is_on_floor():
-		velocity.y = JUMP_VELOCITY
-
-	# Reset jump state.
-	input.jumping = false
-
-	# Handle movement.
-	var direction = (transform.basis * Vector3(input.direction.x, 0, input.direction.y)).normalized()
-	if direction:
-		velocity.x = direction.x * SPEED
-		velocity.z = direction.z * SPEED
-	else:
-		velocity.x = move_toward(velocity.x, 0, SPEED)
-		velocity.z = move_toward(velocity.z, 0, SPEED)
-
-	move_and_slide()

+ 0 - 48
netnet/component/entity/player/player.tscn

@@ -1,48 +0,0 @@
-[gd_scene load_steps=7 format=3 uid="uid://dir0a2wjc5s7w"]
-
-[ext_resource type="Script" path="res://component/entity/player/player.gd" id="1_hwwnj"]
-[ext_resource type="Script" path="res://component/entity/player/player_input.gd" id="2_ju3m6"]
-
-[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_fb1vy"]
-properties/0/path = NodePath(".:player")
-properties/0/spawn = true
-properties/0/sync = false
-properties/1/path = NodePath(".:position")
-properties/1/spawn = true
-properties/1/sync = true
-properties/2/path = NodePath(".:velocity")
-properties/2/spawn = true
-properties/2/sync = true
-
-[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_hoavk"]
-properties/0/path = NodePath(".:direction")
-properties/0/spawn = false
-properties/0/sync = true
-
-[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_37qaq"]
-
-[sub_resource type="CapsuleMesh" id="CapsuleMesh_jab13"]
-radial_segments = 8
-rings = 4
-
-[node name="Player" type="CharacterBody3D"]
-script = ExtResource("1_hwwnj")
-
-[node name="ServerSynchronizer" type="MultiplayerSynchronizer" parent="."]
-replication_config = SubResource("SceneReplicationConfig_fb1vy")
-
-[node name="PlayerInput" type="MultiplayerSynchronizer" parent="."]
-root_path = NodePath(".")
-replication_config = SubResource("SceneReplicationConfig_hoavk")
-script = ExtResource("2_ju3m6")
-jumping = null
-direction = null
-
-[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
-shape = SubResource("CapsuleShape3D_37qaq")
-
-[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
-mesh = SubResource("CapsuleMesh_jab13")
-
-[node name="Camera3D" type="Camera3D" parent="."]
-transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.40432, 2.04444)

+ 0 - 25
netnet/component/entity/player/player_input.gd

@@ -1,25 +0,0 @@
-extends MultiplayerSynchronizer
-
-# Set via RPC to simulate is_action_just_pressed.
-@export var jumping := false
-
-# Synchronized property.
-@export var direction := Vector2()
-
-
-func _ready():
-	# Only process for the local player
-	set_process(get_multiplayer_authority() == multiplayer.get_unique_id())
-
-
-@rpc("call_local")
-func jump():
-	jumping = true
-
-
-func _process(delta):
-	# Get the input direction and handle the movement/deceleration.
-	# As good practice, you should replace UI actions with custom gameplay actions.
-	direction = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
-	if Input.is_action_just_pressed("ui_accept"):
-		jump.rpc()

+ 0 - 42
netnet/component/entity/sphere/sphere.tscn

@@ -1,42 +0,0 @@
-[gd_scene load_steps=5 format=3 uid="uid://c6br8h3si2ypg"]
-
-[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_mp5c4"]
-friction = 0.0
-bounce = 1.0
-
-[sub_resource type="SphereMesh" id="SphereMesh_deuj3"]
-radius = 1.0
-height = 2.0
-radial_segments = 8
-rings = 4
-
-[sub_resource type="SphereShape3D" id="SphereShape3D_h6jr2"]
-radius = 1.0
-
-[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_q1o6k"]
-properties/0/path = NodePath(".:linear_velocity")
-properties/0/spawn = true
-properties/0/sync = true
-properties/1/path = NodePath(".:angular_velocity")
-properties/1/spawn = true
-properties/1/sync = true
-properties/2/path = NodePath(".:position")
-properties/2/spawn = true
-properties/2/sync = true
-properties/3/path = NodePath(".:rotation")
-properties/3/spawn = true
-properties/3/sync = true
-
-[node name="Sphere" type="RigidBody3D"]
-transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.42886, 0)
-physics_material_override = SubResource("PhysicsMaterial_mp5c4")
-
-[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
-mesh = SubResource("SphereMesh_deuj3")
-skeleton = NodePath("../CollisionShape3D")
-
-[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
-shape = SubResource("SphereShape3D_h6jr2")
-
-[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
-replication_config = SubResource("SceneReplicationConfig_q1o6k")

+ 0 - 36
netnet/project.godot

@@ -1,36 +0,0 @@
-; Engine configuration file.
-; It's best edited using the editor UI and not directly,
-; since the parameters that go here are not all obvious.
-;
-; Format:
-;   [section] ; section goes between []
-;   param=value ; assign values to parameters
-
-config_version=5
-
-[application]
-
-config/name="Network Example Gd4"
-config/description="Scene replication example in 2D with Godot 4"
-config/tags=PackedStringArray("dricom")
-run/main_scene="res://run/multiplayer.tscn"
-config/features=PackedStringArray("4.1")
-
-[input]
-
-move_right={
-"deadzone": 0.5,
-"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null)
-]
-}
-move_left={
-"deadzone": 0.5,
-"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"echo":false,"script":null)
-]
-}
-jump={
-"deadzone": 0.5,
-"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"echo":false,"script":null)
-, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
-]
-}

+ 0 - 29
netnet/run/levels/destination/final.tscn

@@ -1,29 +0,0 @@
-[gd_scene load_steps=4 format=3 uid="uid://cf2fnyf7gud6c"]
-
-[ext_resource type="Script" path="res://run/levels/player_manager.gd" id="1_hhmm0"]
-
-[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_kb8qo"]
-
-[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_kbpyq"]
-
-[node name="Final" type="Node2D"]
-script = ExtResource("1_hhmm0")
-
-[node name="Floor" type="StaticBody2D" parent="."]
-position = Vector2(2, 653)
-physics_material_override = SubResource("PhysicsMaterial_kb8qo")
-
-[node name="Limit" type="CollisionShape2D" parent="Floor"]
-shape = SubResource("WorldBoundaryShape2D_kbpyq")
-
-[node name="PlayerPool" type="Node2D" parent="."]
-
-[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="."]
-_spawnable_scenes = PackedStringArray("res://component/entity/jumper/jumper.tscn")
-spawn_path = NodePath("../PlayerPool")
-spawn_limit = 4
-
-[node name="Line2D" type="Line2D" parent="."]
-position = Vector2(4, 653)
-points = PackedVector2Array(700, 0, 0, 0)
-default_color = Color(0, 1, 1, 1)

+ 0 - 43
netnet/run/levels/flatland/level.gd

@@ -1,43 +0,0 @@
-extends Node3D
-
-const SPAWN_RANDOM := 5.0
-
-func _ready():
-	# We only need to spawn players on the server.
-	if not multiplayer.is_server():
-		return
-
-	multiplayer.peer_connected.connect(add_player)
-	multiplayer.peer_disconnected.connect(del_player)
-
-	# Spawn already connected players
-	for id in multiplayer.get_peers():
-		add_player(id)
-
-	# Spawn the local player unless this is a dedicated server export.
-	if not OS.has_feature("dedicated_server"):
-		add_player(1)
-
-
-func _exit_tree():
-	if not multiplayer.is_server():
-		return
-	multiplayer.peer_connected.disconnect(add_player)
-	multiplayer.peer_disconnected.disconnect(del_player)
-
-
-func add_player(id: int):
-	var character = preload("res://component/entity/player/player.tscn").instantiate()
-	# Set player id.
-	character.player = id
-	# Randomize character position.
-	var pos := Vector2.from_angle(randf() * 2 * PI)
-	character.position = Vector3(pos.x * SPAWN_RANDOM * randf(), 0, pos.y * SPAWN_RANDOM * randf())
-	character.name = str(id)
-	$Players.add_child(character, true)
-
-
-func del_player(id: int):
-	if not $Players.has_node(str(id)):
-		return
-	$Players.get_node(str(id)).queue_free()

+ 0 - 46
netnet/run/levels/flatland/level.tscn

@@ -1,46 +0,0 @@
-[gd_scene load_steps=6 format=3 uid="uid://vtnh2i0i52vo"]
-
-[ext_resource type="PackedScene" uid="uid://c6br8h3si2ypg" path="res://component/entity/sphere/sphere.tscn" id="1_8awbr"]
-[ext_resource type="Script" path="res://run/levels/flatland/level.gd" id="1_p4gvl"]
-
-[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_s66iy"]
-
-[sub_resource type="PlaneMesh" id="PlaneMesh_7cbpt"]
-size = Vector2(20, 20)
-
-[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_kgp6f"]
-albedo_color = Color(0.164706, 0.478431, 1, 1)
-
-[node name="World" type="Node3D"]
-script = ExtResource("1_p4gvl")
-
-[node name="Camera3D" type="Camera3D" parent="."]
-transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.35697, 3.4425)
-
-[node name="Floor" type="StaticBody3D" parent="."]
-
-[node name="CollisionShape3D" type="CollisionShape3D" parent="Floor"]
-shape = SubResource("WorldBoundaryShape3D_s66iy")
-
-[node name="MeshInstance3D" type="MeshInstance3D" parent="Floor"]
-mesh = SubResource("PlaneMesh_7cbpt")
-surface_material_override/0 = SubResource("StandardMaterial3D_kgp6f")
-
-[node name="OmniLight3D" type="OmniLight3D" parent="."]
-transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 10.4214, 0)
-light_energy = 10.0
-omni_range = 20.2379
-
-[node name="Objects" type="Node3D" parent="."]
-
-[node name="Sphere" parent="Objects" instance=ExtResource("1_8awbr")]
-
-[node name="Sphere2" parent="Objects" instance=ExtResource("1_8awbr")]
-transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.09399, 4.03106, 0)
-
-[node name="Players" type="Node3D" parent="."]
-
-[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="."]
-_spawnable_scenes = PackedStringArray("res://component/entity/player/player.tscn")
-spawn_path = NodePath("../Players")
-spawn_limit = 4

+ 0 - 46
netnet/run/levels/player_manager.gd

@@ -1,46 +0,0 @@
-class_name PlayerManager
-extends Node2D
-
-const SPAWN_RANDOM := 100.0
-const SPAWN_HEIGHT := 200.0
-
-@onready var player_pool: Node2D = $PlayerPool
-
-func _ready():
-	# We only need to spawn players on the server.
-	if not multiplayer.is_server():
-		return
-
-	multiplayer.peer_connected.connect(add_player)
-	multiplayer.peer_disconnected.connect(del_player)
-
-	# Spawn already connected players
-	for id in multiplayer.get_peers():
-		add_player(id)
-
-	# Spawn the local player unless this is a dedicated server export.
-	if not OS.has_feature("dedicated_server"):
-		add_player(1)
-
-
-func _exit_tree():
-	if not multiplayer.is_server():
-		return
-	multiplayer.peer_connected.disconnect(add_player)
-	multiplayer.peer_disconnected.disconnect(del_player)
-
-
-func add_player(id: int):
-	var character = preload("res://component/entity/jumper/jumper.tscn").instantiate()
-	# Set player id.
-	character.player = id
-	# Randomize character position.
-	character.position = Vector2(randf() * SPAWN_RANDOM, SPAWN_HEIGHT)
-	character.name = str(id)
-	player_pool.add_child(character, true)
-
-
-func del_player(id: int):
-	if not player_pool.has_node(str(id)):
-		return
-	player_pool.get_node(str(id)).queue_free()

+ 0 - 69
netnet/run/multiplayer.gd

@@ -1,69 +0,0 @@
-extends Node
-
-const PORT = 4433
-
-func _ready() -> void:
-	# Start paused
-	get_tree().paused = true
-	# You can save bandwith by disabling server relay and peer notifications.
-	multiplayer.server_relay = false
-
-	# Automatically start the server in headless mode.
-	if DisplayServer.get_name() == "headless":
-		print("Automatically starting dedicated server")
-		_on_host_pressed.call_deferred()
-
-
-func _on_host_pressed() -> void:
-	# Start as server
-	var peer = ENetMultiplayerPeer.new()
-	peer.create_server(PORT)
-	if peer.get_connection_status() == MultiplayerPeer.CONNECTION_DISCONNECTED:
-		OS.alert("Failed to start multiplayer server")
-		return
-	multiplayer.multiplayer_peer = peer
-	start_game()
-
-
-func _on_connect_pressed() -> void:
-	# Start as client
-	var txt : String = $UI/Net/Options/Remote.text
-	if txt == "":
-		OS.alert("Need a remote to connect to.")
-		return
-	var peer = ENetMultiplayerPeer.new()
-	peer.create_client(txt, PORT)
-	if peer.get_connection_status() == MultiplayerPeer.CONNECTION_DISCONNECTED:
-		OS.alert("Failed to start multiplayer client")
-		return
-	multiplayer.multiplayer_peer = peer
-	start_game()
-
-
-func start_game() -> void:
-	# Hide the UI and unpause to start the game.
-	$UI.hide()
-	get_tree().paused = false
-	# Only change level on the server.
-	# Clients will instantiate the level via the spawner.
-	if multiplayer.is_server():
-		change_level.call_deferred(load("res://run/levels/destination/final.tscn"))
-
-
-# Call this function deferred and only on the main authority (server).
-func change_level(scene: PackedScene) -> void:
-	# Remove old level if any.
-	var level = $Level
-	for c in level.get_children():
-		level.remove_child(c)
-		c.queue_free()
-	# Add new level.
-	level.add_child(scene.instantiate())
-
-
-# The server can restart the level by pressing HOME.
-func _input(event: InputEvent) -> void:
-	if not multiplayer.is_server():
-		return
-	if event.is_action("ui_home") and Input.is_action_just_pressed("ui_home"):
-		change_level.call_deferred(load("res://run/levels/destination/final.tscn"))

+ 0 - 56
netnet/run/multiplayer.tscn

@@ -1,56 +0,0 @@
-[gd_scene load_steps=2 format=3 uid="uid://bvnwjpd0f3oa0"]
-
-[ext_resource type="Script" path="res://run/multiplayer.gd" id="1_t2go4"]
-
-[node name="Multiplayer" type="Node"]
-script = ExtResource("1_t2go4")
-
-[node name="Level" type="Node" parent="."]
-
-[node name="LevelSpawner" type="MultiplayerSpawner" parent="."]
-_spawnable_scenes = PackedStringArray("res://run/levels/destination/final.tscn")
-spawn_path = NodePath("../Level")
-spawn_limit = 1
-
-[node name="UI" type="Control" parent="."]
-process_mode = 3
-layout_mode = 3
-anchors_preset = 15
-anchor_right = 1.0
-anchor_bottom = 1.0
-grow_horizontal = 2
-grow_vertical = 2
-
-[node name="Net" type="VBoxContainer" parent="UI"]
-layout_mode = 1
-anchors_preset = 15
-anchor_right = 1.0
-anchor_bottom = 1.0
-grow_horizontal = 2
-grow_vertical = 2
-
-[node name="Options" type="HBoxContainer" parent="UI/Net"]
-layout_mode = 2
-
-[node name="Label" type="Label" parent="UI/Net/Options"]
-layout_mode = 2
-text = "Direct:"
-
-[node name="Host" type="Button" parent="UI/Net/Options"]
-layout_mode = 2
-text = "Host"
-
-[node name="Connect" type="Button" parent="UI/Net/Options"]
-layout_mode = 2
-text = "Connect"
-
-[node name="Remote" type="LineEdit" parent="UI/Net/Options"]
-layout_mode = 2
-size_flags_horizontal = 3
-text = "127.0.0.1"
-placeholder_text = "Remote Host"
-caret_blink = true
-caret_blink_interval = 0.5
-
-[connection signal="pressed" from="UI/Net/Options/Host" to="." method="_on_host_pressed"]
-[connection signal="pressed" from="UI/Net/Options/Connect" to="." method="_on_connect_pressed"]