Adding game engine/business logic?

Apr 2, 2011 at 12:06 AM

How do I hook in my business logic to act on the incoming messages and still keep it decoupled from the rest of the PubSub code? Any ideas?

I think this framework looks very promising!


Apr 2, 2011 at 8:11 AM


one way to decouple your business logic from the pub\sub messagin system is to have your business logic sub-system act as a client of the pub\sub messaging subsystem. The process that manages your business logic can be both a subscriber and publisher of laharsub.


Apr 20, 2011 at 5:41 PM

Thanks Tomasz, that's one interesting way of doing it. I didn't think about that. However, I assume there might be a better option when it comes to performance. I was thinking of making a copy of the "InMemoryPubSubBackend" class and add some business logic there, but not sure if that is the right way to do it. What I want to do is not just forward a message from one client to the other clients, but process the message on the server and maybe send one or many different kind of messages to the clients. Do you have any guidelines for where I could hook up this kind of business logic?

Apr 21, 2011 at 4:16 PM

Hi SilverlightStar,
I don't like change Laharsub code because Tomasz has planning to improve this great software :-), and the community will test it better than you can do alone.

There are several ways  to implement an application like you mention, I can suggest to place your business logic in a windows service in the server.
- Silverlight clients send credentials and requests directly to the server logic, without Larahsub.
- The server logic contacts Laharsub console and creates one topic for the lobby of the game, one topic for each player and one topic for each game table.
- Silverlight clients contacts Laharsub to subscribe/unsubscribe from this topics according with the game situation.
- Silverlight clients send chat messages and game moves directly to the server logic.  The server logic publishes some data messages to Laharsub. Laharsub broadcasts this data messages to the players with subscription.

Hope this helps, Cristian

Apr 22, 2011 at 10:00 AM

Hi Cristian,

Thanks for clearing a few things out here. I agree it is best to leave Laharsub source code as is.

Unfortunately there are very little information about how to use this framework for different scenarios and the only article that demonstrates how to scale-out on multiple servers are from 2009. When searching on the net for people who have published any work with Laharsub I don’t find any good examples.

To be able to focus on my application and not too much on how to send messages between client and server, I’ve decided to use a product called WebSync from Frozen Mountain. It has so many features, documentation and code demos that what I’ve tried to do for 1.5 year was solved within a few hours. It is not free, but not that expensive either.

I will keep the business logic totally separate from WebSync and doing so it is possible to change back to Laharsub again when there are examples of how to scale out in Azure etc. I’ll keep an eye on the next version and hopefully someone in the community can help by demonstrating some successful solutions.