Author Topic: attack boosts: unit drops dead after battle with boosted hp  (Read 2768 times)

FreshDumbledore

  • Guard
  • ***
  • Posts: 61
    • View Profile
Hello. Increase a units hp with an attack boost, fight with it, get in a situation the boost is disabled, unit drops dead (without being further damaged).
probably needs to have more hp lost while boosted than it would have unboosted. (like having 600 base, 1500 boosted, lose hp down to 700)
however, xml (put on a worker move skill for demonstration purpose)

      <skill>
         <type value="move"/>
         <name value="move_skill"/>      
         <ep-cost value="0"/>
         <speed value="190"/>
         <anim-speed value="130"/>
         <animation path="models/worker_walking.g3d"/>
         <sound enabled="false"/>
         <attack-boost>
            <allow-multiple-boosts value="false" />
            <radius value="5" />
            <target value="faction" include-self="true">
            </target>
            <max-hp value="9999" />
         </attack-boost>
      </skill>

if it matters:
megaglest v3.9.1
Compiled using: GNUC: 40403 [64bit] on: Jan 18 2014 17:44:55 platform: Linux-X64 endianness: little
GIT: [Rev: 4628.11ac54a] - using STREFLOP [SSE] - [no-denormals]

binary installation on gentoo linux with a 3.12 kernel
regards

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: attack boosts: unit drops dead after battle with boosted hp
« Reply #1 on: 25 May 2014, 18:30:33 »
so what you are saying

have a unit with 600 Hp and then boos it with 10 hp

if you give it 601 damage. And then remove the boost the unit dies without taking damage?.
WiP Game developer.
I do danish translations.
"i break stuff"

filux

  • MegaGlest Team
  • Draco Rider
  • ********
  • Posts: 310
  • was OpenSuse x64, is Debian testing x64
    • View Profile
Re: attack boosts: unit drops dead after battle with boosted hp
« Reply #2 on: 25 May 2014, 18:39:53 »
yes, another example

e.g.
hp=600
boost=+100hp >> ==700hp

then received 650 damage, and then lost its boost, and then died
where should still live with 50hp


Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: attack boosts: unit drops dead after battle with boosted hp
« Reply #3 on: 25 May 2014, 18:48:53 »
im not sure i agree, The feature works as intended, Perhaps add er percenate to boost, that would leave a unit alive, but as it is now it seems like it's working as intended, wait around for titi or softcoder to answear they are the coders so they will know, but as it stands i think this is working as intended.
WiP Game developer.
I do danish translations.
"i break stuff"

filux

  • MegaGlest Team
  • Draco Rider
  • ********
  • Posts: 310
  • was OpenSuse x64, is Debian testing x64
    • View Profile
Re: attack boosts: unit drops dead after battle with boosted hp
« Reply #4 on: 25 May 2014, 19:28:59 »
if intended is fact that if bigger is hp boost then at the same time is somehow more useless then sure

in some day someone may have a vision of create unit with 500 hp and +5000 boost and will be that type of unit always dead? nice  ;)

MoLAoS

  • Ornithopter
  • *****
  • Posts: 433
    • View Profile
Re: attack boosts: unit drops dead after battle with boosted hp
« Reply #5 on: 25 May 2014, 20:52:11 »
This is not at all working as intended in my opinion. You should calculate have however much health you have when the boost wears off, and if its too high, cap it to your max. This is how it works in every game and its superior gameplay imo.

FreshDumbledore

  • Guard
  • ***
  • Posts: 61
    • View Profile
Re: attack boosts: unit drops dead after battle with boosted hp
« Reply #6 on: 26 May 2014, 08:26:48 »
loosing the boost without taking damage before is no problem.

so if you buff a unit from 100 hp to 200 hp and do not fight and walk out of the boost range / loose it, the unit goes back to 100 hp and is alive.
but if you buff it from 100 hp to 200 hp, fight until it lost 101 hp and then walk out of boost range / loose it, it dies.

looks for me like damage would first be removed from base-hp and not from boost-hp and when boost-hp is gone too, negative base hp makes the unit die .. or something.
maybe a dev can explain :)

