Triang3l / WebQuake

HTML5/WebGL source port of Quake
623 stars 98 forks source link

Forked WebQuake supports Async IO #25

Open efess opened 8 years ago

efess commented 8 years ago

Figured I'd write a note to let you know that I created a fork off this project that uses promises and recursion to support JS's async functions. The main reason for this is support indexed db, which requires async support to retrieve files. Also, synchronous IO functionality will be deprecated at some point anyway.

I was planning on extending your source further, adding some modern features (from proquake or qrack) and hosting a web based gaming environment. This requires users to specify their own local pak1 file (for licensing reasons).

Just wanted to get your thoughts on this project, and if you had any ideas for performance improvements

kzahel commented 8 years ago

Hi efess. I forked your fork, and used/re-enabeled audio context API because audioelement.clone() was causing crashes on chromebooks. https://bitbucket.org/kzahel/webquake

Great work with your fork, love your work with promises. I was able to extend it as necessary. I wasn't a fan of promises until now

Also added gamepad support And fullscreen setting in options

Basically I am trying to get it working well in a chrome app: https://github.com/kzahel/WebQuake-Chrome

efess commented 8 years ago

Cool, although I wonder how much the excessive use of promises affects the performance.. I was going to try testing with bluebird promises, but never got around to it. Some of my promise implementations were pretty hacky as well.

kzahel commented 8 years ago

99% of those promises are initialization code, and arent used at all in the game loop. so not at all, really.

No idea what bluebird promises are :-) is that an ES6 thing?

kzahel commented 8 years ago

I'm just right now trying to Promisify the Server initialization code. Using your work as a reference :-)

efess commented 8 years ago

Oh yea the game loop definitely uses promises, the program code creates a promise even when one isn't necessary.

I was working in my local copy to optimize and cut down the creation of promises when not needed, but there's some loose ends I haven't been able to figure out (or had time)

Bluebird (http://bluebirdjs.com/) is a faster promise implementation, but it comes at the price of needing to import a library.

kzahel commented 8 years ago

Cool. Well please let me know if you make any nice changes!

kzahel commented 8 years ago

I had another approach that I tried which was to use "await" I ended up having still some problems with the loading and would get funny exceptions when a new map loaded. But it mostly worked, and didn't require a lot of rewrite https://github.com/kzahel/WebQuake/commit/8bb479fa054d3948c94074071b6d993f9b332316

SpiritQuaddicted commented 5 years ago

Awesome stuff!

This issue can be closed, https://github.com/Triang3l/WebQuake/issues/33 is there and a PR is in order I think.