Add the bounty logic.

Bug #894884 reported by pd
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ares
Wishlist
Unassigned

Bug Description

Receive credits for killing enemy units.

Revision history for this message
Marshall (m-edward) wrote :

In addition, please can an option be included to restrict which units can receive Bounty.

Some flag examples:

[AudioVisual]
BountyAnim=PILLAGE

[DYINGUNIT]
GivesBountyMin=1
GivesBountyMax=10

[KILLINGUNIT1]
CanGetBounty=yes
CanGetBountyFromFriendlies=no

[KILLINGUNIT2]
CanGetBounty=no

Revision history for this message
reaperrr (reaperrr) wrote :

This would be exactly one of the 4 or 5 features I would need for my project...

Also, this would technically allow for an entire additional income system, you could have one faction harvesting collectables (ore, tib), one faction building oil derrick-like stuff and the third relying on bounties for killing stuff. I'm absolutely sure that quite a few mods would benefit from this feature, not just mine.

Revision history for this message
MRMIdAS (mrmidas) wrote :

Massive support, cash bounties is one of my favourite generals additions, hopefully we'll be able to define the bounty animation etc should this be implemented.

Revision history for this message
Bug Importer (bug-importer) wrote :

Code related to this issue has just been checked in!
Author: AlexB
Location: ft-bounty, r1045
Commit contains DLL: Yes
Revision comment:
Bounty logic implementation and first binary. Graion's and Joshy's code.
Related to issue #203, Related to issue #1523.

