Saturday, July 10, 2010

Multiplayer support part 1

With the single player game (simple as it is still) being almost bug free I decided to work on multiplayer support today. It came out pretty simple and clean. Inside a mode you can for example just call self.shots_made() as a getter or self.shots_made(2) as a setter and it will automatically store this in the player object for the current player. I like it when business-logic code can be kept simple and clean like that!

Also I did another cool thing with mode handling. At the end of each ball all my custom ingame modes will be removed from the queue. Then at the start of the new ball every mode's mode_ball_started() function will be called, giving it a chance to add itself to the mode queue again. Whether it does this or not depends on the current game status for that player (general gameplay, locking balls etc.)

Except for handling locked balls testing the multiplayer functionality was successful!

No comments:

Post a Comment