Skip to content

Commit fe521ea

Browse files
committed
Add multiplayer-bomber example.
1 parent 8a62088 commit fe521ea

30 files changed

+2213
-0
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ members = [
1414
"itest/repo-tweak",
1515
"examples/dodge-the-creeps/rust",
1616
"examples/hot-reload/rust",
17+
"examples/multiplayer-bomber/rust",
1718
]
1819

1920
# Note about Jetbrains IDEs: "IDE Sync" (Refresh Cargo projects) may cause static analysis errors such as
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
res://rust.gdextension
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Multiplayer Bomber Example
2+
3+
A multiplayer implementation of the classic bomberman game.
4+
One of the players should press **Host**, while other player(s)
5+
should type in the host's IP address and press **Join**.
6+
7+
Based on: https://github.com/godotengine/godot-demo-projects/tree/master/networking/multiplayer_bomber
8+
9+
Language: Rust
10+
11+
Renderer: Compatibility
12+
13+
## Controls
14+
15+
WSAD to move
16+
CTRL to plant bomb
17+
18+
19+
## Copying
20+
21+
George (`assets/chatwalk`) is an alternate LCP character by [sheep](https://opengameart.org/users/sheep), from [OpenGameArt.org](https://opengameart.org/content/alternate-lpc-character-sprites-george). CC-BY 3.0, CC-BY-SA 3.0, GPL 3.0
22+
23+
Bomb - Matt Hackett of Lost Decade Games, expanded by Cem Kalyoncu; CC-BY 3.0
24+
25+
"[LPC] Rocks" by bluecarrot16, Johann Charlot, Yar, Hyptosis, Evert, Lanea Zimmerman (Sharm), Guillaume Lecollinet, Richard Kettering (Jetrel), Zachariah Husiar (Zabin), Jetrel, Hyptosis, Redshrike, Rayane Félix (RayaneFLX), Michele Bucelli (Buch) <https://opengameart.org/users/buch>
26+
"[LPC] Walls" by bluecarrot16, Lanea Zimmerman (Sharm), Daniel Armstrong (HughSpectrum), William Thompson (William.Thompsonj), Hyptosis, Zabin, Daniel Cook, Guido Bos, SpiderDave, Cougarmint, Stephen Challener (Redshrike), Matthew Nash, Wolthera van Hövell tot Westerflier (TheraHedwig), Reemax, bleutailfly, NaRNeRZz, Sir Spummington, Casper Nilsson, KnoblePersona. CC-BY-SA 3.0.
27+
"[LPC] Floors" by bluecarrot16, Lanea Zimmerman (Sharm), William Thompson (William.Thompsonj), Hyptosis, SpiderDave, Cougarmint, Stephen Challener (Redshrike), Bonsaiheldin, Tyler Olsen (Roots), Jetrel, jestan, The Open Surge team (http://opensnc.sourceforge.net), Gaurav Munjal, Reemax, Silveira Neto, bleutailfly, Casper Nilsson, NaRNeRZz, Buch, keith karnage, Arthur Carvalho, Guilherme Vieira (n2liquid), Chris Hamons (maintainer). CC-BY-SA 4.0
28+
Loading
Loading
Loading
Loading
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
; Engine configuration file.
2+
; It's best edited using the editor UI and not directly,
3+
; since the parameters that go here are not all obvious.
4+
;
5+
; Format:
6+
; [section] ; section goes between []
7+
; param=value ; assign values to parameters
8+
9+
config_version=5
10+
11+
[application]
12+
13+
config/name="GodotRustMultiplayerExample"
14+
run/main_scene="res://src/game/lobby.tscn"
15+
config/features=PackedStringArray("4.3", "GL Compatibility")
16+
config/icon="res://icon.svg"
17+
18+
[autoload]
19+
20+
gamestate="*res://src/game/gamestate.tscn"
21+
22+
[input]
23+
24+
Fire={
25+
"deadzone": 0.5,
26+
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
27+
]
28+
}
29+
move_left={
30+
"deadzone": 0.5,
31+
"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":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
32+
]
33+
}
34+
move_right={
35+
"deadzone": 0.5,
36+
"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":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
37+
]
38+
}
39+
jump={
40+
"deadzone": 0.5,
41+
"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,"location":0,"echo":false,"script":null)
42+
]
43+
}
44+
move_up={
45+
"deadzone": 0.5,
46+
"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":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
47+
]
48+
}
49+
move_down={
50+
"deadzone": 0.5,
51+
"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":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
52+
]
53+
}
54+
set_bomb={
55+
"deadzone": 0.5,
56+
"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":4194326,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
57+
]
58+
}
59+
60+
[layer_names]
61+
62+
2d_physics/layer_1="collisions"
63+
2d_physics/layer_2="explodable"
64+
65+
[rendering]
66+
67+
renderer/rendering_method="gl_compatibility"
68+
renderer/rendering_method.mobile="gl_compatibility"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[configuration]
2+
entry_symbol = "gdext_rust_init"
3+
compatibility_minimum = 4.1
4+
5+
[libraries]
6+
linux.debug.x86_64 = "res://../../../target/debug/libmultiplayer_bomber.so"
7+
linux.release.x86_64 = "res://../../../target/release/libmultiplayer_bomber.so"
8+
windows.debug.x86_64 = "res://../../../target/debug/multiplayer_bomber.dll"
9+
windows.release.x86_64 = "res://../../../target/release/multiplayer_bomber.dll"
10+
macos.debug = "res://../../../target/debug/libmultiplayer_bomber.dylib"
11+
macos.release = "res://../../../target/release/libmultiplayer_bomber.dylib"
12+
macos.debug.arm64 = "res://../../../target/debug/libmultiplayer_bomber.dylib"
13+
macos.release.arm64 = "res://../../../target/release/libmultiplayer_bomber.dylib"
14+
web.debug.wasm32 = "res://../../../target/wasm32-unknown-emscripten/debug/multiplayer_bomber.wasm"
15+
web.release.wasm32 = "res://../../../target/wasm32-unknown-emscripten/release/multiplayer_bomber.wasm"
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
[gd_scene load_steps=8 format=3 uid="uid://enwoaqi0rnei"]
2+
3+
[ext_resource type="Texture2D" uid="uid://cb1y8d1bbygtk" path="res://assets/brickfloor.png" id="2"]
4+
[ext_resource type="Texture2D" uid="uid://dkhnmbca25hmy" path="res://assets/explosion.png" id="3"]
5+
6+
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1ih13"]
7+
size = Vector2(16, 192)
8+
9+
[sub_resource type="RectangleShape2D" id="RectangleShape2D_whso6"]
10+
size = Vector2(192, 16)
11+
12+
[sub_resource type="Curve" id="Curve_4yges"]
13+
max_value = 2.0
14+
_data = [Vector2(0.00150494, 0.398437), 0.0, 0.0, 0, 0, Vector2(0.0152287, 1.42969), 0.0, 0.0, 0, 0, Vector2(0.478607, 1.30078), 0.0, 0.0, 0, 0, Vector2(1, 0.291016), 0.0, 0.0, 0, 0]
15+
point_count = 4
16+
17+
[sub_resource type="Animation" id="Animation_21j5c"]
18+
length = 4.0
19+
tracks/0/type = "value"
20+
tracks/0/imported = false
21+
tracks/0/enabled = true
22+
tracks/0/path = NodePath("Sprite:self_modulate")
23+
tracks/0/interp = 1
24+
tracks/0/loop_wrap = true
25+
tracks/0/keys = {
26+
"times": PackedFloat32Array(0, 0.4, 0.6, 0.8, 1.1, 1.3, 1.5, 1.8, 1.9, 2, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 3),
27+
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
28+
"update": 0,
29+
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(8, 8, 8, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(8, 8, 8, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(8, 8, 8, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(8, 8, 8, 1), Color(1, 1, 1, 1), Color(8, 8, 8, 1), Color(1, 1, 1, 1), Color(8, 8, 8, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
30+
}
31+
tracks/1/type = "method"
32+
tracks/1/imported = false
33+
tracks/1/enabled = true
34+
tracks/1/path = NodePath(".")
35+
tracks/1/interp = 1
36+
tracks/1/loop_wrap = true
37+
tracks/1/keys = {
38+
"times": PackedFloat32Array(2.8, 3.4),
39+
"transitions": PackedFloat32Array(1, 1),
40+
"values": [{
41+
"args": [],
42+
"method": &"explode"
43+
}, {
44+
"args": [],
45+
"method": &"done"
46+
}]
47+
}
48+
tracks/2/type = "value"
49+
tracks/2/imported = false
50+
tracks/2/enabled = true
51+
tracks/2/path = NodePath("Explosion1:emitting")
52+
tracks/2/interp = 1
53+
tracks/2/loop_wrap = true
54+
tracks/2/keys = {
55+
"times": PackedFloat32Array(0, 2.8),
56+
"transitions": PackedFloat32Array(1, 1),
57+
"update": 1,
58+
"values": [false, true]
59+
}
60+
tracks/3/type = "value"
61+
tracks/3/imported = false
62+
tracks/3/enabled = true
63+
tracks/3/path = NodePath("Explosion2:emitting")
64+
tracks/3/interp = 1
65+
tracks/3/loop_wrap = true
66+
tracks/3/keys = {
67+
"times": PackedFloat32Array(0, 2.8),
68+
"transitions": PackedFloat32Array(1, 1),
69+
"update": 1,
70+
"values": [false, true]
71+
}
72+
73+
[sub_resource type="AnimationLibrary" id="AnimationLibrary_h2w7m"]
74+
_data = {
75+
"anim": SubResource("Animation_21j5c")
76+
}
77+
78+
[node name="Bomb" type="Bomb"]
79+
collision_layer = 0
80+
collision_mask = 2
81+
monitorable = false
82+
83+
[node name="Sprite" type="Sprite2D" parent="."]
84+
position = Vector2(-2.92606, -2.92606)
85+
texture = ExtResource("2")
86+
region_enabled = true
87+
region_rect = Rect2(144, 0, 48, 48)
88+
89+
[node name="Shape1" type="CollisionShape2D" parent="."]
90+
shape = SubResource("RectangleShape2D_1ih13")
91+
92+
[node name="Shape2" type="CollisionShape2D" parent="."]
93+
shape = SubResource("RectangleShape2D_whso6")
94+
95+
[node name="Explosion1" type="CPUParticles2D" parent="."]
96+
emitting = false
97+
lifetime = 0.5
98+
one_shot = true
99+
explosiveness = 0.95
100+
texture = ExtResource("3")
101+
emission_shape = 3
102+
emission_rect_extents = Vector2(80, 1)
103+
gravity = Vector2(0, 0)
104+
initial_velocity_min = 1.0
105+
initial_velocity_max = 1.0
106+
angular_velocity_min = 187.35
107+
angular_velocity_max = 188.35
108+
scale_amount_curve = SubResource("Curve_4yges")
109+
110+
[node name="Explosion2" type="CPUParticles2D" parent="."]
111+
rotation = 1.57162
112+
emitting = false
113+
lifetime = 0.5
114+
one_shot = true
115+
explosiveness = 0.95
116+
texture = ExtResource("3")
117+
emission_shape = 3
118+
emission_rect_extents = Vector2(80, 1)
119+
gravity = Vector2(0, 0)
120+
initial_velocity_min = 1.0
121+
initial_velocity_max = 1.0
122+
angular_velocity_min = 187.35
123+
angular_velocity_max = 188.35
124+
scale_amount_curve = SubResource("Curve_4yges")
125+
126+
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
127+
libraries = {
128+
"": SubResource("AnimationLibrary_h2w7m")
129+
}
130+
autoplay = "anim"

0 commit comments

Comments
 (0)