Multi-thread problem
Right now, due to the fact that the game is using multi-threading the actual “state” or situation in a game is hard to pin. When, for instance, the end of turn is triggered all the armies moved and if there is number of things happening (battles, chests, quests) then there is confusion – various pop-up attack the player in random order, and it creates a feeling of being lost. It leads also to bugs: double tile occupancy, or not triggering events.
Solution
We have already solution build into the system. We have, what I call, “events”, that is, occurrences that once triggered cannot be ignored but demand immediate response from a player. Those are: battles, chests, and quests. On the other hand we have “situation”, which include those occurrences which demand player’s response, but not immediately. Those are: idle units, idle city, research.
My proposal is to introduce new situations, namely, “battle”, “chest” or “quest” which in turn when activated will trigger corresponding events. It means that those events will not happen all simultaneously, and then presented in order or disorder to the player, but instead will be happening one by one.
How does it look in the practice?
The player hits “End of turn” button. Five of his armies are moved. Two armies engage in battles, one gets chest, another one gets quest, and one ends his movement and still have some spare movement points. Following situations are generated: battle, battle, chest, quest, idle unit. Now, the end of turn is cancelled (it only happens if there are no situations). The name of the end turn button now show “BATTLE!”. If the tab is pressed or the button is clicked the event battle is triggered – the map focuses on where the battle takes place, and the player has to fight and solve the battle
Once the battle is fought, the end of turn button still shows “BATTLE!” caption – b/c there are two battle to be fought. Once the battle is solved, then we have “CHEST!” caption on the end of turn button. Once the chest is opened, and reward is taken we will have “QUEST!” as a caption and then event of activating the quest. The final situation to be solved is “IDLE UNIT”. Then the name of the end of turn button takes the caption “END OF TURN” and the process is repeated (armies are moved, idle units are checked). If no new situation happens then the end of turn follows.
Two things have to be remembered:
- Events can be triggered manually, not only through “TAB” or the end of turn button. It means that the players army can be found on the map and then if selected the event will be triggered immediately (e.g. battle will be fought). Also if the player clicks on the bar with the units, and if a unit is involved in situation then the event will be triggered (battle, chest etc.) It would imply also that the army will be shown on the same tile as enemy/chest/quest but triggering will happen through selecting/tab/end of turn button.
- To avoid very rare bug – when the army while moved automatically enters the chest and situation “CHEST!” is created, the attribute of the tile where it stands should be changed to “impassable”. After event is triggered and solved, the attribute can be removed. It is to avoid the situation when two player’s armies can end up on the chest tile, or quest, or enemy.