Necromantion Workings : The Engine (1)

The Main Interface


The main question when starting a game is how to distribute the functionality, as otherwise the code can go really messy really fast. My solution was as follows:

The whole game is decomposed into several Engines. However, they are not arranged in quite the way one would expect. Each Engine is primarily concerned with a specific part of the UI screen's management. There are mainly three classes that implement this interface : 
  1. GameEngine
  2. HUDEngine
  3. MessageEngine
I will brief about what each of them does here, but will write separate articles for each. Now, to begin with, what is the Engine class all about? Well, it defines the following properties
  • offsetX
  • offsetY
  • length
  • breadth
Now, I should mention here only that this is a grid based game. So, all these values basically store the grid number. When drawing on the actual screen, the objects are magnified by a constant factor which I will mention later.

Now, these four variables allow us to know exactly where each Engine should render itself. Each of them are only aware of the part of the screen they have got. Suffice to say, it helps in the rendering process.

To elaborate on what the subclasses actually do,
  • GameEngine : This is by far the most important component as it controls the entire game mechanics. It is responible for both the updation and rendering of the game environment.
  • HUDEngine : This is responible for showing the stats of the player. The Heads Up Display part.
  • MessageEngine : This is resposible for printing out any messages to the user, which are related to the gameplay.
This is just a really brief description. Insignificant. And as it is pretty apparent, the first is the most important by far. And it is. The thing is, I divided it into these engines to split up the screen and help in the rendering.


















Comments

Popular posts from this blog

Small-to-Large

Segment Tree Beats - An introduction

Getting prepared for RMO