The usual approach to this kind of things is to have a Functional
representation of the world, that contains the game logic. To have
pure functions that modifies the world with the time and inputs of
players.
And everytime you want to render a frame to call a render function
that does all the work.

It is not clear whether you can have maximal performance with this
approach, in Clojure, on the JVM, but you can surely do something
decent.

This kind of appraoch is used in How To Design Program, v. 2. This
link shows the idea in Racket (another Lisp variant)
but it could give idea on how to do that in Clojure:

http://docs.racket-lang.org/teachpack/2htdpuniverse.html

They also did a free book:
http://world.cs.brown.edu/

As a rule of thumb, the idea with FP is always to pull out effects
towards the spine of the program and keep the remainder pure. (This
is, of course, not a law and should be adapted to practice)
Here instead of mixing your game logic and your rendering, which put
effects everywhere, you work only on pure data and at the very top you
use your data to draw a world.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to