soundmud / soundrts

A real-time strategy audio game
http://jlpo.free.fr/soundrts
Other
44 stars 31 forks source link

Attack attribute broken in style #148

Open SavagingSky opened 1 year ago

SavagingSky commented 1 year ago

It seems that the attack attribute in style.txt is broken. When specyfying custom attack sounds for a unit, that is when an enemy is seen, not when the attack launches, they don't play. I tried: attack 15001 15002 attack if_me 15001 else 15002 attack 15001 but never got any sound from the unit when encountering enemies. This is 1.3.6.

SavagingSky commented 1 year ago

It seems I know the solution. I tested on 1.2 a9, it works. Then I compared two branches. Seems in worldunit in choose_enemy function, previously, when setting action to attack_action there was notify(attack), now it's gone.

soundmud commented 1 year ago

Yes, thanks for the report and sorry for the trouble. I removed this notification because if there was many units it could be too much, and maybe it was slowing down the game. But this notification was useful and gave character to the units, so maybe just limiting the number of notifications would be better.

SavagingSky commented 1 year ago

the main slowdown happens when there is too much units. It gets worse when they start moving and or attacking. Indeed, limiting the number of notifications is a solution, but I think you should prioritise optimising how units are handled, there updates so as to avoid slowdown with big armies. And, btw, thank you for the game. Playing it for several years since my childhood. Hope you will keep up the great work!15:39, 7 апреля 2023 г., soundmud @.***>: Yes, thanks for the report and sorry for the trouble. I removed this notification because if there was many units it could be too much, and maybe it was slowing down the game. But this notification was useful and gave character to the units, so maybe just limiting the number of notifications would be better.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***> -- Отправлено из мобильного приложения Яндекс Почты

soundmud commented 1 year ago

I'll try to restore it. Here is a first step:

In worldunit.py replace:

        self.action = AttackAction(self, reachable_enemies[0])

with:

        # don't notify or attack if already attacking the same target
        # (at the moment, this test is necessary if the target is not a menace, for example a farm)
        if not isinstance(self.action, AttackAction) or self.action.target != reachable_enemies[0]:
            self.action = AttackAction(self, reachable_enemies[0])
            self.notify("attack")
        return True
SavagingSky commented 1 year ago

The most sad thing is i'm not a python programmer, heh. I don't have anything python related on my computer. I have a hard time with python in general, so yeah.

soundmud commented 1 year ago

don't worry, this change will be included in the next version

sanslash332 commented 1 year ago

Hello guys 😊

Maybe soundmud a Good approach to this issue is take in mind a small cooldown for active the attack trigger for a same group in a scare.

For example, if you habe various units in a scare, and all of them start the attack,just play the sound for the… I don’t know, the first 5 most important units (higher tier or most numeric more important) and if in less than 5 seconds (or can be setteable per user in the settings) more attack events are triggered on the same sqare, the sound system ignore it until the cooldown time for that event ends. 😊

Just a small suggestion 😊

But try to keep that alert, is useful to customize the units on big mods with a lot of units and races 😊 its awesome.

From: soundmud @.> Sent: Friday, April 7, 2023 7:19 AM To: soundmud/soundrts @.> Cc: Subscribed @.***> Subject: Re: [soundmud/soundrts] Attack attribute broken in style (Issue #148)

don't worry, this change will be included in the next version

— Reply to this email directly, view it on GitHub https://github.com/soundmud/soundrts/issues/148#issuecomment-1500198284 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHZUG7XQQQBB2FUVISXOHTW77Z3BANCNFSM6AAAAAAWWG65YA . You are receiving this because you are subscribed to this thread. https://github.com/notifications/beacon/AAHZUG3X7BUSFUEFJQLMHYLW77Z3BA5CNFSM6AAAAAAWWG65YCWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSZNM2YY.gif Message ID: @. @.> >

soundmud commented 1 year ago

yes, this kind of mechanism will be necessary