I have a big project I would like to get your help. Basically, it's a Snap! Server, and it would work like a Snap! project instance, but its in the server and you could send actions to it and you could store sprites, sound, text, numbers, costumes and with that you could make a game. But idk how to start @dardoro and @programmer_user?
It depends on what your goals and resources are.
To host Snap! on the server as a NodeJS application, you need to choose the DOM and Canvas implementation, then port the browser app to Node. It might be quite a daunting task.
But, you may start the project as multiple instances of Snap! in different browsers to avoid frame susspension. Next, choose a transport depending on the expected information transfer rate:
- WebRTC, realtime application
- MQTT, a well-known protocol, built into Snap! as a library
- Netsblox messaging (with 0.5s latency to avoid server overload, suitable for turn-based strategies)
- Custom Websocket/HTTP messaging
Then build your application logic the usual way.
If your app gets some momentum, then try to make the server part hostable.
How to host that Snap! instance, could I use some website like Replit?
Yes, but the source code needs to be prepared to be used that way.
Or, directly, if you have a shell account and can run a browser on the server.
There was already some information about running the remote "virtual browser" on the Replit host, but I'm not sure if it conforms to the TOS.
So you will make a server completely repl.it free?
It depends on what "server" means to you.
I was thinking more of the peer-to-peer model. Many projects constantly exchange messages, e.g. "move P1 to x,y" and act accordingly to the other players' actions.
Sometimes, the most powerful computer, with the fastest connection, can be designated as a server, to handle environment changes, perform some validation, or decide a loss/win.
IDE of server cannot be directly viewed, but a block will retrieve things from it to replicate it to the client
To achieve that, I will actually copy Snap! source and get UI things (such as screen but not the complete IDE)
So it's like a Linux machine, right? You know, those machines that came around from the 1970s or 80s all the way until, well, today, before the cloud or internet was invented, right?
Well, it's actually based on Roblox Client-Server Model