My greatest debate in this assignment was whether to base my lobby code off of the Network State Management (Windows) example, or to base it off of the Queue Demo (which creates a session or searches for a session). As someone in class mentioned, the State Management example was a monolith (or leviathan, choose your analogy). At first, I had a juggling act between MainMenuScene, LobbyScene, and OmegaRaceXGame. I kept trying to figure out where to put the lobby methods since, based on encapsulation, they should be in the MainMenuScene instead of OmegaRaceXGame (LobbyScene ending up getting only a Draw method). The methods include UpdateMenuScreen, UpdateNetworkSession, CreateSession, JoinSession, HookSessionEvents, DrawMessage, GamerJoinedEventHandler, and SessionEndedEventHandler.
A simple bug I came across was that creating a lobby always required the Enter key to be pressed twice. I found out that there was an extra DrawMessage call in CreateSession that I had to get rid of and that it would not accept the first keypress of Enter.
MainMenuScene ending up getting a single method called HandleSessionInput that handles requests to create a lobby or find a lobby. One of the worst bugs in my lobby from HandleSessionInput was the absence of !Guide.IsVisible, which caused input from the guide to go into the game and cause a NullReferenceException because the gamer was not logged in yet.
No comments:
Post a Comment