Stealth's Music Player: Version 0.1d - UPDATE 12/24 - Page 2

Stealth's Music Player: Version 0.1d - UPDATE 12/24

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Stealth's Music Player: Version 0.1

Post 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.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Stealth's Music Player: Version 0.1

Post 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.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Stealth's Music Player: Version 0.1

Post 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.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Stealth's Music Player: Version 0.1

Post 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.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Stealth's Music Player: Version 0.1

Post 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.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Stealth's Music Player: Version 0.1

Post 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.
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Re: Stealth's Music Player: Version 0.1

Post by REVENGE »

Use widget:unitdamaged.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Stealth's Music Player: Version 0.1

Post 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.
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Re: Stealth's Music Player: Version 0.1

Post 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.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Stealth's Music Player: Version 0.1

Post by AF »

Maybe but it would result in very large changes at the start of the game.
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Re: Stealth's Music Player: Version 0.1

Post 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.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Stealth's Music Player: Version 0.1

Post by AF »

How about if you dgun a mex you've started building in the wrong place?

Well in TA mods yeah your right.
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: Stealth's Music Player: Version 0.1

Post 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
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Stealth's Music Player: Version 0.1

Post by AF »

Of course but we cant expect the end user to behave perfectly
ZellSF
Posts: 1187
Joined: 08 Jul 2006, 19:07

Re: Stealth's Music Player: Version 0.1

Post by ZellSF »

Any chance you might add in a /luaui musicvolume command or something?
User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

Re: Stealth's Music Player: Version 0.1

Post 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
User avatar
Stealth870
Posts: 166
Joined: 13 Sep 2004, 00:25

Re: Stealth's Music Player: Version 0.1

Post 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:
Attachments
snd_musicplayer.lua
1c?
(6.78 KiB) Downloaded 23 times
User avatar
Marmoth
Posts: 63
Joined: 26 Mar 2008, 20:44

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

Post 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.
ZellSF
Posts: 1187
Joined: 08 Jul 2006, 19:07

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

Post 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.
User avatar
Stealth870
Posts: 166
Joined: 13 Sep 2004, 00:25

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

Post 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
Post Reply

Return to “Lua Scripts”