View Single Post
  #7  
Old 03-11-2006, 03:34 AM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
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(txtytwth) {
  for(
temp.plplayers) {
    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.
Reply With Quote