Skip to content
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

[Discussion] Idea's related to spliting the code #124

Open
mdziczkowski opened this issue Mar 23, 2024 · 5 comments
Open

[Discussion] Idea's related to spliting the code #124

mdziczkowski opened this issue Mar 23, 2024 · 5 comments

Comments

@mdziczkowski
Copy link
Contributor

Hey Nicolas.

I wanted to give you some ideas that may help you spliting the code and make it communicate with each other.

  • If you create an API that use REST (as an communication protocol in between the parts) then it would make you easier to split it into a smaller modules

  • the client should contain only the main program (small size) that would:

  • display the main interface

  • handle the connections and communication with the server

  • interpreting the data

All game specific functions and resources should remain on the server side to don't cause following (with is common with online games that download all data to the client side):

  • "eating up" too much client's internet brandwith
  • "eating up" too much client's device resources (memory, storage, CPU, etc.)

Both above would decrease the user's experience and may cause that the game (or in worse scenario: the device) become uresponsive

  • too long load of TS2

Adventages

  • faster update
  • small size if the client
  • easier development due smaller parts of code to work with

Side notes:

I see that the work on v0.7 goes in the correct direction and I'm sure it will make the development much easier 🙂

I'm curious if there would be a good idea to use React for some UI parts 🤔

@pedromorgan
Copy link
Contributor

I think there a golang server that does this..

Are u a pyqt dev.. interestingly i checkout the code the other night so helping this project along is still my curious.. (mainly simulating a real railway .. the heart of wales line)

@npiganeau
Copy link
Contributor

Hi @mdziczkowski ,

As said by @pedromorgan , this is already the case.

From v0.7 onwards, the code in this repo is only the client + the editor (because they share a lot of code, though they should be separate in an ideal world).
The server is in the ts2-sim-server repo, and can be connected by several clients at once for multiplayer experience.

The protocol used between the server and the client is not REST but websocket, because we need it to be both fast and bidirectional. Check https://github.com/ts2/ts2-sim-server/blob/master/docs/ts2-technical-manual.adoc for the complete explanation of the architecture and the protocol.

@pedromorgan
Copy link
Contributor

Can we play with mqtt ??

@pedromorgan
Copy link
Contributor

we need to setup some RPI's with a simulator live ;-)) maybe an rpi stack here...

  • but mqtt is kinda cool

kinda working its way into modelling with arduino and rpi

https://www.youtube.com/watch?v=b56dqJHcfVs

@mdziczkowski
Copy link
Contributor Author

Yea, but MQTT has still a long way to go until reaching perfection...

@pedromorgan Not exactly pyqt developer, but I write some code in python3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants