Advertisement Jump to content
Sign in to follow this  

Client Side Event Handlers

This topic is 3364 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I have been looking at a number of design patterns and decided to implement a semi-Listener pattern in my Game Client. But I am pondering if there is a more elegant approach. The game client has three base window classes that it works with, CLoginWnd, CGameListWnd, and CGameWnd. When each window initializes, it invokes a method called Attach() that passes the window handle to the game client. When Notify() is invoked in the game client, it then uses the Win32 API to call PostMessage() and delivers a message to the window's message pump that was fired. The problem with my current approach is that a player can be playing multiple games on the game server, and a single event fired to change game state for one game signals the other windows to do the same, which I don't prefer. What I am wanting to do is take a step back and redesign the framework so that should I decide to move it to another platform, I can easily do so with little modifications to many of the core building blocks. And off the bat, linking into the windows message pump for event delivery is a no no. As an example, the CGameWnd has a handful of objects that need to receive notifications of things that take place in the CGameClient communication with the server. Objects such as buttons need to be hidden/shown, player frames updated, including the rendering of their character, game play objects such as cards, chips, money, and a chat window. Would anyone be able to provide some recommendations? What I have works, but it seems very kludgy to me and it just seems wrong. PS - One alternative I have considered is to simply the game and just allow playing of a single game per login, but I'd rather save that as a last resort given the games in question are very low bandwidth, turn based games.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!