smcameron / space-nerds-in-space

Multi-player spaceship bridge simulator game. Captain your starship through adventures with your friends. See https://smcameron.github.io/space-nerds-in-space
GNU General Public License v2.0
724 stars 73 forks source link

{request} web interface single computer host #337

Closed develperbayman closed 9 months ago

develperbayman commented 9 months ago

is it possible to be able to host the game on one computer and then play using web browser in full screen / more device support that would be super cool

smcameron commented 9 months ago

It isn't a web game, so there's no web browser support, and there isn't going to be.

For a brief time, I toyed with the idea of compiling to WASM, but there is way too much linux-specific stuff in there, so that isn't going to happen.

You can run the game on a single computer, running the lobby, the server, and the client all on the same system.

"more device support"... not sure what you mean by that (if you mean windows, the answer is currently "no.", although the game should be able to be run in WSL, though performance may not be great, and there might be something you have to do to get the linux part access to the GPU... I dunno, I've never tried that myself.)

develperbayman commented 9 months ago

lol sorry to just be getting back to you i dont mean compiling to any other system so much as being able to run on one linux machine but being able to export the view screens to i thought a web interface would be universal but idk ...for example i could run the program on my orange pi 5 but put all the displays on different devices like engineering on my tablet and something else on my buddys laptop and maybe even use a phone in the mix so players can come together and nerd ....so i dont mean make it run on the web just be able to control the different stations using a web interface so any device can get in on the action ...so to speak .....sorry i also suck at communication sometimes

develperbayman commented 9 months ago

i dont know c so i dont think i would be much help but something like

# Get the state of the control display
control_display_state = get_control_display_state(control_display)

# Create a JSON object with the control display state
control_display_json = json.dumps(control_display_state)

# Send the JSON object to the web interface
requests.post("http://localhost:8080/api/control-displays", data=control_display_json)
smcameron commented 9 months ago

so i dont mean make it run on the web just be able to control the different stations using a web interface

That is running on the web.

smcameron commented 9 months ago
# Get the state of the control display
control_display_state = get_control_display_state(control_display)

# Create a JSON object with the control display state
control_display_json = json.dumps(control_display_state)

# Send the JSON object to the web interface
requests.post("http://localhost:8080/api/control-displays", data=control_display_json)

It doesn't really work that way. The "state" of the display on the clients is quite a lot of information which is incrementally updated by the server. The clients make requests of the server, which updates the state on the server, which are then propagated out to all the clients. There is no notion of a client "requesting" a dump of the state from the server, the server continuously sprays the clients with incremental updates without being requested for them. (you can read about the protocol here.

It might in principle be possible (for someone other than me) to essentially re-implement snis_client such that instead of directly rendering everything via opengl, it spews out appropriate web server speak to make a web browser appear to act as a client, and instead of accepting input from the keyboard, mouse, game controllers, etc, it accepts input somehow over https from a browser on the other end. However doing so would be a huge task, and one I am not knowledgeable enough about nor interested in attempting.

develperbayman commented 9 months ago

i was thinking it could be a bit of a undertaking ....very cool program tho

develperbayman commented 9 months ago

ill toy around with it if i come up with something ill get back to you

smcameron commented 9 months ago

This document should help you understand the design of the current system: https://htmlpreview.github.io/?https://github.com/smcameron/space-nerds-in-space/blob/master/doc/hacking-space-nerds-in-space.html