Monday, August 8, 2016

PlayerSession, SPlayerState, unit tests

I got significantly closer to completing all code necessary for the full client lifecycle today. That will encompass logging in, making a simple transaction (buying or selling some stuff) and then logging back out again. I've added the server dll and its first class, SPlayerState, a compositional child of PlayerState. It contains the server's message handling logic for PlayerState requests. There will be something very similar on the child where, if you want to, say, buy something on the PlayerState, you call the base class (doing the actual buying locally), and then do the logic of creating a TransactGoodRequest object and sending it to the server.

I've also been building out the logic for rolling back from a ValidationException. Most exceptions cause a client disco, but ValidationExceptions (which are thrown by game code when an update to the PlayerState doesn't pass muster) send back a whole copy of the "good" PlayerState. My hope is to hook this up so that it resets the user to a known good state in a much less traumatic way than a disco (maybe showing a wheel rolling backward or something, to fit the caravan theme).

I'm writing this on my laptop from the family place in Maine; I took a 2 hour lunch to go windsurfing. Liking the self-employment so far.


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.