HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Too many units: Reducing lag

09-26-2004, 03:08 AM#1
th15
I've been working on a territory system where players own actual territories. Each territory is marked out with little CoPs to define the boundaries.

The thing is, since I need these boundaries to change team colour, they are actual units. In all, my map has around 1200 boundary units.

The problem is that with so many units, the game lags. It kinda jitters every 1.5 seconds. Very noticeable when you scroll.

I've been trying ways to reduce lag. Making all the boundaries have the locust ability completely got rid of the lag. However, units with locust are not picked with the pick-unit-group triggers so if they have locust, my territory system doesn't work.

Does anyone have any other ideas about how I can reduce lag (I've tried changing the boundaries to building units, turned their collission off using triggers, tried them as flying units etc)? Or mayeb someway that I can select locusted units using triggers (that hopefully doesn't involve me adding every single one to a unit group array).
09-26-2004, 03:11 AM#2
Aznwhore
depends on what unit model you're using
if you're using 1000 furions, your computer would explode
les, if you're using something like...er... no idea, just something that has no particles and looks like it's very plain and simple, it should reduce the lag

sry if this sounds too newbish, im half drunk from all that crap the orthodontist put in my mouth
09-26-2004, 03:27 AM#3
th15
Uhh, I'm using the Circle of Protection (CoP)...

Its not a model poly count thing. If it were simply a graphic thing then locust would have no effect on it. I suspect that's its got something to do with how the game calculates pathing (it's probably calculating collision cells for all 1200 CoPs every couple of seconds) but I can't figure out a way (besides locust) to affect that.
09-26-2004, 05:02 AM#4
Panto
If Locust worked, it's possible that doing something like setting the units as Wards would help. A unit with the Ward classification counts as selectable and attackable, and it has the necessary unit abilities to engage in combat and cast spells and whatnot, but it doesn't show anything in the command card.

Worth a shot, anyway. I've never tried evaluating it for processor intensity.
09-26-2004, 07:17 AM#5
garith
Quote:
Originally Posted by th15
Uhh, I'm using the Circle of Protection (CoP)...
.

I have no idea if this would work but a few triggers could probobally remedy your locust problem.

Simply add "remove unit ability LOCUST" before changing team color in triggers and replace it with
"Give unit ability locust"

I dont know if this would increase lag when boundries change, but im pretty sure it would work in general... it really depends on the triggers u used....

Good luck then!
-Garith
09-26-2004, 07:22 AM#6
DarkMage
You could also try setting each area's CoPs to Unit variables then you can still have locus and change there color.
09-26-2004, 07:34 AM#7
garith
Quote:
Originally Posted by DarkMage
You could also try setting each area's CoPs to Unit variables then you can still have locus and change there color.

Wouldent that require LOADS of triggers? seeing as Th15 has about 1200 and the unit GROUP selection is limited to 12, he'd have to have 100 triggers working and even then, it'd look odd moving in groups of 12 solid!
09-26-2004, 09:09 AM#8
th15
garith- Unit group variables are NOT limtied to 12. You can only order up to 12 units in a unit group, but many many more can exist in a unit group variable (i've no idea what the upper limit is, probably 655356)

DarkMage- That looks to be my only way. I said that I would rather not have to do that because that would need a fat unit group array. If I did it using variables I would assign the units to a variable before the game starts then add locust to each CoP after assigning the variable.

garith, again- The problem with locusted units is that I can't even pick them to begin with so I wouldn't be able to remove the locust ability. Actually, thinking about it now, maybe I could temporarily disable the locust ability... hmmm.

Panto- Tried making them wards, no effect. Very strange. :( Wards still have collision size so I strongly suspect that the lag is caused by blizzard's pathing cell system.
09-26-2004, 12:35 PM#9
logik
y not tighten up the number of boundries? use less...


like use them more for corners etc. but use less over staight un-edited lines etc.
09-26-2004, 01:23 PM#10
ObsidianTitan
You mentioned several things you tried to reduce the lag (collision off through triggers and making them flying), but ive got a couple other things to try if you haven't already. Setting collision really small (on the actual unit not through triggers), getting rid of their shadow, turning selection size all the way down, or maybe all of these things at once.
09-26-2004, 03:14 PM#11
th15
I've already tried all of that. I'm jsut using unit-group arrays and locust to do it.
09-27-2004, 02:38 AM#12
Kiradacon
What kind of project are you workin on Th15? I love the capture areas kinda thing. Any keeps or castles involved :]?
09-27-2004, 03:55 AM#13
garith
Th15, your forgetting that using them all as one big Unit Group variable would involve mass changes, and this would probobally make all of the selected change color, involving some MESSY boundry changes.

I sugest setting the locust ability to an intiger value at the start and then giving all CoP's the locust ability (Through the Intiger value) and then disabling all abilities with specific interger value before changing boundry color and then enabling all abilities with intiger value after.

I havent played around with intiger values enough to know for sure if this would wok, but i think that it should seeing as it works on a prograsming and not selective basis.

Just a sugestion.. it might work, but no garuntees

Keep up the Good work Th15,

-Garith
09-27-2004, 10:54 AM#14
th15
Actually I've already implemented the system and there's no trouble.

What I'm doing is assigning all the boundaries in each territory (I already have an array of territories that I painstakingly initialize at the start of the map) to a unit-group array at the start of the game. The index for this boundary array corresponds to the index for the territories (i.e. All boundary units in territory[1] = units in boundaries[1]).

When a player builds a settlement in a territory area, I traverse the territory array (using a for-loop) checking if the built unit is in the territory I'm checking. When it finds the territory containing the built unit, it changes owner of all units in boundaries[for loop integer A].

Doing it this way is actually more efficient than my previous method of picking every unit in a territory each time a territory is captured.

Tank Commanders taught me a lot about how to abuse arrays :)

If anyone is wondering, this is fo a diplomacy-style game... I'll post more info on it when I'm ready to release it. Suffice to say that I have a working alpha-build right now.