         (spit "save/world.edn" s)))
     (recur)))
 
+(async/go-loop []
+  (let [state (async/<! render-chan)]
+    (info "Rendering world at time" (get-in state [:world :time]))
+    (log-time "render" (render state))
+    (recur)))
+
 (defn save-state [state]
   (async/>!! save-chan state))
+  
+(defn render-state [state]
+  (async/>!! render-chan state))
   
 (defn tick
   "The game loop.

      (log-time "tick"
        (let [new-state (log-time "update-state" (update-state state keyin))]
          (when new-state
            (log-time "render" (render new-state))
            (save-state new-state))
          ;(async/thread (spit "save/world.edn" (with-out-str (pprint (new-state :world)))))
          new-state))


(def save-chan (async/chan (async/sliding-buffer 1)))

(def render-chan (async/chan (async/sliding-buffer 1)))

(async/go-loop []
  (let [state (async/<! save-chan)]
    (info "World saved at time" (get-in state [:world :time]))
