Sins of a Solar Empire : Real-Time Strategy. Unrivalled Scale.
© 2003-2013 Ironclad Games Corporation Vancouver, BC. All rights reserved.
© 2006-2013 Stardock Entertainment

What uses more processing power? Active Instant Action, or Passive Periodic Action??

By on August 17, 2012 5:09:47 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Seleuceia

Join Date 01/2008
+141

This was something I thought about today....

Consider two abilties:

  1. Passive ability that uses a periodic action to apply a buff X
  2. Active ability that uses an instant action to apply a buff X

So, which one uses less processing power?  At face value, intuitively I'd think the active using an instant action....but let us add some extra considerations...

Let's say I want to apply a buff X (via an entity like a ship, SB, or structure, doesn't really matter) to the local planet...furthermore, this buff has no time limit (something like an owner change may end the buff, but that's not important)...now, let us reconsider the two above options...

The passive ability has to apply the buff every t seconds...so, that's an action the processor has to consider every t seconds...

Unlike the passive, the active ability is guided by an autocast...so, while their is no periodic action sucking up processing power, does the game not need to perform "checks" to see if it should activate?  For example, the game should not activate this particular ability more than once since (to my knowledge) autocasts check to see if the buff has already been applied (at least targetted buffs, and I hope buffs applied to local orbity body)....

So the core of my question lies in this...in order to "see" if the buff already exists, wouldn't the autocast function have to constantly perform "checks"?  How is that different than a periodic action that performs an action every t seconds?  Would the active ability using an instant action (guided by autocast) really be any more efficient than the passive ability using a periodic action?

1 Reply
Search this post
Subscription Options


Reason for Karma (Optional)
Successfully updated karma reason!
August 18, 2012 11:19:14 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

It's impossible to know without looking at the code, but it is likely that the passive ability will be slightly cheaper from a CPU utilization standpoint. Yes, the engine is going to be going through each autocast ability for each ship/structure some number of times each second to check if it should fire. The amount of overhead you add to this will depend on the condition and target assigned to the ability, for example the aiUseTime "OnlyWhenManyTargetsInRange" condition will be more expensive than aiUseTime "OnlyInCombat".

But for non-expiring buffs the best way is to copy the phase gate ability. The ability puts a buff on the module once, and the module puts a buff on the planet once. The planet buff has a finishCondition defined, so it will be removed when the module buff is no longer active (i.e. it is destroyed).

Reason for Karma (Optional)
Successfully updated karma reason!
Stardock Forums v1.0.0.0    #108436  walnut3   Server Load Time: 00:00:00.0000047   Page Render Time: