Page 2 of 2

Re: Gadget: player has taken the lead with xxx kills

Posted: 21 Aug 2011, 08:12
by msafwan
You can count enemy unit death with metal wreckage. New wreck = new unit death, so filter wreck with 'allyID' to yield enemy unit death. Here's an implementation:
http://springfiles.com/spring/lua-scrip ... myallyself

For message broadcast (eg: "player A has taken lead!!") each widget could be modified to communicate with opposite team's widget to sync its value/correct-deviation... (much like how allyCursor widget communicate with each other). This ensure the value are same across player...

Re: Gadget: player has taken the lead with xxx kills

Posted: 21 Aug 2011, 14:21
by SirMaverick
msafwan wrote:You can count enemy unit death with metal wreckage. New wreck = new unit death, so filter wreck with 'allyID' to yield enemy unit death.
2 Problems:
Not all mods have visible wrecks. Wrecks can be made only visible if inside LOS.
Not all dead units leave a wreckage.

Re: Gadget: player has taken the lead with xxx kills

Posted: 21 Aug 2011, 14:24
by knorke
gadget to count the kills, widget for display.
i think everything else is just messing around...

Re: Gadget: player has taken the lead with xxx kills

Posted: 22 Aug 2011, 16:47
by Jools
Yes, the problem with a widget counting the kills is also that it gets reset when LuauI is reloaded, and some people do that sometimes.

Ofc there's also the spring internal method of getting kills/losses:

Code: Select all

Spring.GetTeamUnitStats(TeamID)
But I don't recommend using that method, it doesn't count all kills, it counts kills of cancelled and unfinished units and it counts it as a loss when you place a dragon teeth for instance.

So the gadget that counts kills works well, but the widget side needs to be adjusted. But how does a widget and gadget communicate with each other? They need to be in the same file?

Re: Gadget: player has taken the lead with xxx kills

Posted: 22 Aug 2011, 16:52
by Jools
msafwan wrote:You can count enemy unit death with metal wreckage. New wreck = new unit death, so filter wreck with 'allyID' to yield enemy unit death.
Interesting: so there is information in the wrecks about what player it belonged to?

This could still be interesting to my statistics widget. It is an widget so it doesnt have information on enemy deaths, but as you become spectator it fills up that information. Maybe using this widget could be more reliable that asking spring for a start value of a players deaths and kills (when you become spec or reload luaui).

Or even better, since the killcount isnt the best measure of efficiency, I'm trying to replace it with a killed-hp count, the maximum healt points of the units you have killed. Maybe this could come in handy there. killed-hp isnt a perfect measure either, but it's better than just kills or dealt damage imo.

Re: Gadget: player has taken the lead with xxx kills

Posted: 22 Aug 2011, 19:22
by smoth
Also wreck steps are skipped if the damage is high enough.

Re: Gadget: player has taken the lead with xxx kills

Posted: 23 Aug 2011, 01:18
by knorke
But how does a widget and gadget communicate with each other?
Spring.SendLuaUIMsg
this is about something else but same technic:
http://answers.springlobby.info/questio ... t-scorebox

Re: Gadget: player has taken the lead with xxx kills

Posted: 24 Aug 2011, 15:43
by Jools
There's another way to do this also: use the UnitLeftLOS/Radar callins. If the unit disappeared ( unit position is nil) but it didnt leave radar or los, then it died.

But using a gadget and UnitDestroyed is probably best way still. However, does it catch indirect kills? I mean if I have 50 crawling bombs and someone kills one of them so that the others explode too?

Re: Gadget: player has taken the lead with xxx kills

Posted: 24 Aug 2011, 20:26
by knorke
Jools wrote:There's another way to do this also: use the UnitLeftLOS/Radar callins. If the unit disappeared ( unit position is nil) but it didnt leave radar or los, then it died.
what happens on entering jammer, entering water, being transported, morphing?

But using a gadget and UnitDestroyed is probably best way still.
yup.
However, does it catch indirect kills? I mean if I have 50 crawling bombs and someone kills one of them so that the others explode too?
it gives you attackerID...
But yea, needs filtering ie if the unit was complete or just a construction that got destroyed or canceled.
I think dragonteeth trigger UnitDestroyed too etc

