Jump to content

Sprite dynamically updating from dataURI


Recommended Posts

Hey all,

I have a multiplayer game where one player's screen is converted to a dataURI and sent through the game server to the other player. I'm trying to overlay this screen image in the other player's game so that he can see what the first player is doing. This is done continuously, so the sprite should update to reflect it.

I tried using BitmapData but can't seem to get anything working.

Does anyone have suggestions for how to implement this?

Link to comment
Share on other sites

What exactly are you trying to achieve? Do you want to 'stream' player1's game to player2? Like 'filming' his game and send the images to player2? This seems very, very unefficient. It's gonna be a huge load on the servers and very resource-consuming for the clients as well. No game ever does this.


What you should do instead is both players having the code for the game logic, and just send lightweight messages with users actions in it. So that the game on player2's screen will update regarding player1's actions. This will be wayyy lighter and more seamless for both.

Link to comment
Share on other sites

Yes exactly. In this case though it's a very low res "heatmap" of the game state, not a full fidelity image. Creation of this heatmap only takes a few microseconds.

Ultimately what you're suggesting sounds much better, especially to avoid cheating, but I'm just in the prototyping phase now trying to gauge whether the idea is fun.

In the short term, is there a way to achieve this constant redrawing with BitmapData or some other means?


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...