Net actor
Posted: 02 Sep 2010, 05:36
Hi!
I've read your blog entry (http://laterna--magica.blogspot.com/201 ... rency.html) about the changes to gui interaction using jetlang concurrency framework. Need to say it was a little bit difficult to understand how all these work together. So please check if I'm right in my understanding of the current workflow (with some questions below):
We create gui and attach GuiMagicActor to every player. Gui has pass button below that publish null into passPriority channel for every actor (one actor for every player) whenever the button is pressed. So every player has its own channels. In game loop the engine gets actions as usual method call ps.getPriorPlayer().getActor().getAction() that subscribes to actions channel, then creates some Actor (ActionActor, ManaActor) that will react to user actions (clicking). Whenever user clicks on some object, if it was subscribed to some channel, it will publish action to actions channel and it will be handled in Parallel class getValue method. this way we separate channels that are connected to gui objects by callbacks and actions channel where game engine get actions from. right?
first of all, why Parallel getValue is synchronized on value object, especially as new istance is created on every call? and why do we need second synchronization in Disposable.onMessage subscribed on fiber (Parallel.getValue.d.onMessage)?
The second question is about Net actor: what is the best way to implement it?
I had working verstion for your previous implementation (with synchronized void putAction), but now I'm in stuck a little. The way the old way worked for me was using State pattern, there was a code like (abstract code)
~regards
I've read your blog entry (http://laterna--magica.blogspot.com/201 ... rency.html) about the changes to gui interaction using jetlang concurrency framework. Need to say it was a little bit difficult to understand how all these work together. So please check if I'm right in my understanding of the current workflow (with some questions below):
We create gui and attach GuiMagicActor to every player. Gui has pass button below that publish null into passPriority channel for every actor (one actor for every player) whenever the button is pressed. So every player has its own channels. In game loop the engine gets actions as usual method call ps.getPriorPlayer().getActor().getAction() that subscribes to actions channel, then creates some Actor (ActionActor, ManaActor) that will react to user actions (clicking). Whenever user clicks on some object, if it was subscribed to some channel, it will publish action to actions channel and it will be handled in Parallel class getValue method. this way we separate channels that are connected to gui objects by callbacks and actions channel where game engine get actions from. right?
first of all, why Parallel getValue is synchronized on value object, especially as new istance is created on every call? and why do we need second synchronization in Disposable.onMessage subscribed on fiber (Parallel.getValue.d.onMessage)?
The second question is about Net actor: what is the best way to implement it?
I had working verstion for your previous implementation (with synchronized void putAction), but now I'm in stuck a little. The way the old way worked for me was using State pattern, there was a code like (abstract code)
- Code: Select all
// some method handling user clicking on card object
actions = rmi.getActions(card)
action = choose(actions)
rmi.putAction(action)
~regards