aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes Use of WebWorkers for gaming - HTML5 Game Programming question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Use of WebWorkers for gaming - HTML5 Game Programming question" Watch "Use of WebWorkers for gaming - HTML5 Game Programming question" New topic
Author

Use of WebWorkers for gaming - HTML5 Game Programming question

andrew ennamorato
Ranch Hand

Joined: Oct 03, 2007
Posts: 100
Web workers seem like an important addition to Javascript, especially in terms of gaming. Being able to run a 'thread' to calculate say, collision detection, seems valuable. Wondering if you cover web workers in the book at all, or if they are too much a pain to use due to their limitations (no access to DOM, for ex).

James Williams
author
Ranch Hand

Joined: Apr 18, 2009
Posts: 35
Andrew,

Web Workers are covered. Web Workers communicate with the host page via message passing. If you can modularize your code in such a way to separate the computation needed on a worker thread from say the UI drawing, you won't have a problem with not accessing the DOM from the worker.
andrew ennamorato
Ranch Hand

Joined: Oct 03, 2007
Posts: 100
Cool, good to hear. I haven't seen a lot on web workers re: the whole 'HTML5' thing (seems like web sockets, local storage and geolocation get most of the pub) so something to look forward to in the book.

Thanks!

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Use of WebWorkers for gaming - HTML5 Game Programming question