Stealth's Music Player: Version 0.1d - UPDATE 12/24
Moderator: Moderators
Re: Stealth's Music Player: Version 0.1
But the DPS Widget's just handling stuff on-screen, isn't it? Not the entire world?
At any rate, I think it'd be a lot simpler to just construct a table, store deaths-per-team, and compare them between teams and the current state (in combat, or not) and execute the logic accordingly. But meh, do whatever floats your boat. I've just learned to be very, very careful about searches that large, they tend to pile up in terms of load in a real hurry, even if you schedule them infrequently.
At any rate, I think it'd be a lot simpler to just construct a table, store deaths-per-team, and compare them between teams and the current state (in combat, or not) and execute the logic accordingly. But meh, do whatever floats your boat. I've just learned to be very, very careful about searches that large, they tend to pile up in terms of load in a real hurry, even if you schedule them infrequently.
Re: Stealth's Music Player: Version 0.1
Well, franky, you're better at other things than algorithm design. Now, about optimizing this code. Remember that it has to run with a gadget component to see the whole map; widget-only is restricted to your view. As a gadget you can hook unitcreated for everything. A widget can hook unitcreated for your team and get the rather small list of visible units for the enemy team to run through.
Re: Stealth's Music Player: Version 0.1
That's not actually solving the problem as requested, though.
What matters, from a game-design POV, is whether you're winning or losing.
The only really good way to determine this is according to deaths, or you'd get "winning" music for desperately spamming some cheap unit when going down in flames (like, I dunno, IW's infantry, unless they made them cost like tanks), which would be a bit silly.
Better yet, key onto specific deaths that have strategic implications- the loss of a building could be weighted higher than a tank, a tank higher than a soldier, etc. But doing it with raw health is bizarre, wasteful, and ultimately a bad indicator of what's actually happening, imo.
What matters, from a game-design POV, is whether you're winning or losing.
The only really good way to determine this is according to deaths, or you'd get "winning" music for desperately spamming some cheap unit when going down in flames (like, I dunno, IW's infantry, unless they made them cost like tanks), which would be a bit silly.
Better yet, key onto specific deaths that have strategic implications- the loss of a building could be weighted higher than a tank, a tank higher than a soldier, etc. But doing it with raw health is bizarre, wasteful, and ultimately a bad indicator of what's actually happening, imo.
Re: Stealth's Music Player: Version 0.1
No, because they would take heavy damage and do very little damage.Argh wrote:The only really good way to determine this is according to deaths, or you'd get "winning" music for desperately spamming some cheap unit when going down in flames
Re: Stealth's Music Player: Version 0.1
That's an interesting assumption, but doesn't actually resemble typical game designNo, because they would take heavy damage and do very little damage.

For example, my infantry in P.U.R.E. do lots of damage for their cost, and take hardly anything to kill. You'd get a "victory" from them constantly, if you skewed things that way, even if they were losing units like crazy- they'd look great, in terms of a "trade". An UltraAssault, charging infantry and killing them all, would register as a "loss" for the Overmind player, under that logic, even though the strategic objective has been achieved- the Resistance no longer owns that hill