###
also buffing a unit from 100 hp to 300 hp and loosing 150 hp will cause it to die when loosing boost if i remember right
« Last Edit: 26 May 2014, 09:43:24 by FreshDumbledore »

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: attack boosts: unit drops dead after battle with boosted hp
« Reply #7 on: 26 May 2014, 11:24:25 »
This is no bug and works as expected and meant!

Maybe you get mixed up with the usage of armor and HP?
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: attack boosts: unit drops dead after battle with boosted hp
« Reply #8 on: 26 May 2014, 13:45:03 »
Making it possible to use procentate values would solve this problem. i think.

in any case it's a feature request you are looking at.
WiP Game developer.
I do danish translations.
"i break stuff"

FreshDumbledore

  • Guard
  • ***
  • Posts: 61
    • View Profile
Re: attack boosts: unit drops dead after battle with boosted hp
« Reply #9 on: 26 May 2014, 14:19:33 »
I disagree on the expected part.

Fighting with buffed hp and dying when the buff goes off is pretty unique for strategy games. One would rather expect that the hp the unit still has are its base hp and not influenced by the buff.

Should be changed imo

filux

  • MegaGlest Team
  • Draco Rider
  • ********
  • Posts: 310
  • was OpenSuse x64, is Debian testing x64
    • View Profile
Re: attack boosts: unit drops dead after battle with boosted hp
« Reply #10 on: 26 May 2014, 14:50:41 »
Making it possible to use procentate values would solve this problem. i think....

Maybe yes, (ofc. if percentage version isn't "intended broken" too :P),

but for me normal boost should work similar like this quasi program:

Code: [Select]
current_hp_1; max_hp_1; boost_hp

  # - V - - - - - - - - when boost works
max_hp_2=(max_hp_1+boost_hp)
current_hp_2=(current_hp_1+boost_hp)

  # - V - - - - - - - - when boost is lost
if [ current_hp_2 < max_hp_1 ]; then
    current_hp_3 = current_hp_2
else
    current_hp_3 = max_hp_1
fi
max_hp_3=max_hp_1

MoLAoS

  • Ornithopter
  • *****
  • Posts: 433
    • View Profile
Re: attack boosts: unit drops dead after battle with boosted hp
« Reply #11 on: 26 May 2014, 17:06:37 »
I disagree on the expected part.

Fighting with buffed hp and dying when the buff goes off is pretty unique for strategy games. One would rather expect that the hp the unit still has are its base hp and not influenced by the buff.

Should be changed imo

For whatever reason MegaGlest devs like to claim a lot of things that should be bugs are features. I can't understand where they get the idea to makes their mechanics like this one from. Its super bizarre. But I guess, its their game so they can make weird decisions if they want.

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: attack boosts: unit drops dead after battle with boosted hp
« Reply #12 on: 26 May 2014, 18:08:34 »
The game logic dictates this is how the function plays out.

you might have other plan or uses for the funtion, But that would be a feature request.

The _logic_ of the funtion is pure.

the use of it, not so much.
WiP Game developer.
I do danish translations.
"i break stuff"

FreshDumbledore

  • Guard
  • ***
  • Posts: 61
    • View Profile
Re: attack boosts: unit drops dead after battle with boosted hp
« Reply #13 on: 26 May 2014, 18:33:58 »
the game logic is programmed.

however, im doing some more tests right now.
results:
you dont need to have less hp than base-hp to die if you lost more boost-hp than you have base-hp.

in numbers: have a 600 hp unit, boost it by 1000 (= 1600 total)
lose 800 hp = be at 800 hp.
lose buff = drop dead (while having more total hp than you would have unbuffed).
cant imagine people to expect that :)

setting the multiplier to true seems to be broken, may someone else test it plz?
my code:
         <attack-boost>
            <allow-multiple-boosts value="false" />
            <radius value="5" />
            <target value="faction" include-self="true">
            </target>
            <max-hp value="300" value-percent-multipler="true" />
         </attack-boost>

