-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
44a8883
commit bae451f
Showing
7 changed files
with
139 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
ursina==4.1.1 | ||
ursinanetworking==2.1.4 | ||
numpy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from ursina import * | ||
from ursinanetworking import * | ||
|
||
print("Hello from the Server!") | ||
|
||
server = UrsinaNetworkingServer("localhost", 25565) | ||
easy = EasyUrsinaNetworkingServer(server) | ||
|
||
@server.event | ||
def onClientConnected(client): | ||
easy.create_replicated_variable( | ||
f"player_{client.id}", | ||
{ "type" : "player", "id" : client.id, "position": (0, 0, 0), "rotation" : (0, 0, 0)} | ||
) | ||
print(f"{client} connected!") | ||
client.send_message("GetId", client.id) | ||
|
||
@server.event | ||
def onClientDisconnected(client): | ||
easy.remove_replicated_variable_by_name(f"player_{client.id}") | ||
|
||
@server.event | ||
def MyPosition(client, newpos): | ||
easy.update_replicated_variable_by_name(f"player_{client.id}", "position", newpos) | ||
|
||
@server.event | ||
def MyRotation(client, newrot): | ||
easy.update_replicated_variable_by_name(f"player_{client.id}", "rotation", newrot) | ||
|
||
while True: | ||
easy.process_net_events() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters