nesbox / TIC-80

TIC-80 is a fantasy computer for making, playing and sharing tiny games.
https://tic80.com
MIT License
4.93k stars 479 forks source link

Internet Function #402

Open fangzhangmnm opened 6 years ago

fangzhangmnm commented 6 years ago

Does it a good idea to implement some internet api for multiplayer games?

Jummit commented 6 years ago

You could do this with a function for reading a website and one for posting something. Then you would have to have an own website that can store data and send it to the clients or so.

Jaezmien commented 6 years ago

(implement playerio :>)

hashalon commented 6 years ago

What about something like a shared RAM that would be synchronized between client and server. It would be a nice pro feature, I think.

jahodfra commented 6 years ago

Personally I think that ability to do HTTP request would just be interesting for uploading score, tracking users and high latency communication (turn based games).

I see TIC more directed to smaller action games which would benefit from having UDP communication. Still writing proper network code is lot of work so I am wondering if this task cannot be done once in TIC e.g. as @harraps suggested by having shared memory.

I would see it that any client should be able to connect to special TIC-server which would wait until one of the client will start the game. Each client would then be able to modify the common memory. The server would maintain the memory and send all modifications to all other clients. The server would be run and maintained by a developer of cartridge. The server would have to reconcile modifications from all clients - e.g. in custom lua function. The resulting state of the game would then be send back to clients and clients would have specific lua function which should reconcile version of the server shared memory with their own local version. The whole state of the game should then fit into one UDP packet.

jahodfra commented 6 years ago

I took a look and even UDP communication would need the server for establishing connection for cartridges running in browser (WebRTC).

https://stackoverflow.com/questions/13216785/how-to-send-a-udp-packet-with-web-rtc-javascript I found following JS game using WebRTC - https://github.com/rynobax/jump-game

fangzhangmnm commented 6 years ago

After the ludum dare, I realized that it is very useful to add a online highscore service for tic-80.

jahodfra commented 6 years ago

The online score is in issue #362.

jahodfra commented 6 years ago

I filled #457 to describe how the games can work over network.

txgruppi commented 2 years ago

Hey everyone. I would like to revive this thread. I would love to have basic HTTP requests to work with some scores/raking.

BuoYancYdabl commented 2 years ago

Does it a good idea to implement some internet api for multiplayer games?

not internet, but p2p would be great!

sprive commented 1 year ago

I want to +1 this ask, but really there are 4 facets here:

  1. playerio support
  2. High score saving (public server)
  3. Internet game loading menu
  4. generic Internet support (tcp udp and/or HTTP), probably for reasons not described above

What might help is creation of these 4 focused requests as distinct issues, linking them from here, and close this. This ticket likely can not encompass all of the above and still get actioned.

clsource commented 9 months ago

I think some web connectivity would be great. But a simple HTTP lib or websockets would be enough for most games.

For example using https://docs.rs/phyllo/latest/phyllo/ for using Phoenix Channels would enable using Phoenix Framework as a Backend for the Games.

But each developer has their own preferences.

My recommendation would be providing just a plugin like mechanism for TIC and each developer hooks some events in C or Rust and compiles a TIC version with their own extensions.