I'm still learning Clojure myself, but I've had some good luck using Rich's Ant Colony demo source as a basis for a simple game I am making. I'm not sure how well it follows what might become "best practices" for clojure game programming, but it has helped me overcome some of the initial hurdles of which you are speaking, allowing me to get things up and running.
http://clojure.googlegroups.com/web/ants.clj -Matt On Oct 19, 5:38 pm, Adam Jones <[EMAIL PROTECTED]> wrote: > I'm starting up work again on my Clojure-based game. Up until this > point I've been doing things the "dirty" way by re-defing a bunch of > global variables and/or storing the values in the Java objects I need > to use to get access to the game framework. > > This approach is pretty unwieldy, and means I miss out on a lot of the > cool things Clojure has to offer. So, I need to figure out how to > handle state from within Clojure. The two ideas that I think will work > are: > > 1. Store the game world as a var, and have the game structured as a > function from the game world to the game world. Since I need to pass > control back to Java to handle a lot of the details this would require > me to store the game world in Java between updates. > > 2. Store the game world as a ref and use the facilities of that to > modify the game state on updates. This seems cleaner in that it can > all be handled without resorting to Java for intermediary storage. I > am concerned that using the STM system would add too much performance > overhead. > > I guess what this all comes down to is, between vars and refs, which > one is the better choice for a program that I don't think will really > need multithreading? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---
