On multi-threading

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. 

8,896 views 4 replies
Reply #1 Top

I really appreciate this suggestion. 

Unfortunately, even events, as you imagine them, are handled asynchronously.   That nature becomes really noticeable when you have an event come up and another event interupts that event.  That's something we're working hard on addressing and it's definitely a non-trivial solution.

There are actually events right now caled Event_Battle, Event_Treasure (similar to chest), and a whole series of events tied to quests (Event_Objective_Met, Event_Objective_Initiated, etc.).

The entire game is very event driven, arguably too event driven.

It all stems back to a decision made a long time ago:  Quick turn times versus definitive game states.

Right now, certain events are tagged as being notification events which go to the Shafer button.  

But what most people don't realize is just how many things are going on in the background.  Pathfinding, combat rating updates, etc. These are all aysnc from your actual "turn".  

Next time you load up say Civilization V or Civilization BE, note that they have a lot fewer units running around than we do and note the turn time differences.  I'm only bringing them up because we're pretty good friends with the team there and have discussed the pros and cons of our two systems at length.  

The bottom line is that there's no free lunch. ;)

 

Reply #2 Top

I am sorry but I do not think you understood me at all. 

 

Right now I can play game in two ways:

1) I can go to my first army by selecting it manually, move it, fight the battles, do quests etc. Once I finished with an army, I go select the second one and I do want I want. Then the third and so on. Once I am sure I did everything i click end of turn. This method does not cause any bugs to show up. 

2) I just click "end of turn" and all the armies will be moved to their pre-planned destination. Now this leads to bugs, b/c suddenly - after ending my turn - I am dealing with many events at once. 

So my solution is to force player to play the first way and make it also smooth. 

What does it have to do with asynchronization?? 

Reply #3 Top

Sorry,  I don't mean to be thick.  

The reason it would't solve the problem is because the game itself is asynchronous.  Even if you're specifically going from 1 unit to another like you describe -- this is assumign we are talking about save game syncing issues.

Now, with regards to units moving and losing their turns when they get to a destination, we are in the process of implemetngin a new system in which there is a game phase where units auto move and THEN it checks to see if any are idle.

 

Reply #4 Top

No, I am not talking about saving at all.

I am talking about actually playing the game and what happens if you click "end of turn".