Jump to content
  • Advertisement
Sign in to follow this  
Infinity8378

Bandwidth issues in Javascript?

This topic is 649 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How am i to load 172KB/frame @30fps

 

JQuery and JSON are around 0.12MB/s

 

and i can't think of another random OOE way to load.

Edited by Infinity8378

Share this post


Link to post
Share on other sites
Advertisement
What are you talking about? The language does not determine how fast data flows, the hardware and other systems do.

Are you talking about data over a network? Data from disk? Data from one memory source to another?

Also, how are you loading data? Calling a reading function one byte at a time so you incur a massive overhead, or calling a bulk read function?

Share this post


Link to post
Share on other sites

What are you talking about? The language does not determine how fast data flows, the hardware and other systems do.

Are you talking about data over a network? Data from disk? Data from one memory source to another?

Also, how are you loading data? Calling a reading function one byte at a time so you incur a massive overhead, or calling a bulk read function?

 

I thought in javascript/HTML5 you had to use query assets scince due to security you can't access anything else?

 

I have no idea how load the data.

Share this post


Link to post
Share on other sites
Moving this thread from “Build Systems and Source Control” to “General Programming”.

I have no idea how load the data.


Request them like any other server resource. Something like this perhaps:
 
var assets = {};
var queued_assets = [
	'images/example.png',
	'sounds/example.ogg',
	?
];

$q.all(
	queued_assets.map( path =>
		$http.get(path).then( response =>
			assets[path] = response.data;
		)
	)
).then(function(){
	log('assets loaded!');
});
Edited by fastcall22

Share this post


Link to post
Share on other sites

Moving this thread from “Build Systems and Source Control” to “General Programming”.
 

I have no idea how load the data.


Request them like any other server resource. Something like this perhaps:
 
var assets = {};
var queued_assets = [
	'images/example.png',
	'sounds/example.ogg',
	?
];

$q.all(
	queued_assets.map( path =>
		$http.get(path).then( response =>
			assets[path] = response.data;
		)
	)
).then(function(){
	log('assets loaded!');
});

That looks like lazy loading i need data each frame

Share this post


Link to post
Share on other sites

What is “the data”? If you need an interactive connection, then websockets are the only other way to go.

It can be offline data it just seemed like that would still load slow like other queries I haven't been able to get offline data to work with HTML canvas

Edited by Infinity8378

Share this post


Link to post
Share on other sites

 

...I haven't been able to get offline data to work with HTML canvas

 

Do you have a local web server set up or are you pulling directly from the filesystem?

Share this post


Link to post
Share on other sites

I don't have a web server but I thought it was slower

 

It's not an Also the 8bits are not an image but a (Lighting+Normal) map holding luminosity.

 

Basically i map The GI which is 6 combinations plus the hue which is up to 64 combinations to a 216bit color nondithering color space

It's not an image but a brightness (Lighting+Normal) map.

 

Basically i map The GI which is 6 combinations plus the hue which is up to 64 combinations to a 216bit color nondithering color space

Share this post


Link to post
Share on other sites

Wait, are you asking how to stream frame data? Using a text protocol like JSON is definitely not the way - use TypedArrays and Buffers to directly decode/copy image data.

 

For making the requests, definitely do not make a whole new HTTP request for every single frame. HTTP is _slow_ (at worst you have to establish a whole new TCP connection including renogotiation of the channel and TLS, you have to make a whole new request will all headers, get the request re-routed through the server, and then re-encode all response headers and the body). You want a persistent low-overhead connection, e.g. either WebSockets or server-push events (or emulations there-of).

 

If you're just loading a big chunk of assets, pack them together into a single file so that you're only paying the request/response overhead once. You can use things like zipjs / JSZip or a variety of other solutions to extract individual files out of a larger (compressed) archive.

 

For decoding, you can also multi-thread your code using WebWorkers if you need an additional speed bump. Some browsers can _actually_ use multiple threads for WebWorkers. Note also that WebWorkers can do their own I/O requests to further assist with resource loading, assuming that processing/decoding and now bandwidth is your biggest bottleneck (e.g. decoding images dumped into JSON files).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!