Using array buffers and alike to improve streaming

A place to request and discuss new engine features / functionality

Using array buffers and alike to improve streaming

Postby Doidel » Fri Mar 21, 2014 2:50 pm

Just wanted to drop a link here: http://buildnewgames.com/optimizing-websockets-bandwidth/

There's still potential in further optimizing streaming, as it currently still uses JSON text format instead of array buffers. Maybe one could automate some stuff, change some defaults (like with streaming the transforms), and if not then at least make aware of the difference between using JSON text and array buffers.
User avatar
Doidel
 
Posts: 59
Joined: Tue Jan 14, 2014 5:05 pm

Re: Using array buffers and alike to improve streaming

Postby robaldred » Sat Mar 22, 2014 10:41 pm

Use Rob's netio instead of socketio the former is much more efficient as it doesn't use json amongst other things.
I don't work for Irrelon. All comments are my own.
I would strongly encourage anyone building production projects with Isogenic to buy a premium licence, it costs very little and will help towards continued development of the engine. Irrelon have spent thousands of hours developing this wonderful platform with many features found in AAA game engine.
User avatar
robaldred
 
Posts: 243
Joined: Wed Oct 23, 2013 8:09 pm
Location: Manchester, England

Re: Using array buffers and alike to improve streaming

Postby Doidel » Tue Mar 25, 2014 6:34 pm

Is that so? oO That is new to me...

Code: Select all
   send: function (data) {
      this._socket.send(this._encode(data));
   },

   _encode: function (data) {
      return JSON.stringify(data);
   }


Can you elaborate if I miss something?
User avatar
Doidel
 
Posts: 59
Joined: Tue Jan 14, 2014 5:05 pm

Re: Using array buffers and alike to improve streaming

Postby robaldred » Thu Apr 10, 2014 1:19 pm

Ok yes, it does use json for the transport, the streamdata is only a simple array of values.
it does not transport the keys, the order of the values is based on the array you provide to streamSections and the translation functions in the streamSectionData method of IgeEntity

If you inspect the data, it's usually something like....

Code: Select all
[true,1,'2,2,2,1,1,1,3,3,3',0]


Which is really quite light weight.
It would be reduced if data that has changed we're sent, at the moment if one item has changed the entire stream data is sent. Although if you were to do that, you'd have to send the key it belongs to otherwise the receiveing end wont know what the values are for
I don't work for Irrelon. All comments are my own.
I would strongly encourage anyone building production projects with Isogenic to buy a premium licence, it costs very little and will help towards continued development of the engine. Irrelon have spent thousands of hours developing this wonderful platform with many features found in AAA game engine.
User avatar
robaldred
 
Posts: 243
Joined: Wed Oct 23, 2013 8:09 pm
Location: Manchester, England

Re: Using array buffers and alike to improve streaming

Postby Doidel » Thu Apr 10, 2014 1:35 pm

Ah yesyes, ige does that one. But that's a whole different level, and done only partially. I was talking about transmitting e.g. position data as array buffers instead of text. This cannot be achieved with JSON, as JSON is text per se. Instead one would have to e.g. put the translation data into an array buffer which is sent over the connection to the client, where it is converted to e.g. a Float32Array.
Otherwise, e.g. for a float with 10 digits, every single digit will be sent as a UTF-8 char. This takes up much more space.

But nvm, will be hard and time-consuming to think of something good :) I'll do tha once I'm at a performance limit with my game ^^


PS: Maybe just have a dedicted float32 section for data like translate data, and send that one individually. For e.g. 100 players you'd easily compensate the overhead for the additional package.
User avatar
Doidel
 
Posts: 59
Joined: Tue Jan 14, 2014 5:05 pm

Re: Using array buffers and alike to improve streaming

Postby robaldred » Thu Apr 10, 2014 1:50 pm

Yeh good point.
It would be some work, but would be achievable to override the _encode and _decode methods and convert the system to work arraybuffers or another binary for maybe something like msgpack.org

It's worth noting that ArrayBuffer is not implemented in IE9.
I don't work for Irrelon. All comments are my own.
I would strongly encourage anyone building production projects with Isogenic to buy a premium licence, it costs very little and will help towards continued development of the engine. Irrelon have spent thousands of hours developing this wonderful platform with many features found in AAA game engine.
User avatar
robaldred
 
Posts: 243
Joined: Wed Oct 23, 2013 8:09 pm
Location: Manchester, England

Re: Using array buffers and alike to improve streaming

Postby Doidel » Thu Apr 10, 2014 2:21 pm

Oh that one's new to me, nice! Yeah, might be worth a thought :) But currently I'm fed up with coding network stuff ^^
User avatar
Doidel
 
Posts: 59
Joined: Tue Jan 14, 2014 5:05 pm


Return to New Feature Discussion

Who is online

Users browsing this forum: No registered users and 1 guest
cron