Advertisement Jump to content
  • Advertisement
  • entries
  • comments
  • views

Progress Report

Sign in to follow this  



I'm a little stuck in Moe at the point where I need to add command handling for player orders. In the previous iteration, each player got their own handler. That was nice because then setting that it was someone's turn was as easy as enabling the 'in turn' commands. It sucked, because almost all of the commands needed to know whose turn it was, which lead to a lot of binding for the particular commands. I'd like to make something a little more elegant than my current options.

1. Do binding like before. Effective, easy, but tedious.

2. Extend the handler to pass the player giving the orders as a parameter. Easy, but kind of limits the command methods, and will undoubtably yield methods that take a player param only to ignore it.

3. Have a common 'current turn' member of a game object. Hackish, and makes the handling functions need to know what game they're in, which isn't much benefit.

There's a few others floating around, but they're either too off the wall or too risky for me to use for something as important as command handling. I think there's an elegant solution I am merely overlooking either due to ignorance, sleep deprivation, or sheer skillessness; let's hope for sleep deprivation and if not that will at least help make a good design if not nice and elegant.

Amazingly, I found it pretty easy to get coding again after the slight layoff and the SQL debacle this morning. While doing bills, keeping the dog from going nuts and various similar distractions I knocked up a little infrastructure for server side message handling in a mere 2 hours.

I went with option #3, sort of. A little attribute, a little reflection, and bingo! code to automagically collect handlers into a parser (optionally binding the game context). I like that I can now ignore this code and just focus on adding handlers/content. Less room for error.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 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!