Re: Gadget: player has taken the lead with xxx kills

Posted: 24 Aug 2011, 21:43
by Jools
knorke wrote:what happens on entering jammer, entering water, being transported, morphing?
If jammed then spring will call UnitLeftLOS or -Radar, depending on where is was visible. Not sure about the others. When morphed the unit essentially dies and gets replaced by the morphed unit (new unitID).
it gives you attackerID...
But is the attackerID the enemy or one of the chain exploded bombs?

Re: Gadget: player has taken the lead with xxx kills

Posted: 06 Sep 2011, 16:12
by smoth
added a scoring system to grts this weekend. I have added the relevant parts of your kill tracking to it. why are you checking if a unit is completed or not before kill?

Re: Gadget: player has taken the lead with xxx kills

Posted: 06 Sep 2011, 16:18
by knorke
why are you checking if a unit is completed or not before kill?
1% build unit gets destroyed -> counts as kill
canceling build process -> counts as kill
reclaiming a nano frame -> counts as kill
etc

Re: Gadget: player has taken the lead with xxx kills

Posted: 06 Sep 2011, 17:09
by Jools
It seems we need to have a discussion about what is a kill, I didn't think there would be several views about it. Obviously, I don't think those things you mentioned are really kills.

If a tank is, say 1% complete, it's not really a tank yet, and it has no personnel, so if someone bombs it, how can that be counted as a kill? It also has no ability to defend itself (dunno if that's something we should consider).

If a planned construction is cancelled, then that's not a kill. There is no-one killing it. Same thing if something is reclaimed, then it 's reclaimed, not killed.

To me a kill happens when a unit gets destroyed in combat, be it either a military or a civilian one (although spring doesnt distiguish). But this debate is also higly philosophic, basically we need to decide when a unit is a unit. Maybe we can borrow some arguments from the abortion debate:)

Re: Gadget: player has taken the lead with xxx kills

Posted: 06 Sep 2011, 19:01
by smoth
Canceled counts as a kill lol that is fukt up..

So what if it was aborted(killed in the factory)instead of miscarried(canceled)?

Seriously why is that a unit destroyed?

Re: Gadget: player has taken the lead with xxx kills

Posted: 06 Sep 2011, 21:31
by zwzsg
How is unnit formed?

Re: Gadget: player has taken the lead with xxx kills

Posted: 06 Sep 2011, 21:35
by Jools
Anyway, killed units is not the best measure of a player's success. I've started to use "killed hp" instead in my other widget, which means weighting the number of kills by the hp the unit has as 100% full health.

It's not perfect, but I think it's better than just "kills" or "damage dealt".

Re: Gadget: player has taken the lead with xxx kills

Posted: 07 Sep 2011, 01:32
by smoth
I like kills though and plan on having that and damage dealt recorded. hell i want to record what you kill and how many, store it locally etc.

have all of it on a lol style leaderboard CUZ I CAN. etc.

Re: Gadget: player has taken the lead with xxx kills

Posted: 07 Sep 2011, 23:41
by Jools
That's a nice idea, will be interesting so see how you lay it out graphically. Still, one life is also 1 life so kills is still a good way to count it. Or, whatever way you do it it's not gonna be perfect, because it's not better to kill 20 pyros than 1 goliath, for instance.

Here's how I formatted my kill stats:

Image

Re: Gadget: player has taken the lead with xxx kills

Posted: 08 Nov 2011, 17:23
by zwzsg
I updated a little my gadget:
- Not counting spectator as players anymore
- Printing faction name as well
- Printing "AI" instead of "" for external AI. But reading the proper AI shortName would require a gadget<->widget communication, making the whole thing a bit more complex than just a gadget.

Edit: Thanks to [BoS]nixtux for telling me about a bug that made it crash when playing against AI.

Re: Gadget: player has taken the lead with xxx kills

Posted: 12 Jul 2012, 14:44
by smoth
bump for knuckleheads in ba subforum.