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.
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.
I want to +1 this ask, but really there are 4 facets here:
playerio support
High score saving (public server)
Internet game loading menu
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.
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.
Activity
Jummit commentedon Nov 19, 2017
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 commentedon Nov 24, 2017
(implement playerio :>)
hashalon commentedon Nov 29, 2017
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 commentedon Nov 29, 2017
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 commentedon Nov 29, 2017
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 commentedon Dec 10, 2017
After the ludum dare, I realized that it is very useful to add a online highscore service for tic-80.
jahodfra commentedon Dec 10, 2017
The online score is in issue #362.
jahodfra commentedon Dec 11, 2017
I filled #457 to describe how the games can work over network.
txgruppi commentedon Jul 14, 2022
Hey everyone. I would like to revive this thread. I would love to have basic HTTP requests to work with some scores/raking.
BuoYancYdabl commentedon Jul 21, 2022
not internet, but p2p would be great!
sprive commentedon Sep 6, 2023
I want to +1 this ask, but really there are 4 facets here:
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 commentedon Nov 29, 2023
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.