Page 1 of 1

concept question #enemies around unit increase damage taken?

Posted: 26 Mar 2012, 03:07
by saberRattler
trying to think of a way to implement this idea from http://aichallenge.org/

under battle resolution in game specification:

Code: Select all

(enemies(of my unit) in range of ant) >= (enemies(of enemy unit) in range of enemy)
Is this possible?

I was thinking of taking a circle radius around my unit and finding all units in that circle, take # friends and # foes and adjusting UnitDamaged() by some percent multiplied by the # of friends(less damage) or foes(more damage)...any opinions? Will calculating all of this slow the game too much?

Re: concept question #enemies around unit increase damage taken?

Posted: 26 Mar 2012, 03:39
by knorke
yes, that is possible and should not be too hard.
getting units in circle: Spring.GetUnitsInCylinder
http://springrts.com/wiki/Lua_SyncedRead#GetUnits
Will calculating all of this slow the game too much?
should be doable without too much slowdown, of course depends on number of units etc.

Maybe it will be faster to call Spring.GetUnitsInCylinder every n frames, (instead of every time a unit gets damaged) and store the results. Depends on how many units you have, how fast they shot etc.

Re: concept question #enemies around unit increase damage taken?

Posted: 26 Mar 2012, 04:17
by saberRattler
sounds good, will try this out :)