Page 2 of 3

Re: Stealth's Music Player: Version 0.1

Posted: 05 Nov 2008, 03:47
by Argh
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.

Re: Stealth's Music Player: Version 0.1

Posted: 05 Nov 2008, 03:54
by lurker
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

Posted: 05 Nov 2008, 04:02
by Argh
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.

Re: Stealth's Music Player: Version 0.1

Posted: 05 Nov 2008, 04:04
by lurker
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
No, because they would take heavy damage and do very little damage.

Re: Stealth's Music Player: Version 0.1

Posted: 05 Nov 2008, 04:13
by Argh
No, because they would take heavy damage and do very little damage.
That's an interesting assumption, but doesn't actually resemble typical game design ;)

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

Posted: 05 Nov 2008, 04:21
by lurker
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

Posted: 05 Nov 2008, 06:30
by REVENGE
Use widget:unitdamaged.

Re: Stealth's Music Player: Version 0.1

Posted: 05 Nov 2008, 11:43
by AF
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.

Re: Stealth's Music Player: Version 0.1

Posted: 05 Nov 2008, 14:28
by Warlord Zsinj
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

Posted: 05 Nov 2008, 17:00
by AF
Maybe but it would result in very large changes at the start of the game.

Re: Stealth's Music Player: Version 0.1

Posted: 05 Nov 2008, 23:40
by Warlord Zsinj
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

Posted: 06 Nov 2008, 12:27
by AF
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

Posted: 07 Nov 2008, 08:27
by manolo_
AF wrote:How about if you dgun a mex you've started building in the wrong place?

Well in TA mods yeah your right.
reclaiming is better :D

Re: Stealth's Music Player: Version 0.1

Posted: 07 Nov 2008, 16:06
by AF
Of course but we cant expect the end user to behave perfectly

Re: Stealth's Music Player: Version 0.1

Posted: 16 Nov 2008, 03:06
by ZellSF
Any chance you might add in a /luaui musicvolume command or something?

Re: Stealth's Music Player: Version 0.1

Posted: 16 Nov 2008, 12:15
by TheFatController
Argh wrote:But the DPS Widget's just handling stuff on-screen, isn't it? Not the entire world?
Entire world, so when you're zooming around the map the numbers will be there waiting for you :p

Re: Stealth's Music Player: Version 0.1

Posted: 18 Nov 2008, 02:02
by Stealth870
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. :mrgreen:

Re: Stealth's Music Player: Version 0.1c - UPDATE 11/17

Posted: 19 Nov 2008, 11:30
by Marmoth
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.

Re: Stealth's Music Player: Version 0.1c - UPDATE 11/17

Posted: 21 Dec 2008, 18:49
by ZellSF
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.

Re: Stealth's Music Player: Version 0.1c - UPDATE 11/17

Posted: 22 Dec 2008, 16:00
by Stealth870
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. :P