HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: Area of Effect Abilities  (Read 2381 times)

_Omzy_

  • General Accounts
  • *
  • Posts: 24
    • View Profile
Area of Effect Abilities
« on: Jan 17, 15, 12:53:30 PM »

We've been discussing how to implement area of effect abilities in the Skype group for a couple of days and although there are several good ideas that have been mentioned, I'm still unsure of the best approach that is authoritative, lightweight, and syncs with Fx on the client.

Initially, I was going to fire Fx off on the client and use the OnTargetAchieved for the Fx to make a server script callback to apply the effect to the target. Then I realized that is placing a lot of trust that the client doesn't alter the Fx and send its own callbacks.

Next, Keeper mentioned the use of NPCs as effects, spawning a simple invisible box/sphere and sending it out, detecting collision, and perhaps playing Fx on the object for a visual. That sounded like a decent idea, but potentially resource intensive as it requires a lot of character code that is not used.

Additionally, we discussed how timers for every effect and ability's targeting system (like an aoe expanding away from the character at a velocity and detecting targets as it enlarges) would strain the server if run on the server. This is why cooldowns are best managed by sending timestamp information to the client instead of running a timer on the server. Running a timer on the client where every tick might detect new targets, however, seems to be trusting the client too much when compared to validating cooldown information. It is not really the same scenario.

Then, I looked into the area awareness functions on this page http://hewiki.heroengine.com/wiki/Area_Awareness_Functions. As someone in the Skype group pointed out, this post suggest that they shouldn't be used for these types of abilities: https://community.heroengine.com/forums/index.php/topic,164.msg580.html#msg580.

However, when I looked into HJRef this morning, I found that it uses these area awareness functions in conjunction with server timers. The load notes say that the combat system is outdated but that the ability system is a good example. So, I am wondering what the consensus on this is. It is arguably one of the most client<>server intensive processes in any game, so its important to get it right so that combat doesn't lag everyone out.

Here's an excerpt from HJRef's ActivationRingDataClassMethods illustrating the use of timers on the server, calling an area awareness function every tick, using a player for the coordinate reference.

Code: [Select]
      where mySpec is kindof AbilityExpandRingOnTickDec
        where ParentAbility is kindof DurationAbility   
          if ParentAbility.abilityCurrentTick = 1
            me.rdInnerRadius = me.rdInnerRadius + (mySpec.erExpansionPerTick * (ParentAbility.abilityCurrentTick -1))
          else
            me.rdInnerRadius = me.rdOuterRadius + (mySpec.erExpansionPerTick * (ParentAbility.abilityCurrentTick -2))
          .
          me.rdOuterRadius = me.rdOuterRadius + (mySpec.erExpansionPerTick * (ParentAbility.abilityCurrentTick-1))
        .
      .
    .
    if me.rdInnerRadius < .01
      me.rdInnerRadius = .01
    .
    var defenders = GetTargetsInSphericalAnnulus(true, true, me.cdCenter, me.rdOuterRadius, me.rdInnerRadius)
Logged
-OMZY-
Odyssey of Ydris

nocake

  • General Accounts
  • *
  • Posts: 404
    • View Profile
    • BlightMMO
Re: Area of Effect Abilities
« Reply #1 on: Jan 19, 15, 05:07:33 PM »

So far this activator has worked for me.

I did have to modify it for my projectiles and seamless 2 world approach.

My modifications are still not vetted though and it breaks the sampling.

Main problem being someone sitting on a stitch line (or near it), or even worse the parts where 3 tiles are stitched.

External Physics Functions seem to sample the playerCharacters in the area the external function script is called from. It would be amazing if they sampled areas stitched when sampling overflows a stitch. From my testing this does not happen so I have made my own modifications to sample for that.

I am testing with call area and reply.
I was also contemplating the use of proxy nodes for the ability node. This would be needed for my game as character loadout will affect the Ability node.

I believe I will have to use both but clarification on this would be nice.



« Last Edit: Jan 19, 15, 05:34:20 PM by nocake »
Logged

_Omzy_

  • General Accounts
  • *
  • Posts: 24
    • View Profile
Re: Area of Effect Abilities
« Reply #2 on: Jan 19, 15, 07:51:57 PM »

