fand / cyro

8 stars 0 forks source link

Interesting Driverless Cycle.js App #3

Open HighOnDrive opened 9 years ago

HighOnDrive commented 9 years ago

The cyro video looks interesting and the code from this repo is even more interesting. However, when I build and run cyro I only see the same page as this: http://gmork.in/cyro/

The code is very modular yet uses no drivers for the 2d canvas or player. That might work but I'm not able to run the app I'm seeing in the video. Please let me know how cyro runs or if there is some options I'm not aware of. Thanks, love the beauty of the code structure!

The video link of cyro: https://www.youtube.com/watch?v=LDE4W4Zwf7g&feature=youtu.be

fand commented 9 years ago

Sorry for my late reply. Does your browser show any error messages? @HighOnDrive

HighOnDrive commented 9 years ago

Cyro is now running for me, was just not aware that keys needed to be pressed. The main thing I'd like to ask is why the canvas and player code is not wrapped in Cycle drivers? Putting all side-effect code in drivers is the functional purity that Cycle strives for. I'm not the Cycle Police, I'm just interested in learning more about your reason for not putting side-effects in drivers :-)

fand commented 9 years ago

Cyro is now running Ah, thats good!

One of the reasons is my poor understanding for Rx. Both canvas / player need to run loops so frequently. For example, canvas function uses requestAnimationFrame() and I wanted to run it close to 60fps. I didn't know how to implement such procedures in RxJS efficiently.

Another reason is that canvas / player don't have to react to human interaction. They just need to draw rects / play sounds for data given by Model.

HighOnDrive commented 9 years ago

This is understandable and I'm wondering how this type of graphic and sonic rendering could be done using drivers myself. Would you be interested in creating a version of Cyro implemented with drivers? I think it would be interesting to accomplish and I'd be glad to help.