Git Product home page Git Product logo

space-invaders's Introduction

Space Invaders

This is a project to explore the concept of Functional Reactive Programming (FRP) as much as possible in JavaScript.

Choice of FRP library

The libraries available in JavaScript at this time are not mature, but neither is FRP in general. This project's initial implementation will be in Kefir, which is almost the same as BaconJS, but faster (in simple terms).

Whilst RxJS has significant overlap with Kefir and BaconJS it is not considered FRP, and is as such unfit for the purposes of this project. It does however have many abstractions and layers that would possibly simplify some of the logic in this application, and may warrant investigation in the future.

A library called flyd also looks very exciting, and I will most likely attempt an implementation in flyd after Kefir.

Lessons Learnt

  • Many streams with timers causes large performance issues, a single timer that is filtered/mapped is much faster.
  • Streams all end up combined to be mapped to a view, the streams need to be properties at this point otherwise the stream with no value will block everything else.
  • Making a stream to represent two things e.g. Left AND Right arrow presses is probably a bad idea and will cause awkward behaviour. Create two streams and merge them instead.
  • JavaScript does not allow mutually recursive definitions (to creating a triangle dependency), to create a triangle shaped group of streams a pool must be created, consumed, and the stream added to the pool after the dependents have subscribed. Other implementations like Sodium abstract the pooling technique
  • A current limitation (possibly just of Kefir) is that all streams must be Properties (streams with an initial value, simply). This is because when many streams are merged the resulting stream will not have any values until all the streams it is comprised of have a value.

Resources

space-invaders's People

Contributors

dependabot[bot] avatar lukechannings avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.