Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   findareaplayers(x,y,w,h)? (https://forums.graalonline.com/forums/showthread.php?t=64627)

jake13jake 03-09-2006 04:16 AM

findareaplayers(x,y,w,h)?
 
I feel this would be quite useful in optimization of many NPCs (damage, checking the visible field on the playing screen for displaying stats of players, etc). A little bit more useful than findnearestplayers(x,y) I think.

jake13jake 03-10-2006 03:40 AM

Hmm yea, still finding a lot of places this would help optimize a lot. Nick name system, movement system (especially), ratings system. If findareanpcs reduces lag to like 4% from 30%... I would think that findareaplayers would reduce lag from 4% to like <=1%

Warcaptain 03-10-2006 03:47 AM

you can use findnearestplayers(x,y)

projectigi 03-10-2006 02:27 PM

uhm cant u script this yourself?

jake13jake 03-10-2006 08:45 PM

Quote:

Originally Posted by Warcaptain
you can use findnearestplayers(x,y)

Not clientside.

Quote:

Originally Posted by projectigi
uhm cant u script this yourself?

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.

ApothiX 03-11-2006 03:15 AM

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.

jake13jake 03-11-2006 03:34 AM

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.



All times are GMT +2. The time now is 12:18 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.