-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
do-not-merge: online functionality #52
base: nightly
Are you sure you want to change the base?
Conversation
print("Connection Established", proto) | ||
|
||
# Handles data received from the WebSocket | ||
func _on_data_received(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently useless, will be used in the future to give ability to control game.
(maybe?)
Do not merge yet! |
scripts/game/Socket.gd
Outdated
extends Node | ||
|
||
# URL for the WebSocket server | ||
export var SOCKET_URL = "ws://127.0.0.1:3000" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls pick a unique port
i run test servers on port 3000
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kermeet said here is valid, 3000 is used for general testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commits look good, but some changes could be done 😊
scripts/game/Socket.gd
Outdated
extends Node | ||
|
||
# URL for the WebSocket server | ||
export var SOCKET_URL = "ws://127.0.0.1:3000" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kermeet said here is valid, 3000 is used for general testing
Polls the WebSocket client for updates. This keeps the connection | ||
alive and processes incoming/outgoing packets. | ||
""" | ||
_wsClient.poll() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's a good idea to put the poll in the _physics_process like @fogsaturate said in private, gd3 networking is awful
Didnt tick the "Requesting changes" thing but thanks git I guess... |
this might seem like a dumb idea but i think it'd be cool if you added the current language selected as a websocket function just in case external programs utilize that, and also has said translation for said program |
Didnt mean to request changes and instead comment (for comments pls refer to #52 (review))
Chat do we merge this :trolley |
Do not merge, this is still heavily tested and being improved. |
The added Socket.gd script initializes a WebSocket client (WebSocketClient) and communicates with another local websocket server process by sending JSON-formatted messages. It handles connection events, receives data, and sends specific game-related states, such as map start, menu state, and map end.
Example in a Node.Js server
Testing:
Why