State Manager

Yesterday I hit a brick wall.

I was supposed to write the game logic, but I quickly realized that I had bits of game logic strewn across the entire game infrastructure. For instance the networking module was handling state management. Well, I guess it can do that, but what if the state is different? Like async gameplay or what if i just want to sync it differently? Write a new networking engine?

Then I reasoned that single player and multiplayer really should just be scripted modules that control what happens for that type of game.

So I added a plugin for the game that would manage the game state, and with that, would provide a controller architecture. The controller would be responsible for telling the game what to do.

So now all that code that was in the networking module I have moved to the multiplayer game controller. There is a controller for the title, menu and single player game too, but the multiplayer one is by far the most complicated.

I think this separation really works better, now it doesn’t seem so daunting to add a different game play style (so I can experiment) and the networking module does what it is supposed to do and no more.

Advertisements