Author Topic: Discussion on Effects  (Read 2296 times)

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Discussion on Effects
« on: 31 October 2011, 22:17:58 »
What exactly is it that causes issues with a multiplier of zero? I'm assuming it's because in this example, the effect's stacking is set to stack? Would it be better overwrite/extend, or is this something entirely different?
« Last Edit: 3 November 2011, 01:36:32 by Omega »
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

daniel.santos

  • Guest
Re: Re: Effects...not taking an effect
« Reply #1 on: 2 November 2011, 05:07:00 »
I can't answer the question on what the exact cause is, as I'm out of touch with the code.  However, "stack" means that applying the same effect to the same unit more than once will cause the effects to "stack", i.e., exist as two instances at the same time.  So if you have set attack-speed multiplier to 0.25 and you stack the same effect again, it will effectively have a multiplier of 0.125.  If you set it to "overwrite" it will simply remove the previous effect and replace it with the new one, including the new duration and effect strength (which is usually 1.0, unless you're using emanations and set it to vary the strength with range).

Also, if setting it to zero causes problems, try a really small non-zero number, like 0.01.

EDIT: Oh wait! The problem could be a divide by zero error, which we aren't setting as an actual FPU exception (so the code doesn't get interrupted, i.e., "crash").  However, this will result in odd numbers, so we should probably check that in the code before setting the attack duration to infinity. :)  So be careful before setting that value too low, as it might cause the unit to freeze for a while (as Silnarm said)

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Re: Effects...not taking an effect
« Reply #2 on: 2 November 2011, 06:14:24 »
I never thought about that, though, I am curious why small numbers could cause the unit to freeze. I think it would really be great if there was another way (or perhaps if making the multiplier a zero would initiate a different function) to set a unit's stat to zero. For example, making an effect that would "stop" a unit entirely (eg, set the move speed to zero - and ideally we'd also set the animation speed so as well) so the unit can't move. Likewise, an "instant kill" effect that could set a unit's HP to zero (or for EP), or "disabling" a foe from attacking by reducing their attack speed to zilch... (thinking about it, an expansion of the feature to allow them to disable commands by type could be really interesting, such as a crippling effect that disables all move commands). The possibilities are endless, though, that's rather offtopic here, I guess.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

daniel.santos

  • Guest
Re: Re: Effects...not taking an effect
« Reply #3 on: 2 November 2011, 19:21:13 »
Well you have to understand how the "skill" system works.  You know that every unit has skills and commands.  At any given moment, a unit is always executing a skill, even if it's the "be lazy and drink beer" skill.  Each skill has a duration, a period of time it takes to complete one cycle of it.  So modifications to "attack speed" effect the duration of all attack skills.  Thus, having a very low duration can cause the unit to be stuck in that skill.  I think you can interrupt it by changing to another skill, but I'm not even certain of that, you'll have to try it out.

You could add a "be stunned" skill (or even a "look stunning" skill!), but it would have it's own animation. :(  It wouldn't be able to just freeze the unit in it's current animation state.  I'm not sure if there's a work-around for this, but I'm sure there's something that can be changed in the engine to make it more flexible (not sure what off-hand).

As far as affecting what skills are available, I think the key here is that the skill must already exist, but you simply have alter the availability of the commands (to enable a skill or disable them).

But if you want insta-kill, just set <hp-regeneration value="-100000"/>.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Re: Effects...not taking an effect
« Reply #4 on: 3 November 2011, 01:32:30 »
Wouldn't setting the animation speed to zero be the equivalent of "freezing" an animation? That could be really interesting if you had an effect on an icy spell (eg, the Archmage's ice nova). Expanding even further off topic, if a the effects/emanations were expanded to be able to apply a shader or particle effect (not sure if they can do particles?) that would turn the unit blue... I'm getting over my head, though. Food for thought, I suppose?

Edit: Split into new topic.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

daniel.santos

  • Guest
Re: Discussion on Effects
« Reply #5 on: 4 November 2011, 10:09:31 »
Well, before I left in 2009, I was working on expanding the particle effects, including enabling an "effect" to induce particle effects on the unit being effected.  Unfortunately, the particle system in glest was designed pretty strictly around the simulation of projectiles and attacks, so it needs some more work.  I've got a lot of ideas if I ever get back to that part :)

will

  • Golem
  • ******
  • Posts: 783
    • View Profile
Re: Discussion on Effects
« Reply #6 on: 4 November 2011, 10:41:28 »
Well, before I left in 2009, I was working on expanding the particle effects, including enabling an "effect" to induce particle effects on the unit being effected.  Unfortunately, the particle system in glest was designed pretty strictly around the simulation of projectiles and attacks, so it needs some more work.  I've got a lot of ideas if I ever get back to that part :)

