This is a long question...
In a game, I have an "activeplayer' state with an args callback (argument for your game state), let's call it argPossibleMoves.
This callback create a list of possible moves stocked in $this->possible and returned by args callback to client side.
On client side, when a move action is done, an Ajax call is made to mygame.action.php which call for example acMove in mygame.game.php.
...Hope you still follow...
Now, in acMove callback, $this->possible is not defined BUT after self::checkAction('move'); it is restored.
So, there is, in the framework, a mechanism which stores class variables somewhere and restores them.
I find my variable "possible" in database table replaysavepoint.
So, here is my question, can we have some explanations about this mechanism ?
And, which is the FASTER mechanism :
And finally, if I create my list of possible moves in a 'stSomething' state, it is not restored in args callback.
Thanks for All.
PJL
In a game, I have an "activeplayer' state with an args callback (argument for your game state), let's call it argPossibleMoves.
This callback create a list of possible moves stocked in $this->possible and returned by args callback to client side.
On client side, when a move action is done, an Ajax call is made to mygame.action.php which call for example acMove in mygame.game.php.
...Hope you still follow...
Now, in acMove callback, $this->possible is not defined BUT after self::checkAction('move'); it is restored.
So, there is, in the framework, a mechanism which stores class variables somewhere and restores them.
I find my variable "possible" in database table replaysavepoint.
So, here is my question, can we have some explanations about this mechanism ?
And, which is the FASTER mechanism :
- store datas in DB
- store datas in class variable (which are finally stored in BD, so not really efficient ?)
And finally, if I create my list of possible moves in a 'stSomething' state, it is not restored in args callback.
Thanks for All.
PJL