In short... no RTS worth playing is purely about trading hitpoints.
Last time I saw IW's balance (admittedly awhile ago) infantry worked in a similar fashion- they were usually DPS-weighted for cost. And with Lua, they may have some other ability that doesn't show up as health (see: HeavyTroopers) or other things going on that make trading hitpoints pretty meaningless, frankly.
At any rate <shrugs> do whatever, it's all good. I just don't think that that's the right way to approach this, but it's all academic to me, as I'm not using this code anyhow.
Re: Stealth's Music Player: Version 0.1
Not how it's seemed to me in IW so far, but it's easy to add a bonus per unit death, maybe within an order of magnitude of 500. HP should have some effect lest attacking heavy units with light units always count as a defeat.
Re: Stealth's Music Player: Version 0.1
Use widget:unitdamaged.
Re: Stealth's Music Player: Version 0.1
I initially worked based on unitdeaths for my groupAI and found that sometimes reclaiming things or canceling build orders would start off the music, and I had to program against it. Be wary of this. Admittedly I was constrained by the groupAI interface.
-
- Imperial Winter Developer
- Posts: 3742
- Joined: 24 Aug 2004, 08:59
Re: Stealth's Music Player: Version 0.1
That's why I suggested a ratio of HP to total HP on the map, because that would be a consistent ratio of gain/losses relative to overall HP, irrespective of map size / state of the game, etc. Where a few skirmishes early on might be extremely significant, and demand battle music (seeing as they're a major percentage of total units in-game, even if it's just a few), a few units mixing it up in the mid-late game could be really minimal on a large scale system where for the most part people are just shadowboxing. So using friendlyHPchange/totalHP, the former would start the battle music while the latter would start the tension music only, despite the same amount of units being killed.
Re: Stealth's Music Player: Version 0.1
Maybe but it would result in very large changes at the start of the game.
-
- Imperial Winter Developer
- Posts: 3742
- Joined: 24 Aug 2004, 08:59
Re: Stealth's Music Player: Version 0.1
Possibly, but I think that in most games the existence of the commander as a big hunk of HP would prevent that, as well as the fact that first contact isn't necessarily made (atleast in IW) in the first 30 seconds of the game, by which time you've already got factories and such to buff out the relative HP.
Re: Stealth's Music Player: Version 0.1
How about if you dgun a mex you've started building in the wrong place?
Well in TA mods yeah your right.
Well in TA mods yeah your right.
Re: Stealth's Music Player: Version 0.1
reclaiming is better :DAF wrote:How about if you dgun a mex you've started building in the wrong place?
Well in TA mods yeah your right.
Re: Stealth's Music Player: Version 0.1
Of course but we cant expect the end user to behave perfectly
Re: Stealth's Music Player: Version 0.1
Any chance you might add in a /luaui musicvolume command or something?
- TheFatController
- Balanced Annihilation Developer
- Posts: 1177
- Joined: 10 Dec 2006, 18:46
Re: Stealth's Music Player: Version 0.1
Entire world, so when you're zooming around the map the numbers will be there waiting for you :pArgh wrote:But the DPS Widget's just handling stuff on-screen, isn't it? Not the entire world?
- Stealth870
- Posts: 166
- Joined: 13 Sep 2004, 00:25
Re: Stealth's Music Player: Version 0.1
Aaaanyway, getting back to my widget:
Just a small update, now that I'm finishing my finals I will have more time to practice my Lua. For now I added the simple "My Team" detection so it doesn't play when *any* unit is under, just yours. Also added some commands, songstop and songtime which you'll probably never use. I'm trying to figure out how to take the argument from a command and use it as a variable for that song volume command, which I will add. Fixed a problem with the starting music now continuing unless you were attacked by the time the first song ended, aaaaand still trying to figure out how to fix that battle music replaying.
Just a small update, now that I'm finishing my finals I will have more time to practice my Lua. For now I added the simple "My Team" detection so it doesn't play when *any* unit is under, just yours. Also added some commands, songstop and songtime which you'll probably never use. I'm trying to figure out how to take the argument from a command and use it as a variable for that song volume command, which I will add. Fixed a problem with the starting music now continuing unless you were attacked by the time the first song ended, aaaaand still trying to figure out how to fix that battle music replaying.

- Attachments
-
- snd_musicplayer.lua
- 1c?
- (6.78 KiB) Downloaded 23 times
Re: Stealth's Music Player: Version 0.1c - UPDATE 11/17
Nice job!
Just my penny about music stuff:
1. I think comparing "damages done" with total "HP" is quite important since a very little damage in the first raid could mean bad defeat when the same amount in late game could be just a couple of spy being caught. I think battle music should start in the first case, but not in the second. (The reference should be the lowest Teamside HP unless you want to put different music for teamside in superiority/inferiority).
2. To compute victory / defeat and stuff (and all triggers in general), i think HP is a bad reference. If two small (BA/CA) tanks kill a sniper, one of those being killed, the sniper's team will get the victory because sniper has very low HP and high damage. Imo, calculations should be based on cost.
3. To avoid having to search all the tables, there could be a simple counter updated each time a unit spawns or die. Perhaps only dying units should be taken into account.
4. Some ideas about situations that could have their own music:
- Sudden high damage (com kill / nuke)
- Long damaging period (Verdun style battle)
- Battle preparation (% of mobile military units (in cost) according to total)
- Early situations with few units could have a simpler sound than the huge battles at the end.
Just my penny about music stuff:
1. I think comparing "damages done" with total "HP" is quite important since a very little damage in the first raid could mean bad defeat when the same amount in late game could be just a couple of spy being caught. I think battle music should start in the first case, but not in the second. (The reference should be the lowest Teamside HP unless you want to put different music for teamside in superiority/inferiority).
2. To compute victory / defeat and stuff (and all triggers in general), i think HP is a bad reference. If two small (BA/CA) tanks kill a sniper, one of those being killed, the sniper's team will get the victory because sniper has very low HP and high damage. Imo, calculations should be based on cost.
3. To avoid having to search all the tables, there could be a simple counter updated each time a unit spawns or die. Perhaps only dying units should be taken into account.
4. Some ideas about situations that could have their own music:
- Sudden high damage (com kill / nuke)
- Long damaging period (Verdun style battle)
- Battle preparation (% of mobile military units (in cost) according to total)
- Early situations with few units could have a simpler sound than the huge battles at the end.
Re: Stealth's Music Player: Version 0.1c - UPDATE 11/17
This widget has a pretty annoying bug I'm not sure if you know about: when no game time passes (for example when paused or before the game starts) the music keeps repeating 5 seconds over and over. Very annoying.
- Stealth870
- Posts: 166
- Joined: 13 Sep 2004, 00:25
Re: Stealth's Music Player: Version 0.1c - UPDATE 11/17
Hmm. Ok, I'll look into this. I'm sure I can make it start as soon as game starts, but I wonder if I can even pause the music properly. 