In MG/GAE, unit-particles are specified per skill.  In MG, these can have child particles and such.  They are not influenced by any effects, but the particles themselves are there ready to be connected to effects.

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Discussion on Effects
« Reply #7 on: 4 November 2011, 23:03:20 »
What exactly is it that causes issues with a multiplier of zero? I'm assuming it's because in this example, the effect's stacking is set to stack? Would it be better overwrite/extend, or is this something entirely different?

Skill cycles can't be interrupted and they are pre-calculated, this 'base' value is then modified for whatever 'enhancements' a particular unit has, and that's how long each cycle will take. This is done at the start of a new skill cycle, so if a unit has a move-speed multiplier of 0, then the cycle will be infinitely long (in reality it is capped, at 4095 frames I think it is, but that is still over 100 sec!).

This pre-calculating was all added a while back for multi-platform compatibility, we could probably go 'partially' back to the old system, maintaining a progress counter for the unit and pre-calculating the progress per frame instead of the cycle length... let me think about it ;)

Expanding even further off topic, if a the effects/emanations were expanded to be able to apply a shader or particle effect (not sure if they can do particles?) that would turn the unit blue... I'm getting over my head, though. Food for thought, I suppose?

Particle systems can be attached to effects (and emanations are effects, so them too).
Glest Advanced Engine - Code Monkey

Timeline | Downloads

Zoythrus

  • Guest
Re: Discussion on Effects
« Reply #8 on: 16 January 2012, 23:00:36 »
Expanding even further off topic, if a the effects/emanations were expanded to be able to apply a shader or particle effect (not sure if they can do particles?) that would turn the unit blue... I'm getting over my head, though. Food for thought, I suppose?

Particle systems can be attached to effects (and emanations are effects, so them too).
well, i've been trying to get effects and emanation to use particles, to no avail. is the wiki wrong? it provides no examples.

lazyanttu

  • Guest
Re: Discussion on Effects
« Reply #9 on: 17 January 2012, 01:22:40 »
I haven't considered about that...Well I think I must change something in my plans.
Is there a way to work around these two problems?

1) I tried to make a "Bind" special attack that would immobilize (set speed to zero) target. However I faced the same problem, it froze for infinity (well, I didn't waited for over 100 seconds :P). Is there a way to have binding effect, so that the unit could not move?

Well, the bind was supposed to last for 6 seconds. What do you think, would the following be good idea: make the effect itself last just for a short moment, but cause the move speed become so slow that it would take 6 seconds before changing skill, by making speed modifier close to zero? Or would it cause problems. In addition, is there a formula for the speed, so I could calculate that how small the time should be for 6 second "freeze". Is there any sense in that idea?

2) I wanted an ability to prevent enemy from attacking for a while. But if i put damage to 0, the particle shows still (i suppose, but I haven't tested), which is unwanted visual effect. But if attack speed is slower, it takes forever to finish the command. Is there a way to work around this? To prevent an unit from attacking due to some "Stun"-effect.

I know this discussion is old, but because my problem was exactly about what was discussed here, I thought it could be better to continue this thread instead of starting a new.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Discussion on Effects
« Reply #10 on: 17 January 2012, 06:15:01 »
1) I tried to make a "Bind" special attack that would immobilize (set speed to zero) target. However I faced the same problem, it froze for infinity (well, I didn't waited for over 100 seconds :P). Is there a way to have binding effect, so that the unit could not move?

Well, the bind was supposed to last for 6 seconds. What do you think, would the following be good idea: make the effect itself last just for a short moment, but cause the move speed become so slow that it would take 6 seconds before changing skill, by making speed modifier close to zero? Or would it cause problems. In addition, is there a formula for the speed, so I could calculate that how small the time should be for 6 second "freeze". Is there any sense in that idea?
As Silnarm mentioned before, setting the speed to zero causes problems because the command takes forever to complete, and units cannot perform a new command until the previous is complete. The forumula for how skill speed works is on the wiki: https://docs.megaglest.org/Skills

2) I wanted an ability to prevent enemy from attacking for a while. But if i put damage to 0, the particle shows still (i suppose, but I haven't tested), which is unwanted visual effect. But if attack speed is slower, it takes forever to finish the command. Is there a way to work around this? To prevent an unit from attacking due to some "Stun"-effect.
Yeah, like the above, there's no 'proper' way to do this, yet. I'd like to see a "stun" feature request for effects, which would stop all commands (and possibly force a "stun" skill, if it exists).

Expanding even further off topic, if a the effects/emanations were expanded to be able to apply a shader or particle effect (not sure if they can do particles?) that would turn the unit blue... I'm getting over my head, though. Food for thought, I suppose?

Particle systems can be attached to effects (and emanations are effects, so them too).
well, i've been trying to get effects and emanation to use particles, to no avail. is the wiki wrong? it provides no examples.
Erm, I don't know. *Awaits Silnarm/Hailstone/Yggrdasil to post* (I'll add an example when they clarify).
« Last Edit: 18 June 2016, 13:39:51 by filux »
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

 

anything