Documentation:
[TechnoType]->Bounty.Modifier (float, defaults to 0)
Multiplier of the enemy victim's Cost/Damage which should be granted as bounty.
[TechnoType]->Bounty.Message (bool, default's to no)
If set to yes, the granted money will be written out above the unit.
[TechnoType]->Bounty.FriendlyModifier (float, defaults to 0)
Multiplier of the friendly victim's Cost/Damage which should be taken as bounty.
[TechnoType]->Bounty.FriendlyMessage (bool, defaults to no)
If set to yes, the taken money will be written out above the unit.
[TechnoType]->Bounty.Pillager (bool, defaults to no)
If set to yes, the unit will grant money for the Damage it delivered and not when it destroys a unit.
[TechnoType]->ImmuneToBounty (bool, defaults to no)
If set to yes, the TechnoType can't grant money.
SVN: http://svn.renegadeprojects.com/Ares/1045

Revision history for this message
Graion Dilach (graiondilach) wrote :

Shoulda work, but I'll do a cleanup and opimization on Tuesday. Shouldn't affect anything else except performance.

EDIT: OK, I know it DOESN'T work. I think I know the cause. Tuesday.

Revision history for this message
Marshall (m-edward) wrote :

Confused about ImmuneToBounty, doesn't Bounty.Modifier=0 achieve the same thing?
It would make more sense to have a CanReceiveBounty flag on the killing unit instead...

Revision history for this message
DCoder DCoder (dcoder1337) wrote :

The way I see it, the unit doesn't receive bounty, its owner house does... else the unit's victims' bounty would have to be included with the unit's own bounty when it is killed.

Revision history for this message
Marshall (m-edward) wrote :

I was thinking of something like the alchemist from warcraft 3 that transmutes its victims into gold.
So the 'bounty-gathering' unit would be unique, and basic units would not be able to harvest bounty for their owner house.

Revision history for this message
Graion Dilach (graiondilach) wrote :

If a victim have ImmuneToBounty set, then any unit with a positive Bounty.Modifier (regardless of Pillager setting) won't get money.

Bounty.Modifier goes to the attackers.

TBH, I don't remember the exact effect of Transmute, (I never liked Alchemists, Dark Ranger and Beastmster are more better) but the effect of Pillager came from War3's Orc ability.

Revision history for this message
Marshall (m-edward) wrote :

Ah wait I see now. All of the tags are on the attacker, ImmuneToBounty is on the victim. I thought it was the other way round before, now it makes sense to me.
So transmute is what has been implemented after all.

The only thing missing is victim-specific modifiers, however I don't think that is needed (certainly not by me anyway).

Revision history for this message
Graion Dilach (graiondilach) wrote :

Well, I can add a Bounty.CostMultiplier to modify the bounty from the victim's side, but take note, Pillagers ignore the victim's cost, they only care about the applied damage.

As I said, I'll fix it up the things today or tomorrow. But we can leave this open for a while to see what would be helpful as well. Personally, I'd see a VeteranAbility, but first I'd like to fix this to work in this stance (http://bugs.renegadeprojects.com/view.php?id=1523#c9677) then we can talk about the rest.

Revision history for this message
Marshall (m-edward) wrote :

Hmm... applied damage irrespective of unit cost is far too powerful for pillage.
That should be
(damage applied / victim max hp) * bounty.modifier * victim cost

Although, if you want uber-configurable parameters then there should be

Bounty.Modifier ;percent of victim's cost to gain as bounty when killed
Pillage.AsCost.Modifier ;percent of victim's cost to gain as bounty when damaged (ratio health lost * this modifier * victim cost)
Pillage.AsDamage.Modifier ;percent of victim's cost to gain as bounty when damaged (damage dealt * this modifier)
then you don't need the Bounty.Pillage boolean.

and then the complementing
Bounty.Message/Pillage.Message
Bounty.Friendly*/Pillage.*.Friendly*

Instead of ImmuneToBounty/ImmuneToPillage, I would additionally add Bounty.Modifier and Pillage.*.Modifier to the victim. Use 1.0 as default and 0.0 to turn it off.

Revision history for this message
Graion Dilach (graiondilach) wrote :

Well, I already use Bounty.Modifier 0.0 as turning it off, and that's the default. I don't see a reason why it should be moved to the victim's side.

Also, Pillage.AsCost, Pillage.AsDamage... I'd like to keep the boolean. It's easier to check that one. Pillage and Bounty are in two different hooks after all. However, if I implement Bounty.CostMultiplier (maybe even Bounty.PillageMultiplier), then the boolean isn't needed, true.

The first build will contain 1045's system, then I go implement your suggestions into it.

OTOH. I have added checks for Armory, Hospital and Slave Miner logics. Can anybody mentions another place where the unit kills another unintentionally?

Also, when this is committed, somebody please do a Temporal Pillager. I smell a glorious bug, but I don't want to add a check until I'm not sure.

Revision history for this message
Krozalid (krozalid) wrote :

Does this work Graion? I would love to try it.

Revision history for this message
Bug Importer (bug-importer) wrote :

Code related to this issue has just been checked in!
Author: AlexB
Location: ft-bounty, r1052
Commit contains DLL: Yes
Revision comment:
Refactored to work, also to follow DCoder's review. Added sanity checks for Armory Hospital and Slave Miner. Logics haven't changed yet. Graion's code.

Related to issue #203, related to issue #1523.
SVN: http://svn.renegadeprojects.com/Ares/1052

Revision history for this message
Graion Dilach (graiondilach) wrote :

Do me a favour. Break it.
Do me a bigger one. Break it with unordinary. Temporal, DeathWeapons, anything serious.

If this fails again, I won't send a patch until I find an SP3 for VS2010.

Revision history for this message
Graion Dilach (graiondilach) wrote :

OK, I know this one failed as well, but enough of shotting in the dark.

I have VS2010, and I am going to have that Ares builder as well. No more "Compiled, Ship It!"-behaviour. VS2010 already pointed out that a header was wrongly included, so my next patch WILL work.

Especially because I'll do a basic test before I send the patch to commit.

Revision history for this message
Graion Dilach (graiondilach) wrote :

First testing build.
Ignore filesize, I forgot including the debugger part. However this also means that don't post up extcrashes regarding this one. If it was caused by Bounty, a debug.log is enough.

Known bug: The messages are not connected to the map but to the screen. Will be fixed ASAP I figured out a way to do it.

Refactoring wasn't done, it's just a working version of the code.

As a testing build, take note the following: Pillager and Messages are enabled and Modifiers are defaults to 1. This means all unit uses Bounty from the box. These are just defaults right now and will be reverted when it's merged into trunk.

http://yras.cncguild.net/Ares/BountyDLL.zip

Check DeathWeapons,. Temporals, DeathAnims, railguns, Animation Damage, Paralyze, Slave Miners, rmory, Hospital and other haywire effects. Where it gives/takes money for nothing, REPORT!

Marshall's points will be developed into the system, since I see they're valid and needed. I think I'll do that tomorrow.

Revision history for this message
FS-21 (jagarni1983) wrote :

Of what I observed (thanks for the default values of that DLL, I saved a lot of time that I used to test things):
- Temporals not work.
- If you use repair weapons (negative damage) it show in red as "-$-50" but in reality the money is increased by 50.
- Rail gun weapons works.
- Sonic weapons with ambient damage works but is impossible to read the "almost" infinite chain of strings when the wave is damaging the unit.
- Money strings from V3 launchers vehicles are indicated in V3 rockets & not in the V3 launchers (is this behaviour what you wanted?).
- Chaos drone gas produce negative damage in your units when they attack friendly units (by logic I imagine that it works).
- By "Animation Damage" do you mean the damage made by virus clouds? If "yes" then it not works.
- By "Slave Miners" what do you wanted exactly to test with those units? I don't see any problem if I attack them or if I kill the slaves or they attack enemies...
- "DeathWeapons": Works as planned.
- Drain weapon from the Yuri Flying Disk does nothing.
- Crushing infantry with vehicles does nothing.
- Flying vehicles like the Yuri Disk killed by EMP weapons does nothing (EMP.Threshold).
- "Paralyze" (from squids against ships?) works.
- Hospital & Armory "massive heal" effect that you wanted to test does nothing.

One idea I thought about the heavy overload of strings due to a very low ROF of the weapons: do a counter of 1 sec. between strings (or less time, the min. necessary to not overlap strings) & during that time not to show nothing and when the counter ends then show the full sum of that unit since the last count (if sum != 0), reset count of the unit & repeat again the count...

Revision history for this message
Krozalid (krozalid) wrote :

Confirming FS-21's founding.

Revision history for this message
Graion Dilach (graiondilach) wrote :

Thanks!

Temporals, Armory, Slave Miner Crushing and Threshold should been retested with Bounty.Pillage=no. AFAIK, Hospital and Armory kills their units before respawning and SM always kills the Slave when it gets in. I've only added checks against these three. Crushes and Threshold should work without Pillage set.

DeathWeapons: OK, so it does Bounty. I can't decide if it should or shouldn't. That's my problem.

Drainweapon and Temporal doesn't cause a damage, so that's not surprising if that doesn't work with pillagers. But I see, Temporal should give bounty at deleting even if the unit is a pillager.

Animation damage doesn't have an owner tbh, so I don't think I can fix that. It goes to the other animation warhead problems.

OK, then todo list:
Add Marshall's proposal
Fix Spawned units' bounty strings Only MissileSpawn is checked, spawn planes will show
Add a check to Sonic
Add a check to ROF
Crushing should give bounty to pillagers
Negative damage shouldn't generate Pillage. (this one is arguable, we can speak about non-free unit repairs with this)

Revision history for this message
DCoder DCoder (dcoder1337) wrote :

Just because an object disappears off the map doesn't necessarily mean it's been killed. Neither Hospital, Armory nor the Slave Miner kill their occupants.

Revision history for this message
Graion Dilach (graiondilach) wrote :

Oh, OK, thanks.

C4 and IvanBombs?

Revision history for this message
Krozalid (krozalid) wrote :

C4 works. IvanBomb works too.

Revision history for this message
FS-21 (jagarni1983) wrote :

I forgot to say that Desolator's deploy weapon does nothing.

Revision history for this message
Graion Dilach (graiondilach) wrote :

Same. YR doesn't keep which weapon generated the radiation (that's why you can't gain veterancy through rad, neither), and without custom radiation, I can't keep that, neither.

Revision history for this message
Graion Dilach (graiondilach) wrote :

DLL is updated, testing defaults haven't changed.

ImmuneToBounty is deprecated, Bounty.CostMultiplier and Bounty.PillageMultiplier took it's place, both are float values, both defaults to 1.
Calculations match Marshall's proposal.
String should spawn on missile spawnees and not on the missiles.

Still waiting on Crush, Temporal and Threshold no-Pillage check.

Revision history for this message
Black Temple Gaurdian (black-temple-gaurdian) wrote :

Just a logicalpoint, does this work on cost or soylent (or whatever it was)? IMO it should be soylent as that's what the similar logic (the Grinder) uses so you don't necessarily get 100% back.

Revision history for this message
Marshall (m-edward) wrote :

Well, it doesn't really matter as you have fine control now. Because of that though, I'd vote cost - simply because I've already manually changed all my soylents to be more suitable for the grinder.

Revision history for this message
Graion Dilach (graiondilach) wrote :

DLL updated, no more IEs when a building want's to message.

Revision history for this message
Graion Dilach (graiondilach) wrote :

DLL updated, Pillage should work with Temporal and the strings should be attached to the map (this one is Alex's code).

Defaults are reverted to proposed trunk defaults, neither one is tested yet. Debug symbols in, so DLL size is correct.

EDIT: Whoops, sorry about ignoring the cost-soylent argument. The calculation is based upon Cost, and Industrial Plant logic kicks in as well.

Revision history for this message
Graion Dilach (graiondilach) wrote :

Another update within the day!

D's Crush hook is also incorporated. Also fixed a bug in Temporal Pillager which caused that money wasn't given.

Testing, please! (somebody please check if buildings IE again, I don't really understand Alex's code but how I see they shouldn't)

Revision history for this message
FS-21 (jagarni1983) wrote :

Can you explain a bit the "buildings IE" to try to reproduce it?

Revision history for this message
Graion Dilach (graiondilach) wrote :

Can building write out a message, or it IEs instead? Two posts above.

Revision history for this message
Graion Dilach (graiondilach) wrote :

OK, guys, updated again, Temporal had a wrong hook before.

So both Crush and Temporal works. What have I missed?

Revision history for this message
Chanterier (speederyr) wrote :

Get a Terror Drone into a vehicle which has bounty logic enabled and has a death weapon.

Terror Drone kills the vehicle and dies in the process. Bounty is given. Does this make sense?

Revision history for this message
Graion Dilach (graiondilach) wrote :

Well if it paid the vehicle, then yes, thank you. However Bounty and Pillage are similar, but not related in game terms. Special cases are handled differently, like Temporal and Crush.

For example, Threshold without Pillager should (read: the code says this, testers say nothing) pay already, on the other hand I don't see a reason why Threshold with Pillager set should pay, since Threshold ignores applied damage.

Revision history for this message
Chanterier (speederyr) wrote :

Death weapon shouldn't provide bounty. The unit died, it can't receive money (pickup remaining parts or however you explain the logic). This should at least be customizable.

Revision history for this message
YR M0ddEr (yr-m0dder) wrote :

Bounty.Modifier= calculating is wrong, but ONLY when killing buildings. Note that Bounty.FriendlyModifier= calculate correctly.

Revision history for this message
DCoder DCoder (dcoder1337) wrote :

"Is wrong" is not really a helpful error description.

Revision history for this message
YR M0ddEr (yr-m0dder) wrote :

with "wrong" I mean it gives wrong amount of money, like twice as much as you should get.

Revision history for this message
Graion Dilach (graiondilach) wrote :

@DCoder. he reported this to me over IRC first. I guess ObjectType->GetActualCost goes nuts on BuildingTypes, so I'll switch it ASAP.

@Speeder, it won't be customizable. I won't add another if-clause. Personally I agree that Deathweapons shouldn't have Bounty, so if anybody doesn't have an opposite point, my next update will have that fixed.

Revision history for this message
Graion Dilach (graiondilach) wrote :

Code related to this issue has just been checked in!

Author: Graion Dilach
Location: external place, r105207
Commit contains DLL: Yes
Revision comment:

Related to issue #207: Changed cost getting to prevent doubling BuildingType money. Pillager isn't set to yes by default from now on.
Fixed issue #1588: Implemented as proposed.

DLL: http://yras.cncguild.net/Ares/BountyDLL.zip

Revision history for this message
Graion Dilach (graiondilach) wrote :

Updated to 1052071, no longer IE during menu load.

Revision history for this message
Krozalid (krozalid) wrote :

It's not working for me.

Revision history for this message
Graion Dilach (graiondilach) wrote :

07 or 071?

I know 07 is broken thatr's why it was updated. 071 should work. But you can upload the dump, I have WinDBG to read it.

Revision history for this message
Graion Dilach (graiondilach) wrote :

OK, guys, Ares's Bounty branch is updated.

If I read the code correctly, CostMultiplier and PillageMultiplier defaults to 0 right now... take steps accordingly.

Revision history for this message
Krozalid (krozalid) wrote :

From what I understand, this could be enabled for the countries too right? And I assume that the tags are the same? I'm not sure whether I did it wrong or not but this really doesn't work for me. And yes I'm using the latest branch revision.

Revision history for this message
Graion Dilach (graiondilach) wrote :

I'll look into it.

You did understand correctly, but in latest branch, Bounty.CostMultiplier and Bounty.PillageMultiplier both defaults to 0 which means no money given.

Revision history for this message
Krozalid (krozalid) wrote :

So what should I put on the country if I want them to get bounty?

Revision history for this message
Graion Dilach (graiondilach) wrote :

The same tags.

And I'll get talk to our Project Manager to see if we have a Doc Maintainer onboard. I think I'll need him.

Revision history for this message
Krozalid (krozalid) wrote :

What about Bounty.Modifier?

Revision history for this message
Graion Dilach (graiondilach) wrote :

That defaults to 0 as well, yeah. Those tags can go to the country.

OK, all tags which were on the technos bbefore can go to the country, and serve as defaults if the techno doesn't have them.

Revision history for this message
Black Temple Gaurdian (black-temple-gaurdian) wrote :

So what tags are needed to get this to work? Thew documentation is... non-existant.

Revision history for this message
Graion Dilach (graiondilach) wrote :

Thew code is broken also.

On my to-do to get it fixed, actually I postponed it to the first day after 0.2 release.

Revision history for this message
Graion Dilach (graiondilach) wrote :
Revision history for this message
Graion Dilach (graiondilach) wrote :
Revision history for this message
Renegade (renegade) wrote :

Closed in favor of blueprint.

Changed in ares:
assignee: Graion Dilach (graiondilach) → nobody
status: In Progress → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.