still adds 300 static hp, same for 60, 600 and so on.
« Last Edit: 26 May 2014, 18:40:30 by FreshDumbledore »

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: attack boosts: unit drops dead after battle with boosted hp
« Reply #14 on: 4 June 2014, 23:39:24 »
Value-percent-multipler ? I never knew we have somehting like this  :-[

But about the initial problem maybe you are right and this should be changed but I don't know in which way to tell the truth. I still think to make a unit stronger, raise its armor, not its HP.

But back to topic what should happen exactly? If we would rise the HP  what should happen? Should the maxHP be rised too ?
And if the effect ends? We don't remove the extra HP? And just adjust it to the reduced maxHP ?
This would be very dangerous because you would be able to heal within a second. 

Maybe you want this?:
So if unit has HP=100 and boost is 500 you get a total of 600 maxHP. If the effect ends and the unit has 200 HP in this moment  this would mean:

new HP=200/600 *100=33,33
( newHP=currentHP/boosted maxHP *nonboosted maxHP )

Would this be correct ?

Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

filux

  • MegaGlest Team
  • Draco Rider
  • ********
  • Posts: 310
  • was OpenSuse x64, is Debian testing x64
    • View Profile
Re: attack boosts: unit drops dead after battle with boosted hp
« Reply #15 on: 5 June 2014, 04:15:45 »
...If we would rise the HP  what should happen? Should the maxHP be rised too ?...
And if the effect ends? ... just adjust it to the reduced maxHP ?...
This would be very dangerous because you would be able to heal within a second. 
"rise the HP" - yes.
"Should the maxHP be rised too" - yes.
"And if the effect ends? ... just adjust it to the reduced maxHP ?" - yes.
"This would be very dangerous because you would be able to heal within a second." -  and yes, but

...it might be a problem only in case when hp boost is large and area is large (heal a group of units at once) and unit enters into and goes out from boost area fast multiple times, but again this is how it works, boost effect is instantaneous.
In my opinion the solution for that problem may be e.g. a additional time reguired to be in the boost area to boost effect will work, e.g. 2 seconds.

Improved quasi program:
Code: [Select]
current_hp_1; max_hp_1; boost_hp

  # - V - - - - - - - - when boost works
if [ time >= 2seconds ]; then
    max_hp_2 = (max_hp_1 + boost_hp)
    current_hp_2 = (current_hp_1 + boost_hp)
fi

  # - V - - - - - - - - when boost is lost
if [ current_hp_2 < max_hp_1 ]; then
    current_hp_3 = current_hp_2
else
    current_hp_3 = max_hp_1
fi
max_hp_3 = max_hp_1

...new HP=200/600 *100=33,33
( newHP=currentHP/boosted maxHP *nonboosted maxHP )

Would this be correct ?
Not really, because it modifies normal boost effect and it is a "percent" solution for non "percent" boost.
« Last Edit: 5 June 2014, 04:24:39 by filux »

FreshDumbledore

  • Guard
  • ***
  • Posts: 61
    • View Profile
Re: attack boosts: unit drops dead after battle with boosted hp
« Reply #16 on: 5 June 2014, 21:34:31 »
hmm.

you are right about the healing part, that should not happen.

cant it be done like this? very pseudo code :D

base_hp = 100;
boost_hp = 200;
hp_while_boosted = base_hp+boost_hp;

on_damage {
   boost_hp = boost_hp - damage;
   current_hp = base_hp+boost_hp;
}

on_loose_boost {
   if (boost_hp < 0) {
      current_hp = base_hp+boost_hp;
   } else {
      current_hp = base_hp;
   }
}

hope its clear what i mean.
just make the unit loose the boosted hp first in combat. if the boost effect is gone and the boost_hp still was above 0, reset hp back to base_hp. if the boost_hp got negative (received more damage than boosted) reduce base_hp by the difference between boost_hp and 0.

would mean:

start at 100 hp. be boosted to 200. receive 180 damage; loose buff = 20 hp of boost remain, they are lost; back at 100 base hp.
start at 100 hp, be boosted to 200. receive 250 damage; loose buff = damage received was 50 higher than boost received; reduce base hp by 50.

if MG 'remembers' the hp before boost one could not abuse it for healing too.

hope my pseudo code and explanation is able to communicate what i want to say :D