[engine] Run fights in separate threads.

Brainstorm ideas of possible additions to the game. Read this before posting!

Moderator: Forum Moderators

Forum rules
Before posting a new idea, you must read the following:
Locked
User avatar
Xudo
Posts: 563
Joined: April 3rd, 2009, 5:26 pm

[engine] Run fights in separate threads.

Post by Xudo »

Problem. When one unit is involved in the fight against the other, the player must wait until they finish the fight.

Requested feature. When one unit is involved in the fight against the other, player can start other fight.

There is a exception when player want to start fight with one enemy with two units.
  • Solution 1 (easy)
    The units involved in the battle can not attack or be attacked until they have finished the fight.
  • Solution 2 (hard)
    Result of the battle should be calculated before it animation will run.
    If a player engages an enemy in two fights, the engine must take into account the health of the victim as if the first fight was over. Animation of the second battle should be stored in queue and be played directly after first.
User avatar
em3
Posts: 342
Joined: April 1st, 2009, 8:59 pm
Location: Poland

Re: [UI] Run fights in separate threads.

Post by em3 »

This breaks the design principle of BfW, that only one thing happens at a time.

Imagine if in a scenario resolving the first combat would fire an event that would switch allegiance of the second defending unit to allied... or do something else that would make that second attack invalid.
ride on shooting star
User avatar
Xudo
Posts: 563
Joined: April 3rd, 2009, 5:26 pm

Re: [UI] Run fights in separate threads.

Post by Xudo »

All calculations can be done at the beginning of the first fight. The second fight will be operated with the results of the first fight. Engine will just play animation.
shadowblack
Posts: 368
Joined: April 15th, 2010, 3:03 pm

Re: [UI] Run fights in separate threads.

Post by shadowblack »

You know you can increase the game's speed, right? With a high speed both movements and attacks are just a brief blink that lasts less than a second, so you can start a second attack right away.
You are a Dark Adept: You immerse yourself in the dark arts... potentially with great rewards...
User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: [UI] Run fights in separate threads.

Post by Crendgrim »

xudojnik wrote:All calculations can be done at the beginning of the first fight. The second fight will be operated with the results of the first fight. Engine will just play animation.
Imagine the following scenario:
Side 1 attacks a unit of side 2. If he kills it, an event is triggered doing some special stuff (such as switching allies, summoning units, moving units, killing units, ...). There are so many ways the second move could be made invalid; there's just no way to prevent problems. Implementing this idea would mean much, much work both for the developers (who would have to write a lot of issue handling code) and for UMC creators (as it would limit the possibilities of Events, and force UMC authors to think of every possible event sequence – this is just impossible for more complicated scenarios).
Even if you say: "Engine will just play animation" – you still have to keep in mind that units may suddenly appear in the path the second unit of yours just took, thus making this invalid. This would imply that the engine has to take care of this case, and has to prevent that very move to occur. How would you feel if suddenly your unit cannot move anymore over certain hexes? A very bad idea from the UI side.
UMC Story Images — Story images for your campaign!
User avatar
Xudo
Posts: 563
Joined: April 3rd, 2009, 5:26 pm

Re: [UI] Run fights in separate threads.

Post by Xudo »

@Crendgrim
Solution 1.
If there is some tags what will make visible changes or trigger dialogs, engine can act as it is now (=wait). Creation of the "unsafe" tag list is hardly be considered as impossible task. At the beginning, existence of the events related with attack can be considered as "unsafe" (attack, attack end, attacker hits, attacker misses, defender hits, defender misses, last breath, die, advance, post advance). List looks large, but mainline campaigns and MP maps usually contains not much WML. In the further analysis, the list can be modified.
Solution 2.
All WML can run as usual, while units are in fight, but if engine try to store (usually all WML actions with units begin from this) unit, flagged as "in fight", it should stop until the fight ends.

@shadowblack
Problem is not in the speed, but in convenience. I like battle animations, but I should not wait that time.
User avatar
beetlenaut
Developer
Posts: 2814
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: [UI] Run fights in separate threads.

Post by beetlenaut »

The problem is not just about WML that triggers as a result of the current fight. If the user can do other things while a fight goes on, they could cause any event to fire. They can make a move that spawns units, reach the signpost and end the level, move a leader near one of the fighting units, use a custom right-click menu item, or trigger an event that changes the map. Think of all the events that could happen--the scenario author would have to! (Or perhaps the developers would have to.) So, WML could not run as usual while the fight happened. Any action that might trigger WML would have to be forbidden, and that's all of them.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: [UI] Run fights in separate threads.

Post by Crendgrim »

xudojnik wrote:@Crendgrim
Solution 1.
If there is some tags what will make visible changes or trigger dialogs, engine can act as it is now (=wait). Creation of the "unsafe" tag list is hardly be considered as impossible task. At the beginning, existence of the events related with attack can be considered as "unsafe" (attack, attack end, attacker hits, attacker misses, defender hits, defender misses, last breath, die, advance, post advance). List looks large, but mainline campaigns and MP maps usually contains not much WML. In the further analysis, the list can be modified.
Only in addition to what beetlenaut already pointed out: If you do it this way, how is the player supposed to understand when he may do a second move and when not?
UMC Story Images — Story images for your campaign!
User avatar
Xudo
Posts: 563
Joined: April 3rd, 2009, 5:26 pm

Re: [UI] Run fights in separate threads.

Post by Xudo »

Crendgrim wrote:If you do it this way, how is the player supposed to understand when he may do a second move and when not?
How player understands what he can't do move in MP now? He just can't do any move.
User avatar
Iris
Site Administrator
Posts: 6797
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: [UI] Run fights in separate threads.

Post by Iris »

xudojnik wrote:How player understands what he can't do move in MP now? He just can't do any move.
The End Turn button, the Actions menu and most status items are grayed out, and the turn flag changes to reflect the current playing side’s team color.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: [UI] Run fights in separate threads.

Post by Crendgrim »

xudojnik wrote:
Crendgrim wrote:If you do it this way, how is the player supposed to understand when he may do a second move and when not?
How player understands what he can't do move in MP now? He just can't do any move.
That's quite common for turn based games...
UMC Story Images — Story images for your campaign!
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: [engine] Run fights in separate threads.

Post by Gambit »

Too complex. Breaks a lot of things.
Locked