Update the super weapon to play music.
[SOMESW] ; SuperWeaponType
Music.Theme= ; Soundtrack theme ID from thememd.ini (such as GodsendOne)
Music.Duration=0 ; integer, game frames; 0 or below means do not auto-stop,with the game speed set to 4, 15 frames equal 1 second.
Music.AffectedHouses= ; owner|allies|enemies|all (default all)
Music.Themeselects the soundtrack theme by its ID defined inthememd.ini(such asGodsendOne).Music.Durationsets how long to keep playing, in game frames. 0 or below means no auto-stop.- If a different theme is already playing, it will be replaced when the superweapon fires.
- When the timer completes, the theme is stopped only if the currently playing theme still equals the configured
Music.Theme; if music was changed during the countdown, it will not be altered. Music.AffectedHousesdetermines which houses will hear and be affected by the superweapon music on their client:owner,allies,enemies, orall(default). Playback and auto-stop are applied only for those houses.
Perhaps a flag should be added to control which houses will be affected.
where is dll?
Nightly build for this pull request:
- compiled-dll-5085c06c59319ac2ffb1dc996393e3f6d454cfd8.zip These artifacts will expire in 90 days and will not be available for download after that time.
This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.
Should add docs in
CREDITS.md
done
I accidentally synced with the latest branch, but it should be restored now.
I'm not sure if Music.Duration is a reasonable design. It can easily be interrupted by Esc screen, which will make the theme always play regardless of duration unless getting back to the game, and you can also switch music there. But on the other hand, it adds another per frame check which needs to loop check all houses' owned SWs which is bad for performance. Personally I would like to remove this tag and the related logic, but I'd like to hear if others have such demand
I'm not sure if
Music.Durationis a reasonable design. It can easily be interrupted by Esc screen, which will make the theme always play regardless of duration unless getting back to the game, and you can also switch music there. But on the other hand, it adds another per frame check which needs to loop check all houses' owned SWs which is bad for performance. Personally I would like to remove this tag and the related logic, but I'd like to hear if others have such demand
I am making a small mod myself, and I really need this feature.
If we're keeping this feature then it'd better be done in a way like AutoDeath and TransportReloader, which is making a global vector to store the superweapon entity and only iterate it instead of looping all houses + all SWs. That would require a proper InvalidatePointer modification tho
Another idea is to only store a timer in HouseExt, which will be set once such SW is fired, and checking if it's completed in the same hook for music reset. This could at least decrease the complexity of checking every SW. It'll change the behavior a bit tho: if the original superweapon is gone (by building destruction or such), the music will still be reset once the time meets
I'm not sure if
Music.Durationis a reasonable design. It can easily be interrupted by Esc screen, which will make the theme always play regardless of duration unless getting back to the game, and you can also switch music there. But on the other hand, it adds another per frame check which needs to loop check all houses' owned SWs which is bad for performance. Personally I would like to remove this tag and the related logic, but I'd like to hear if others have such demand
In my opinion, this feature is somewhat "arbitrary". To me it sounds like there should be a basic dynamic music system, with ability to designate idle/combat/special event tracks, and this should be a part of it.
maybe Music.AffectedHouses could use (owner/self|allies/ally|team|enemies/enemy|all) , just like other features whitch affect houses. At least, team is different from ally.
and when [SWA] Music.Theme=MUSICA SW.next=SWB [SWB] Music.Theme=MUSICB , it plays MUSICA when use SWA. I dont know if its expected.
I'm not sure if
Music.Durationis a reasonable design. It can easily be interrupted by Esc screen, which will make the theme always play regardless of duration unless getting back to the game, and you can also switch music there.
I don't think it matters. Some maps in StarCraft 2 have similar designs. As far as I know, no one thinks this is a problem that needs attention.
But on the other hand, it adds another per frame check which needs to loop check all houses' owned SWs which is bad for performance. Personally I would like to remove this tag and the related logic, but I'd like to hear if others have such demand
If you are worried about performance, we can add the affected HouseClass to an additional vector of ScenarioExt and then loop through that vector. Also, HouseClass::Array is a relatively small array. I guess looping through it shouldn't incur much additional overhead.
Since this PR is marked as "Needs rework" without a conclusion, I would like to provide a summary of the current situation. What the author @ahasasjeb needs to do:
- Add a tracker to track all the SW that affects the BGM to avoid redundant iterations.
- Add the Getter for BGM and the signal property of
ShouldRecheckBGMto ensure scalability. @Metadorius @Coronia Can you confirm the above conclusions or point out any matters that have not been addressed?
I'm not sure if a list is needed, given there's only one music which can be played at once, and making different SWs (and more sources in the future perhaps) temporarily change music in the same time would just make it very messy. Hence, my suggestion would be simpler:
- add a timer for HouseExt, which will be set to tick whenever a music switch with duration happens
- if the timer is ended, it'll trigger the music switchback
- if another music event occurs, it'll reset timer to the new duration, or stop it if it doesn't have a duration
in this case it's easier to understand and implement, less messy and perf costy, and can better interact with other (potential) music playing methods instead of coupling with SW, making a whole dynamic music system as @Metadorius proposed
- trigger action 20 Play Theme, which could have a param to decide its duration
- play music when receive damage and killing enemies like RA3 did
and to achieve this system, it would be better to extract the music display part to a standalone function, so it can be called by SW and different sources for reusability