On Mon, 2010-09-06 at 21:09 +0300, Vlad Dragu wrote:
> I think I will divert a little from the pseudocode example on the
> wiki. I don’t think I will be using functions such as wait_for_action
> since I cannot have php “listen” for stuff happening on the client
> side. Most likely I will save the state of a mission and once  a page
> loads or an action is taken I will see if it’s the correct action to
> be executed according to the mission scenario.

You don't have to make it listen for stuff happening: try implementing
triggers, that you add to the code called when the action happens, and
that check if a mission has called the "wait_for_action" method with
this action name. If it's the case, you re-instantiate the object with
the correct variables (you may want to have a look at serialization
here) and call the method that was passed on to the "wait_for_action"
method in the first place.

Let me know if it's not clear, because the alternative that you describe
could lead to reimplement state machines - which doesn't easily scale to
the complexity that missions can quickly attain. If you're having
troubles implementing it the way it's described in the pseudocode
mission, let me know.

> I have a question: once a player starts a mission, can he put it on
> pause? For example, let’s say that the next action is to navigate to a
> site. If the player goes to another site, a message will say “this is
> not the correct site”. But if the player does not want to follow the
> mission and just want to browse around some sites, I will keep popping
> the message “this is not the correct site”. What do you think? 

Yes, it's not very good, agreed : ) It would probably be good to provide
something like a pause, yep. To try to keep the mission engine as small
as possible, we should try to implement it in the mission object first,
though - for example by using a variable to only warn the first time, or
by providing a way to "shut up" (like saying "shut up" in the chat for
example ;p).

If we realize when we do several missions that we always need this, then
we can look at putting it in the engine, but otherwise I'd rather keep
it as small as possible to avoid bloating it. Note that there is also
the possibility of creating libraries for mission objects, that would
provide this kind of features, but would avoid mixing them with the
mission engine itself.

Xavier.

_______________________________________________
Hackit Bar mailing list - [email protected]

Wiki:  http://community.hackit.cx/
List:  http://community.hackit.cx/ml/
Forum: http://community.hackit.cx/forum/
Ideas: http://community.hackit.cx/ideas/
IRC:   irc://irc.freenode.net/#politis

Reply via email to