I am not using the seamless technology (fortunate for me) so it seems like a good option. I'm a little worried about the time it takes to process the command with a large number of targets since it has been lagging on my heroblade. I haven't tested it yet with the client, though, so I will try to do that and reply back. Have you experienced a different between heroblade and the client on lag with this?
Logged
-OMZY-
Odyssey of Ydris

Warded

  • General Accounts
  • *
  • Posts: 34
    • View Profile
Re: Area of Effect Abilities
« Reply #3 on: Jan 20, 15, 08:25:46 PM »

Client runs a lot better then the blade. The blade has to load a ton more information than the client so you should see significant gains.
Logged

keeperofstars

  • General Accounts
  • *
  • Posts: 998
    • View Profile
    • StarKeeper Online
Re: Area of Effect Abilities
« Reply #4 on: Jan 20, 15, 08:46:51 PM »

NoCake problem is you are providing an area coordinate, Every area has it's own coordinate system, when you phsycially cross over a seamless link, and the server does it's transport of the object across the areas it translates the world position of the player to the new area based on the offset of the areas, established when in linking mode.

So the getTargets uses your current area's coordinate system but doesn't by default access the seamless area offset values to provide it an offset for the other areas. Also if you aren't using a proxy node setup the local server area itself has zero idea about the players in the other area.

So it's a two form factor issue. 1.) have to proxy the nodes to deal with the issue of your local area server knowing about the other area's players, 2.) possibly having to figure out how to read the joined areas and their seamless offset values so you can offset your getargets, which means you might have to make 4 calls to getTargets per cast, if you are at a square corner aspect.



_Omzy_ Can I ask how you plan on building your world without the seamless technology either version1 or seamless 2.0?
Granted if you doing like an arena battle zone, that is a bit of a different story, as that works well, but if you trying to go for an open space area. Then probably going to want one type or the other of seamless. Also keep in mind your arena size if you are doing that type of setup in regards to how many people you plan per instance.

Logged
[img]http://screencast.com/t/x7btcSSyp3h0[\img]

_Omzy_

  • General Accounts
  • *
  • Posts: 24
    • View Profile
Re: Area of Effect Abilities
« Reply #5 on: Jan 21, 15, 08:11:39 PM »

I'm going to have old school zones with zone lines where players go through a 'S' hallway and have a short loading screen. I'm not doing that for simplicity or to avoid new technology--I'm doing it for gameplay reasons. Should never really have over 60-80 players in a single zone with the average being somewhere like 15-30. Should I have any concerns with that setup?
Logged
-OMZY-
Odyssey of Ydris

Warded

  • General Accounts
  • *
  • Posts: 34
    • View Profile
Re: Area of Effect Abilities
« Reply #6 on: Jan 21, 15, 08:34:41 PM »

I'm going to have old school zones with zone lines where players go through a 'S' hallway and have a short loading screen. I'm not doing that for simplicity or to avoid new technology--I'm doing it for gameplay reasons. Should never really have over 60-80 players in a single zone with the average being somewhere like 15-30. Should I have any concerns with that setup?

No way for us to tell you if you will or won't. Depends on too many factors, mainly your ideal prim count for an area and characters. That's something you will need to test out when you can, even if it's just a simulation for now which I believe they discuss in the Wiki at some point (basically a built out area and then adding npcs coded to do something).
Logged

_Omzy_

  • General Accounts
  • *
  • Posts: 24
    • View Profile
Re: Area of Effect Abilities
« Reply #7 on: Jan 22, 15, 05:14:38 PM »

Ok, I'll have to wait until I've got a bunch more systems finished before I can do those kinds of load tests. I did use SYSTEM.TIME.MILLISECONDTOTAL to time how long these functions were taking with a varied number of targets and they are for sure running in nanosecond time up to at least 10 targets, so they seem to be very efficient (as expected since they are wrapped C++). I believe the lag I was experiencing was related to using the 'println' function to print the states for my effects which were applied to each target on impact. Every println statement communicates with the blade chat box, which seems to run synchronously so commenting those lines out made it run lightning fast with no framerate drop whatsoever.
Logged
-OMZY-
Odyssey of Ydris