Strategy game tools are provided by the lionengine-game-strategy
module, giving an oriented strategy game
type development with specific classes and architecture.
In this section we will see how to use these main tools, and the way of we should use them.
The game cursor in an strategy game is the only one object that allow to control both the game panel and the map interaction, such as unit clicking. It is relative to the camera view and position.
It is highly recommended to understand first how is working the map system !
Theses are the minimal required class to setup the map tile. Will be completed in next examples.
As you can see, we can simply retrieve a tile from the map by using the current cursor location relative to the camera position, and then display what we want.
You can now see how is working the cursor, and the way of retrieving tile data from the map.
The control panel will allow us to change the entities states by clicking on them and assigning orders. The handler will apply the updates by listening to the control panel.
Theses are the minimal required class to setup the map tile. Will be completed in next examples.
This will allow us to create some entity for the example.
The handler will listen to the control panel in order to know what is selected. Entity states will be updated here.
You can now see the full process for entity selection and global control.
The ability represents what an entity can do. It could be moving, attacking, producing, and even more. They can be combined in any way.
Weapons are using a special class called WeaponModel
, as it add a dedicated routine for attack
handling. A weapon can be a simple damage representation, or a projectile launcher, and even more.
In this package you will find the classic factory & handler system, and also the ability implementation by the different entity types.
You can now see the different abilities in action. It is possible to combine any of them, as it is working by interface & delegation.
Skill represents entity action, triggered by the player from the control panel. There is a strong link between skills and ability.
If you look at the concreted skill implementation, we only focus on the action
function, which is
called when the skill is triggered from the control panel.
This will allow us to change the cursor image, depending of what we are doing on the control panel.
Skills are now simply added with an add
function.
You can see the skill system in action, and how it is working with the control panel.
The fog of war may not be the most important part of a game, but it may add much more challenge to the way of playing it. It still a very important gameplay part of any game development.
Yes, this is as simple as this.
And here we go with the last example, and maybe the simplest one ! You can now see the fog of war in action, depending of the entity location and map discovering state.
Read next page: Network games