kipraske / web-brogue

Play brogue in a web browser
GNU General Public License v2.0
20 stars 17 forks source link

Data use is way too high #41

Closed kipraske closed 7 years ago

kipraske commented 8 years ago

Anything we can do to lower data usage will help everyone. Currently a massive amount of data gets transfered while you play. I found that playing brogue uses approximately 1MB per minute (so 60MB per hour) of play. So while that is not as bad a streaming a video online, it is horrible if you wanted to play on a slow internet connection.

kipraske commented 8 years ago

One area for improvement is that each update sends information that the client already knows. For example, often the backgrounds of some tiles never change the whole time you are on a level. So we don't need to send it unless there is an update. Similarly, some updates are non-gameplay related. So for example, dancing colors could be set for a tile, and then only unset if there is an update to the tile.

If that was the route that we would want to go down we would have to adjust how brogue makes these updates in the c code itself, which perhaps is not worth the extra effort.

kipraske commented 8 years ago

Another approach is to implement a Fat Client in the browser that runs the brogue game. Because brogue is completely deterministic based on the RNG seed, it would be easy to compare the results from the client brogue with those from a server-brogue and ensure no cheating with minimal data transfer. Even better, theoretically we would get all of our nice dancing colors in there too.

The last few weeks I have been trying to implement such a thing using Emscripten connected to the web-brogue console (see https://github.com/kipraske/web-brogue-client). I have finally successfully gotten a working version, but having brogue and the intensive DOM-updates on the same thread makes I/O pretty laggy. The homepage and dancing colors in the browser work great on the other hand :smile:

flend commented 8 years ago

One area for improvement is that each update sends information that the client already knows. For example, often the backgrounds of some tiles never change the whole time you are on a level. So we don't need to send it unless there is an update

Actually brogue is very good for this. It doesn't update a cell unless it changes. You can see this by snooping the websockets traffic. Compare how much traffic you get for a 1 square move against turning on the inventory etc.

kipraske commented 8 years ago

That is true, and rarely does the background change without the foreground too except in the cases of those dancing tiles. I just wish I could get those colors dancing for some reason. I suppose data use is pretty comparable to watching a low-def youtube video which many people do all the time. I just don't want someone to blow through their data on a cheap plan somewhere because they don't realize how heavy this application is. In short, perhaps I am overreacting