Re: Concurrently updating two structures

2014-03-21 Thread Raoul Duke
> I am just using this as a learning exercise, I do not need to be lectured > about how to write a game loop... I said obviously since that was my > original request, I am only asking to learn clojure a little better. I > could just drop into java and write a serial loop that does this really fas

Re: Concurrently updating two structures

2014-03-21 Thread Jacob Goodson
Thanks for the code. On Friday, March 21, 2014 4:41:34 PM UTC-4, Gary Trakhman wrote: > > Check out my collision detection here: > https://github.com/gtrak/quilltest/blob/master/src/quilltest/balls.clj#L117 > > I build a map of collided pairs first, then I run through the whole thing > to update

Re: Concurrently updating two structures

2014-03-21 Thread Jacob Goodson
Lol...my goodness... I am just using this as a learning exercise, I do not need to be lectured about how to write a game loop... I said obviously since that was my original request, I am only asking to learn clojure a little better. I could just drop into java and write a serial loop that doe

Re: Concurrently updating two structures

2014-03-21 Thread Gary Trakhman
Check out my collision detection here: https://github.com/gtrak/quilltest/blob/master/src/quilltest/balls.clj#L117 I build a map of collided pairs first, then I run through the whole thing to update the relevant stuff. On Fri, Mar 21, 2014 at 4:37 PM, Raoul Duke wrote: > > update them one at a

Re: Concurrently updating two structures

2014-03-21 Thread Raoul Duke
> update them one at a time. Obviously, I do not want to write something that > updates the enemies and, after the enemies are fully updated, the bullets > get updated. I need something that updates enemies while updating the > bullets, at the same time. Maybe a code example would help? er... i

Re: Concurrently updating two structures

2014-03-21 Thread Jacob Goodson
Ok, I don't think I am communicating or/either comprehending correctly... "it needs to be simultaneous just as far as the atom state-change is concerned" How do I do this? Once the atom is derefenced I would have access to the structures but I need to know how to make sure my code does not se

Re: Concurrently updating two structures

2014-03-21 Thread Gary Trakhman
It doesn't need to be simultaneous within the actual update function (the function that's passed in to swap!), it needs to be simultaneous just as far as the atom state-change is concerned. A faster update function means less contention and restarts. On Fri, Mar 21, 2014 at 4:13 PM, Jacob Goodso

Re: Concurrently updating two structures

2014-03-21 Thread Jacob Goodson
If they were nested what would I use to update them simultaneously? Futures, then roll a loop that would wait till both are realized? On Friday, March 21, 2014 4:00:03 PM UTC-4, Ben Mabey wrote: > > For coordination of this type you could either a) use refs and the STM > or b) put them in the s

Re: Concurrently updating two structures

2014-03-21 Thread Ben Mabey
For coordination of this type you could either a) use refs and the STM or b) put them in the same nested datastructure and put them both in an atom. The latter approach is what I would recommend and what people generally tend to do. If you go down this route you end up with the entire state of