Array Experiments. Screen sharing.

0 favourites
  • 3 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • I had an idea for using arrays to make custom screen sharing test using construct 2.

    Would it be possible to fill a 640x480 array with RGB values? (RGB values for every point on screen) every 0.05 seconds?

    For optimization purposes you probably only have to write to the array for those pixels that actually change, or even better the change is bigger than a certain value from what it was before.

    For example: If one of the pixels on your screen change from White to black, you only write to the array for those coordinates. You take the RGB values of the Array coordinates that changed and send it AsJSON using multiplayer plugin or Photon Cloud? The reciever updates the array on their end. for those pixels that changed.

    Is it possible to Compress the Data in some way internally construct 2 to use even lower bandwidth?

    Any ideas, could this work?

    I'm curious to try it out.

  • You could, but it would be hard to get the 20fps you want.

    For an initial test you could try just sending an array as json and see how it performs. Since it's all text the size of the data could vary a lot. Sending only the pixels that changed would be less data to send up to a point. Since you'd need to send color and position, you could actually need to send more data.

    Getting the colors into the array is the next slow bit. Grabbing pixels is kind of slow, and the only plugin that does it somewhat is the canvas plugin. You'll want to do this in straight javascript for an acceptable speed. Same with arrays. Even looping over them in javascript is much faster than with events.

    Compression is possible, but with that amount of data you'll need to use javascript instead of events.

    A better solution would be to leverage html5 video streaming, but still javascript would be needed.

    But you could go a simpler route, like just sending the player's input so both sides can recreate the same image.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • R0J0hound Thanks! I'm not much of a coder so javascript will be a bit of a hassle for me. But the main idea would be to have another software output the stream. For example while playing Skyrim on your PC a stream of the game will be sent over wifi to your html5 app on your phone. then can use touch controls to control the game, basically play pc games on your tab or phone while on the home wifi.

    I know i would probably need a server app running on the pc that handles the stream and handles the inputs from the phone.

    So thats where the array idea seemed like a good start to see if i can get the one screen mirrored on another device in a simple way.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)