Engine Design – Input Commands

Command

I’m currently working on my own game engine and while it’s no where near from being finished, I’ve applied a couple of design patterns when creating the different systems. In the coming weeks I’ll go through a system each at a time and write about how I have implemented them and what problems I might have stumbled upon.


This week’s system is the input system which enables the player, may it be everything from a tank to a warrior with an axe, to move and perform all their desired actions.

When first starting on the development of the input system i set out two goals which needed to be met in order for it to be a successful implementation.

  • First, all actions needed to be rebindable, players should not be forced to use a specific layout. Forced mapping layouts cause trouble when users don’t have that particular region layout on their keyboard and it certainly makes it difficult for physically disabled persons to enjoy a great game.
  • Second, when checking whether an action should be called there should be a simple way of doing so. An easy to use interface which is as simple as an if statement.

The current solution works like this.
Continue reading