tonarino / bomberman-of-the-hill

13 stars 5 forks source link

WASM actor upload system #1

Closed PabloMansanet closed 3 years ago

PabloMansanet commented 3 years ago

At the moment, the number of live players is equal to the number of valid .wasm player files under crates/bomber_game/assets/players. For the meetup, we want a system that makes it easy for attendees to upload their compiled players and see them reflected on the game field immediately.

How it would be used

Server side

Concerns

strohel commented 3 years ago

How it would be used

  • another alternative could be that the main (or another) binary of the example actor crate would simply upload the produced WASM to the server. That could work as the WASM module is considered to be a "lib" target? Uploading and running updated actor could then be a matter of cargo run or cargo run --binary upload. Server side
  • another option would be to keep the folder watching and just fire up some existing tool to serve as an "upload server". (I don't necessarily think this is a better idea).
PabloMansanet commented 3 years ago
  • another alternative could be that the main (or another) binary of the example actor crate would simply upload the produced WASM to the server. That could work as the WASM module is considered to be a "lib" target? Uploading and running updated actor could then be a matter of cargo run or cargo run --binary upload.

I really like this idea, especially if we can get it to work with just cargo run. The only part I'm not sure about is target interactions; you probably can't do it in one go as you'd like to build for wasm but run for a native target, but at worst it's just two commands instead of one.

bschwind commented 3 years ago

A Makefile or script would probably be fine as well - make upload or ./run.sh

We could make one for Windows as well, though I see the appeal of having everything handled via just a cargo invocation.

skywhale commented 3 years ago
  • Alternatively we could get rid of the folder watching altogether, and have it so the networked bevy system directly builds the wasm asset from the TCP stream. This would be cleaner but lose the benefit of the "drag and drop" option.

+1 to keeping the current folder watching mechanism. I would imagine during the game event, the organizers (us) actually wanting to update the bomber_game code and restart rounds several times e.g. tuning game balance, closing loop holes. In that case, it would be nice to be able to load all the previous actors without having to ask the attendees to upload again. The .wasm folder serves as a persistency layer.