Author Topic: Skill/Command System, How Does It Really Work?  (Read 2632 times)

MoLAoS

  • Ornithopter
  • *****
  • Posts: 433
    • View Profile
Skill/Command System, How Does It Really Work?
« on: 30 October 2012, 17:24:39 »
So currently based on my tests skills/commands don't have any sort of cool down. They all function as autoattacks, and choosing a new skill/command does not reset the timer.

So if I select a command/skill with an attack speed of 10 even if I switch to a new command/skill it would take 10 seconds of downtime before it switched to the new skill which would then proceed at its actual listed speed.

Furthermore attack speed relates only to energy cost being used, all the other aspects of the skill trigger on animation speed.

Do you guys consider this to be an accurate description of the current system?

As part of my Majesty-like work I had been trying to allow wizards to cast spells as they had done in that game, but I believe they used a cooldown system as opposed to what appears to be the Glest/GAE/MG system.

I can write in an optional cooldown for skills, but I don't want to mess with it unless my current understanding is accurate, otherwise I could get some nasty side effects.

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: Skill/Command System, How Does It Really Work?
« Reply #1 on: 30 October 2012, 21:01:48 »
The timing system have been off for some time, look at mg's attack skill, that was fixed some time ago because it was ****ed up with archers and slow shooting unit's being ages about ending thier cycles.
WiP Game developer.
I do danish translations.
"i break stuff"

MoLAoS

  • Ornithopter
  • *****
  • Posts: 433
    • View Profile
Re: Skill/Command System, How Does It Really Work?
« Reply #2 on: 30 October 2012, 21:11:02 »
Well I know it's fucked up, but I am trying to find out specifically how it is fucked up :)

It had been about 4 hours so I went ahead and implemented a cool down system for attack skills. I'll test it out as soon as it finishes compiling.

Basically I'm going to give all units 100 anim speed and 100 attack speed and then limit the frequency of the automated behavior with the cool downs. Based on my understanding the cool downs should tick even while the skill is animating. Otherwise given the 1 second duration of skills I can just cut 1 second off the cooldown to get the desired result.

It would still be nice to hear some GAE or MG devs opinions on exactly how the current skill system functions though.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Skill/Command System, How Does It Really Work?
« Reply #3 on: 30 October 2012, 21:47:57 »
Yes, currently a skill cycle has to be completed before the next can begin. And as you mentioned, a speed of 10 will take exactly 10 seconds (1 / [10 / 4000] = 400 world cycles at 40 cycles per second = 10 seconds), so a dude with a speed 10 skill is going to be sitting around for a long while. But if we try to interrupt these cycles, I'm sure loads of bad things will happen (and then there's the question as to whether or not the cycle was completed; since an attack could appear to be completed halfway through the cycle). A cooldown period would be a useful measure, but it'd have to be something other than a skill, as a skill would just mean that the unit would have to sit there for the entire cooldown period. So just an uncorrelated timer?
Edit the MegaGlest wiki: http://docs.megaglest.org/

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

MoLAoS

  • Ornithopter
  • *****
  • Posts: 433
    • View Profile
Re: Skill/Command System, How Does It Really Work?
« Reply #4 on: 30 October 2012, 22:48:52 »
Yes, currently a skill cycle has to be completed before the next can begin. And as you mentioned, a speed of 10 will take exactly 10 seconds (1 / [10 / 4000] = 400 world cycles at 40 cycles per second = 10 seconds), so a dude with a speed 10 skill is going to be sitting around for a long while. But if we try to interrupt these cycles, I'm sure loads of bad things will happen (and then there's the question as to whether or not the cycle was completed; since an attack could appear to be completed halfway through the cycle). A cooldown period would be a useful measure, but it'd have to be something other than a skill, as a skill would just mean that the unit would have to sit there for the entire cooldown period. So just an uncorrelated timer?

What I did was set all attack skills for units intended to be run under my new agent AI to 100 or 1 attack and one animation per second. Then I set up a timer and after selecting a command but before sending it, the related skill sets a cool down determined in the skill XML. The attack skill selecting function automatically passes over functions where the cool down current value is not equal to 0. During world::tick all units who are under the new AI have all the cool downs of their skills decremented by one, assuming they are higher than 0.

So if I understand what you mean by uncorrelated timer, yes, that is what I used.

MoLAoS

  • Ornithopter
  • *****
  • Posts: 433
    • View Profile
Re: Skill/Command System, How Does It Really Work?
« Reply #5 on: 30 October 2012, 23:05:34 »
Well found another annoying issue. It totally makes sense in the context of a WarCraft clone but is hard to figure out and rewrite for games that are a little different. Essentially I had to dig through the guts of skills and find a way to make a skill trigger only once and then stop, since I want to calculate a new skill after one firing of the current one.

Well I had to dig through some fun errors of my own making but, I understand the skill and command code much better now.

Omg. Finally got the damn thing to work. I had a lot of wasted time over stupid errors but I got it to finish and now I can port the working code to other aspects of the AI.

Gonna hit the sack now, so tired of confusing shit, especially when I confuse myself :'(

« Last Edit: 31 October 2012, 07:15:26 by MoLAoS »

 

anything