%c = clientGroup.getCount();for(%a = 0; %a < %c; %a++){ %cl = clientGroup.getObject(%i); %cl.dostuff();}
for(%i = 0; %i < clientGroup.getCount(); %i++){ %c = clientGroup.getObject(%i); //blah blah blah}
Couldn't you just doCode: [Select]for(%i = 0; %i < clientGroup.getCount(); %i++){ %c = clientGroup.getObject(%i); //blah blah blah}
Couldn't you just doCode: [Select]for(%i = 0; %i < clientGroup.getCount(); %i++){ %c = clientGroup.getObject(%i); //blah blah blah}?
The way we did it is the properly efficient way
uses more cpu cycles to call the function once for every client.
That's less efficient, because it calls getCount every time it goes to the next client instead of just once
Theory: define an array of clients for even more efficiency instead of calling ClientGroup.getObject(); every timeThoughts?
Doubt it, you now have to keep that up to date (if someone (dis)connects your data will be outdated). And seriously, even with 99 players this kind of optimization doesn't really matter in this case unless you're doing it in an extremely tight loop.
Yeah, agreed, it's pointless. Assuming that Torque implements SimGroups as a linked list like they should, it won't bring much optimization to the table.
Code: [Select]%c = clientGroup.getCount();for(%a = 0; %a < %c; %a++){ %cl = clientGroup.getObject(%i); %cl.dostuff();}
I don't think having it in a linked list would give a very big benefit if the API is that of an array.
How is having O(1) pushing and popping not important for a sim group?