Re: Design Question: Agents vs. Refs

2013-07-19 Thread vis
Good point, I didn't think about that for some reason. Yes I will give it a read, thanks for the link! On Friday, July 19, 2013 6:19:03 PM UTC+2, Mikera wrote: > > If you want to do in in "pure functional style" then I would suggest a > single atom / ref that contains the whole game state (inclu

Re: Design Question: Agents vs. Refs

2013-07-19 Thread Alex Baranosky
I'll second that you are usually doing something unidiomatic if you're using refs of refs. On Fri, Jul 19, 2013 at 2:44 PM, vis wrote: > Good point, I didn't think about that for some reason. > Yes I will give it a read, thanks for the link! > > > On Friday, July 19, 2013 6:19:03 PM UTC+2, Miker

Design Question: Agents vs. Refs

2013-07-19 Thread vis
Hey guys, I am playing around with a gameserver in clojure, here is the situation: - I have a *ref of a hashmap that holds refs of players* - I have a *ref of a hashmap that holds refs of monsters* I used "refs of players" and "refs of monsters" because at some point I might have to transfer thin

Re: Design Question: Agents vs. Refs

2013-07-19 Thread vis
Note: what concerns me about using a* ref of a hashmap that holds agents of monsters* is that I would loose the transaction benefits of the ref (hence I can't safely move items from a player to a monster). -- -- You received this message because you are subscribed to the Google Groups "Clojure

Re: Design Question: Agents vs. Refs

2013-07-19 Thread Mikera
If you want to do in in "pure functional style" then I would suggest a single atom / ref that contains the whole game state (including monsters, players, map, items etc.) That's the approach I've taken in the two Clojure games I've written so far, and it has worked pretty well. You might be int