Up to Main Index Up to Journal for November, 2013 JOURNAL FOR WEDNESDAY 6TH NOVEMBER, 2013 ______________________________________________________________________________ SUBJECT: Player/Parser separation DATE: Wed 6 Nov 21:59:50 GMT 2013 I've just spent all evening/night working on the parsers. Well indirectly anyway. The main issue is keeping the PlayerList up to date when any of the parsers bail due to quitting, network errors or Murphy's law. It then dawned on me that I was going about things the wrong way :( What I need to do is separate Player from it's parser. I was going to do that anyway, just not yet. Now I have to stash my current changes to get back to a working state, rework player to split out the parser, then rework the current changes back in *sigh* Also it's been pointed out to me that 'parsers' may be a little confusing as it might mean two different things. There is the parsers for logins and menus, then there is the parser for handling in-game commands. However they basically do the same thing: accept input, handle input and respond with output. So really they are the same - look at them very hard and maybe squint a little. In the following Player refers to the Go type and player to the person playing the game. It gets tricky when you model a player with a type Player and then want to talk about it! Player just needs to be a bunch of values and have a few methods for handling player affecting commands. The game parser takes the player's input and dispatches the handling. At no time does Player have to handle or be concerned with any networking. In fact Player needs to operate independently for things like quitting in the middle of a fight - the fight needs to reach it's conclusion - even if things are going bad and the player 'pulls the plug' in a effort to escape ;) In this situation the player cannot log in again until the fight ends, at which point the Player is saved and logged out as if the player quit normally. So lots of coding to be getting on with... -- Diddymus Up to Main Index Up to Journal for November, 2013