
03-11-2006, 03:34 AM
|
|
Former Classic Staff
|
 |
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
|
|
Quote:
|
Originally Posted by ApothiX
The actual programmed version of it probably wouldn't be any more efficient than a scripted version. Either way, it's only doing simple checks.
PHP Code:
function findAreaPlayers(tx, ty, tw, th) {
for(temp.pl: players) {
if(temp.pl.x in |tx,tx+tw| && temp.pl.y in |ty,ty+th|) {
temp.plarray.add(temp.pl);
}
}
return temp.plarray;
}
or something like that.
|
Yes... I know.... You're making me repeat myself? The reason I'm suggesting this is the LAG factor.
Quote:
|
Originally Posted by jake13jake
Yes, but it wouldn't be nearly as efficient. It would be more efficient to script this yourself if you had findnearestplayers(x,y) clientside. It would be even more efficient if there were a findareaplayers(x,y,w,h). The reason these types of functions exist would be to reduce the lag of cycling through all the players in the array. It's a lot more evident that this would be needed for NPCs, but if you're drawing a lot of info around a lot of objects which include players (esp. on a GMAP), it would be more efficient to use something like findareanpcs(x,y,w,h). Players have a much smaller impact (that's why this function doesn't exist yet), but still have an impact if there are a lot of scripts looking through all of them.
|
|
|
|
|