Jump to content

What is a battle? (battle detection)


Recommended Posts

Here is the basic battle detection functionality: https://github.com/zootzoot/0ad/compare/master...battle-detection

It keeps a list of attacks dealt by the player for the past interval milliseconds. When the sum of the damage of all of the attacks divided by the interval (i.e. the damage rate) exceeds a specified threshold, the component registers the player as being in battle.

Link to comment
Share on other sites

Maybe Omri can give some input on how he would prefer the musical side of this worked?

After having tested a few games, I've found that there are bound to be corner cases where the game goes in and out of 'battle state' within a short period of time. This probably has to be masked with a bit of artistry: In the simplest case, we can cross-fade the tracks relatively slowly, so any state changes back and forth won't be too abrupt. In the more advanced case, the rhythm of the battle and peace tracks could be designed to match each other so when one is faded over the other, it sounds like they are part of the same piece. In the even more advanced case, a special 'transition track' could be played while cross-fading.

Edited by zoot
Link to comment
Share on other sites

  • 4 weeks later...

It's just for toggling battle music.

i was read the ticket, if you put a flare/flashing minimap for Skirmish, and a sound alert for for Battle, maybe can use that for radius localization, to avoid all units get a alert if are under attack, but if are closer could be same alert, or same battle, the adius determine if a battle are same than other. that i think is how works in some rts.
Link to comment
Share on other sites

i was read the ticket, if you put a flare/flashing minimap for Skirmish, and a sound alert for for Battle, maybe can use that for radius localization, to avoid all units get a alert if are under attack, but if are closer could be same alert, or same battle, the adius determine if a battle are same than other. that i think is how works in some rts.

That is what the snippet quantumstate posted in #50 does. Battle detection isn't useful for attack notification because it doesn't keep track of the location of the attack.

Edited by zoot
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...