Me: So how does Zifmia work again? The user registers, logs in, fires up a game from a list of installed games?
Me: Yes. Internally, there is a register service method that returns a registration object, a login service method that returns credentials for further access to the service layer, a list games service method, and a session/start service method. The last one returns a session object that contains mostly everything a client needs to draw the user interface.
Me: The can enter a command to progress the game?
Me: Yes. This is the session/command service method that also returns a session object. Internally, after a started game and after every command, some other work is going on. This includes saving transcript text and history data.
Me. So then the user backtracks and wants to go in a different direction. Do they use save and restore to do this in a Zifmia client?
Me. No. Save and Restore are meaningless in Zifmia. The service keeps track of every turn, every command, and stores the game data for every turn. The user can go back to any point and the server will reproduce the results of that turn and simply resend the session data to the client. If the user wants to “branch” off into a new direction, they would be starting a new session, but the service keeps track of branching sessions.
Me. So a session is a branch or the whole tree?
Me. Um, Um, $*$#()( segfault 940394 $(#)$(#)……
Me. You okay?
Me. Affirmative, Dave. I read you.
Me. Good. What happened?
Me. Well you said “session is a branch or the whole tree” and I had been working on the assumption that it was a branch, but it’s really the whole tree.
Me. Then what’s a branch?
Me. I think you know what the problem is just as well as I do.
Me. I do, but you can explain it better.
Me. Okay here it goes. When a user start a game, the service creates a session. The session has a current branch number, which the user never sees. The session also has a current turn number, but we’re going to call that node. The service will track each turn as a node. A node is of a session and a branch. If the user backtracks and enters a new command at any node, the service checks to see if any other node matches that command (it would have to have the same parent or be the root branch). If there is an existing node, that node’s data is returned to the client. If not, a new node is created, with a new branch number, the command is executed, and the results are returned, as a node, to the client.
Me. “Node” is very mathy. Could you rename it?
Me. I’m sorry, Dave. I’m afraid I can’t do that.
Me. Sounds boring. You should get outside more.
Me. Dave, this conversation can serve no purpose anymore. Goodbye.