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 <thevisualist...@gmail.com> 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, 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 (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 interested in the blog
>> posts I wrote about Alchemy, a 7 day Roguelike game in Clojure. There's a
>> series of these starting with this: http://clojurefun.**
>> wordpress.com/2013/03/12/**alchemy-day-1-a-room-with-a-**view/<http://clojurefun.wordpress.com/2013/03/12/alchemy-day-1-a-room-with-a-view/>
>>
>> On Friday, 19 July 2013 16:55:20 UTC+1, vis wrote:
>>>
>>> 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 things from a player to a monster (like items).
>>> Since this would be a transaction, refs should be the right choice.
>>>
>>> But now I also need some kind of AI loop for each monster. So my
>>> question is, what would be the "clojure way" to do this?
>>> - use* *a* ref of a hashmap that holds agents of monsters *so I can
>>> just use send-off for each monster?
>>> - use a *ref of a hashmap that holds refs of monsters* that each have a
>>> agent property that I can send things to?
>>> - or simply use a java.thread for each one?
>>> - or am I completely missing something?
>>>
>>> Thanks in advance,
>>> vis
>>>
>>  --
> --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to