This commit is contained in:
Torsten 2025-11-02 16:26:57 +01:00
parent c0021b5240
commit c1c5541ccd
24 changed files with 5977 additions and 692 deletions

View file

@ -118,8 +118,8 @@ Receives RPC:
"elements": [
{
"type": "text",
"version": 189,
"versionNonce": 1646422536,
"version": 190,
"versionNonce": 678378050,
"isDeleted": false,
"id": "ogiPzd6g",
"fillStyle": "solid",
@ -139,7 +139,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711507,
"updated": 1762073979470,
"link": null,
"locked": false,
"fontSize": 20,
@ -186,8 +186,8 @@ Receives RPC:
},
{
"type": "text",
"version": 116,
"versionNonce": 387390072,
"version": 117,
"versionNonce": 1156186846,
"isDeleted": false,
"id": "QM9z7z28",
"fillStyle": "solid",
@ -209,7 +209,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711507,
"updated": 1762073979470,
"link": null,
"locked": false,
"fontSize": 20,
@ -225,8 +225,8 @@ Receives RPC:
},
{
"type": "text",
"version": 115,
"versionNonce": 1566042376,
"version": 116,
"versionNonce": 1490199042,
"isDeleted": false,
"id": "lzqSWhzg",
"fillStyle": "solid",
@ -248,7 +248,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711508,
"updated": 1762073979470,
"link": null,
"locked": false,
"fontSize": 20,
@ -295,8 +295,8 @@ Receives RPC:
},
{
"type": "text",
"version": 236,
"versionNonce": 859638648,
"version": 237,
"versionNonce": 1285682974,
"isDeleted": false,
"id": "meVCNPYm",
"fillStyle": "solid",
@ -318,7 +318,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711508,
"updated": 1762073979470,
"link": null,
"locked": false,
"fontSize": 20,
@ -394,8 +394,8 @@ Receives RPC:
},
{
"type": "text",
"version": 26,
"versionNonce": 1938130952,
"version": 27,
"versionNonce": 1072894402,
"isDeleted": false,
"id": "v4pT6zvp",
"fillStyle": "solid",
@ -417,7 +417,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711508,
"updated": 1762073979470,
"link": null,
"locked": false,
"fontSize": 20,
@ -464,8 +464,8 @@ Receives RPC:
},
{
"type": "text",
"version": 240,
"versionNonce": 394058872,
"version": 241,
"versionNonce": 970023774,
"isDeleted": false,
"id": "fC0tirch",
"fillStyle": "solid",
@ -487,7 +487,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711508,
"updated": 1762073979470,
"link": null,
"locked": false,
"fontSize": 20,
@ -534,8 +534,8 @@ Receives RPC:
},
{
"type": "text",
"version": 333,
"versionNonce": 1353139976,
"version": 334,
"versionNonce": 284133762,
"isDeleted": false,
"id": "CdMUYz3V",
"fillStyle": "solid",
@ -557,7 +557,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711508,
"updated": 1762073979470,
"link": null,
"locked": false,
"fontSize": 20,
@ -604,8 +604,8 @@ Receives RPC:
},
{
"type": "text",
"version": 71,
"versionNonce": 1704627576,
"version": 72,
"versionNonce": 1590249374,
"isDeleted": false,
"id": "FvN3KcjQ",
"fillStyle": "solid",
@ -625,7 +625,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711508,
"updated": 1762073979470,
"link": null,
"locked": false,
"fontSize": 20,
@ -641,8 +641,8 @@ Receives RPC:
},
{
"type": "text",
"version": 128,
"versionNonce": 1094264328,
"version": 129,
"versionNonce": 1124534594,
"isDeleted": false,
"id": "Lufy2xnG",
"fillStyle": "solid",
@ -662,7 +662,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711508,
"updated": 1762073979471,
"link": null,
"locked": false,
"fontSize": 20,
@ -678,8 +678,8 @@ Receives RPC:
},
{
"type": "text",
"version": 157,
"versionNonce": 1725570680,
"version": 158,
"versionNonce": 465216478,
"isDeleted": false,
"id": "GLtt6nBn",
"fillStyle": "solid",
@ -699,7 +699,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711509,
"updated": 1762073979471,
"link": null,
"locked": false,
"fontSize": 20,
@ -715,8 +715,8 @@ Receives RPC:
},
{
"type": "text",
"version": 179,
"versionNonce": 574039304,
"version": 180,
"versionNonce": 228102402,
"isDeleted": false,
"id": "TAacQHcq",
"fillStyle": "solid",
@ -736,7 +736,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711509,
"updated": 1762073979471,
"link": null,
"locked": false,
"fontSize": 20,
@ -752,8 +752,8 @@ Receives RPC:
},
{
"type": "text",
"version": 282,
"versionNonce": 469733240,
"version": 283,
"versionNonce": 582383646,
"isDeleted": false,
"id": "NVVwhe0m",
"fillStyle": "solid",
@ -773,7 +773,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711509,
"updated": 1762073979471,
"link": null,
"locked": false,
"fontSize": 20,
@ -789,8 +789,8 @@ Receives RPC:
},
{
"type": "text",
"version": 400,
"versionNonce": 1360872456,
"version": 401,
"versionNonce": 1680023746,
"isDeleted": false,
"id": "91ImiIhV",
"fillStyle": "solid",
@ -810,7 +810,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711509,
"updated": 1762073979471,
"link": null,
"locked": false,
"fontSize": 20,
@ -826,8 +826,8 @@ Receives RPC:
},
{
"type": "text",
"version": 481,
"versionNonce": 1297014904,
"version": 482,
"versionNonce": 1001243742,
"isDeleted": false,
"id": "fdPpliWn",
"fillStyle": "solid",
@ -847,7 +847,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711509,
"updated": 1762073979471,
"link": null,
"locked": false,
"fontSize": 20,
@ -863,8 +863,8 @@ Receives RPC:
},
{
"type": "text",
"version": 559,
"versionNonce": 468157192,
"version": 560,
"versionNonce": 1917171842,
"isDeleted": false,
"id": "sCSOO4P6",
"fillStyle": "solid",
@ -884,7 +884,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711509,
"updated": 1762073979471,
"link": null,
"locked": false,
"fontSize": 20,
@ -900,8 +900,8 @@ Receives RPC:
},
{
"type": "text",
"version": 157,
"versionNonce": 445387128,
"version": 158,
"versionNonce": 141658270,
"isDeleted": false,
"id": "IJaaEho9",
"fillStyle": "solid",
@ -921,7 +921,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711509,
"updated": 1762073979471,
"link": null,
"locked": false,
"fontSize": 20,
@ -937,8 +937,8 @@ Receives RPC:
},
{
"type": "text",
"version": 200,
"versionNonce": 823255560,
"version": 201,
"versionNonce": 398415938,
"isDeleted": false,
"id": "wJ9HIOk7",
"fillStyle": "solid",
@ -958,7 +958,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711509,
"updated": 1762073979471,
"link": null,
"locked": false,
"fontSize": 20,
@ -974,8 +974,8 @@ Receives RPC:
},
{
"type": "text",
"version": 226,
"versionNonce": 184230520,
"version": 227,
"versionNonce": 1219675358,
"isDeleted": false,
"id": "2mt7IJUS",
"fillStyle": "solid",
@ -995,7 +995,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711509,
"updated": 1762073979471,
"link": null,
"locked": false,
"fontSize": 20,
@ -1011,8 +1011,8 @@ Receives RPC:
},
{
"type": "text",
"version": 239,
"versionNonce": 261644552,
"version": 240,
"versionNonce": 1684996098,
"isDeleted": false,
"id": "HloKPrJf",
"fillStyle": "solid",
@ -1032,7 +1032,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711509,
"updated": 1762073979471,
"link": null,
"locked": false,
"fontSize": 20,
@ -1048,8 +1048,8 @@ Receives RPC:
},
{
"type": "text",
"version": 283,
"versionNonce": 492835704,
"version": 284,
"versionNonce": 503478558,
"isDeleted": false,
"id": "l4Cs84vC",
"fillStyle": "solid",
@ -1069,7 +1069,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711509,
"updated": 1762073979471,
"link": null,
"locked": false,
"fontSize": 20,
@ -1085,8 +1085,8 @@ Receives RPC:
},
{
"type": "text",
"version": 412,
"versionNonce": 1995898888,
"version": 413,
"versionNonce": 341028802,
"isDeleted": false,
"id": "XRpIehSi",
"fillStyle": "solid",
@ -1106,7 +1106,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711509,
"updated": 1762073979472,
"link": null,
"locked": false,
"fontSize": 20,
@ -1122,8 +1122,8 @@ Receives RPC:
},
{
"type": "text",
"version": 421,
"versionNonce": 1476322424,
"version": 422,
"versionNonce": 1339139422,
"isDeleted": false,
"id": "7VBJOBLc",
"fillStyle": "solid",
@ -1143,7 +1143,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1750310711510,
"updated": 1762073979472,
"link": null,
"locked": false,
"fontSize": 20,
@ -1159,8 +1159,8 @@ Receives RPC:
},
{
"type": "text",
"version": 169,
"versionNonce": 1792905955,
"version": 170,
"versionNonce": 193750914,
"isDeleted": false,
"id": "5hiXr5l7",
"fillStyle": "solid",
@ -1182,7 +1182,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1709040040784,
"updated": 1762073979472,
"link": null,
"locked": false,
"fontSize": 19.852103697407568,
@ -1194,7 +1194,7 @@ Receives RPC:
"containerId": null,
"originalText": "network_scene_to_client\n\nSends RPC:\n\t\n\nReceives RPC:\n\t\n\n*Signals:*\n\n\t\t",
"lineHeight": 1.25,
"baseline": 266
"baseline": 267
},
{
"type": "rectangle",
@ -1229,8 +1229,8 @@ Receives RPC:
},
{
"type": "text",
"version": 198,
"versionNonce": 533959181,
"version": 199,
"versionNonce": 259082654,
"isDeleted": false,
"id": "Fhj4p7CG",
"fillStyle": "solid",
@ -1252,7 +1252,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1709039961780,
"updated": 1762073979472,
"link": null,
"locked": false,
"fontSize": 19.852103697407568,
@ -1264,7 +1264,7 @@ Receives RPC:
"containerId": null,
"originalText": "client\n\nSends RPC:\n\t\n\nReceives RPC:\n\t\n\n*Signals:*\n\n\t\t",
"lineHeight": 1.25,
"baseline": 266
"baseline": 267
},
{
"type": "rectangle",
@ -1299,8 +1299,8 @@ Receives RPC:
},
{
"type": "text",
"version": 314,
"versionNonce": 2100607757,
"version": 315,
"versionNonce": 1381508930,
"isDeleted": false,
"id": "oHgsr2yn",
"fillStyle": "solid",
@ -1322,7 +1322,7 @@ Receives RPC:
"frameId": null,
"roundness": null,
"boundElements": [],
"updated": 1709039965875,
"updated": 1762073979472,
"link": null,
"locked": false,
"fontSize": 19.852103697407568,
@ -1334,7 +1334,7 @@ Receives RPC:
"containerId": null,
"originalText": "audio_manager\n\nSends RPC:\n\t\n\nReceives RPC:\n\t\n\n*Signals:*\n\n\t\t",
"lineHeight": 1.25,
"baseline": 266
"baseline": 267
},
{
"type": "rectangle",
@ -1383,10 +1383,10 @@ Receives RPC:
"currentItemTextAlign": "left",
"currentItemStartArrowhead": null,
"currentItemEndArrowhead": "arrow",
"scrollX": 1736.365683964645,
"scrollY": 983.2003286622428,
"scrollX": 1876.4489242920258,
"scrollY": 1682.8573013959976,
"zoom": {
"value": 0.45
"value": 0.35000000000000003
},
"currentItemRoundness": "round",
"gridSize": null,

View file

@ -1,10 +0,0 @@
pixel positions on the screen use Vector2 coordinates
cell to world using Vector2
```
var cell_size:Vector2 = Vector2(50.0, 50.0)
# or: var cell_size := Vector2(50.0, 50.0)
func grid_to_world(cell):
return cell + cell_size + cell_size / 2
```

View file

@ -0,0 +1,88 @@
Preparing the signals
```gdscript
func _ready():
host_button.pressed.connect(_on_host_pressed)
join_button.pressed.connect(_on_join_pressed)
multiplayer.peer_connected.connect(_on_peer_connected)
```
```gdscript
func _on_peer_connected(id: int):
print("my peer id: %s" % multiplayer.get_unique_id())
print("peer connected: %s" % id)
```
Starting a server
```gdscript
func _on_host_pressed() -> void:
const PORT=3000
var server_peer := ENetMultiplayerPeer.new()
server_peer.create(PORT)
multiplayer.multiplayer_peer = server_peer
```
Joining a server
```gdscript
func _on_join_pressed() -> void:
var client_peer := ENetMultiplayerPeer.new()
client_peer.create_client("127.0.0.1", PORT)
multipler.multiplayer_peer = client_peer
```
Sending RPC to server
```gdscript
```
Receiving RPC from host
```gdscript
```
Aus AWA:
```gdscript
func create_server():
log.start("create_server")
log.debug("port: "+str(port))
peer.peer_connected.connect(_on_peer_connected)
peer.peer_disconnected.connect(_on_peer_disconnected)
multiplayer_api = MultiplayerAPI.create_default_interface()
get_tree().set_multiplayer(multiplayer_api, self.get_path())
peer.create_server(port, 2000) # Max 2000 Scenes
if peer.get_connection_status()==MultiplayerPeer.CONNECTION_DISCONNECTED:
log.debug("Verbindungsaufbau fehlgeschlagen")
get_tree().quit()
multiplayer_api.multiplayer_peer = peer
```
```gdscript
func connect_client():
log.start("connect_client")
peer = ENetMultiplayerPeer.new()
log.debug("host=" + host + ", port=" + str(port))
multiplayer_api = MultiplayerAPI.create_default_interface()
get_tree().set_multiplayer(multiplayer_api, self.get_path())
peer.create_client(host, port)
peer.peer_connected.connect(_on_peer_connected)
peer.peer_disconnected.connect(_on_peer_disconnected)
if peer.get_connection_status() == MultiplayerPeer.CONNECTION_DISCONNECTED:
log.debug("Verbindungsaufbau fehlgeschlagen. SceneHost="+str(host)+", port="+str(port))
#get_tree().quit()
multiplayer_api.multiplayer_peer=peer
```
```gdscript
func request_send_chatline(txt:String):
rpc_id(1,"rpc_cs_send_chatline", txt) # 1=peer_id vom master server
@rpc("any_peer") func rpc_cs_send_chatline(txt:String):
pass # Implementation not needed on client
```

View file

@ -1,4 +1,4 @@
```python
```gdscript
func _ready() -> void:
var gem_scene := preload("gem.tscn")
var gem_instance := gem_scene.instantiate()