Giter Club home page Giter Club logo

achtung-clj's Introduction

Achtung, die Kurve clone written in Clojure

A hobby project, implementing a clone of the original game in Clojure.

Has a ClojureScript renderer, so to make it playable in the browser. The game engine, state and logic are in a .cljc namespace, so it's possible to add a JavaFX renderer for instance.

Architecture

Game engine / logic

The game engine can be started from the REPL. It returns a map with 3 core async channels.

  1. render-chan A read-only channel that should be continuously read from by the caller, reflecting the latest game state. The caller can then render this as it sees fit.
  2. kill-chan a channel where, if sent a truthy value, will restart the game state.
  3. key-chan a write-only channel where the caller should write keyboard events to. A keyboard event should be a keyword of the letter pressed, ie. :x if the x key was pressed.

Internally, it uses a timeout channel for keeping a fixed 60fps clock tick going. If there's multiple inputs between ticks, it buffers those, and then when the next tick arrives, moves the game state forwards based on those inputs

The gamestate is just a normal reduction (ie. is reduced over, using the keyboard/time events as input). When a clock tick has been done, it sends the game state to the render channel.

NB: Yes, it kind of assumes the rendering function is done in less than 1/60th of a second. Maybe this should be improved.

achtung-clj's People

Contributors

kah0ona 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.