Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-14-2006, 08:20 PM
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
Optimizing showimgs?

I really think there's a bit of need for documentation on how to best optimize the use of showimgs. It tends to take a lot of processor time when I use them in particular ways. How do you optimize using showimgs?
Reply With Quote
  #2  
Old 10-14-2006, 08:27 PM
_Z3phyr_ _Z3phyr_ is offline
Banned
Join Date: Sep 2003
Location: Louisiane
Posts: 390
_Z3phyr_ is an unknown quantity at this point
My best guess is a for loop or a particle effect?

for (i=0;i<max;i++) { showimg(i,"imagename.png",x,y); }
Reply With Quote
  #3  
Old 10-14-2006, 08:32 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by jake13jake View Post
I really think there's a bit of need for documentation on how to best optimize the use of showimgs. It tends to take a lot of processor time when I use them in particular ways. How do you optimize using showimgs?
Solution: Buy a new computer.

?
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #4  
Old 10-14-2006, 09:43 PM
Maniaman Maniaman is offline
Registered User
Join Date: Aug 2005
Posts: 326
Maniaman is on a distinguished road
Don't constantly redraw them unless you have to.
__________________

Current Maloria Event: (click to go to it)
Reply With Quote
  #5  
Old 10-15-2006, 06:57 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
Lightbulb

Quote:
Originally Posted by Maniaman View Post
Don't constantly redraw them unless you have to.
I'm thinking of a nick system. If you have to constantly redraw them, you might want to minimize the amount of data in the showimg object in which you're modifying.

Here is my conflict. You'll have to cycle through all the players to check if they're in an area since you. There's no findnearestplayers function clientside, although I would find a findareaplayers function much more usable.

Even with findnearestplayers or findareaplayers, that array would be constantly different, so the index of your showimg would be constantly changing in reference to that array. New people could enter the area, people could leave the area, and people could also reenter the area. How would this be handled? Does the index of your showimg even matter in terms of optimization?

Another thing I would worry about is if you hide an image but want to show it again at some point. At least some of the data could remain the same. While text, x, y, and rgb could all change, some have longer update times than others (text, rgb). Can you even do that or would you be forced to reinstantiate the object?

While a findareaplayers function may not be the most efficient way of showing a nick of every player, if you could store the showimg objects in an array and stop the work of showing without destroying the data, it would be good to use in the sense that it would reduce the cycles you would need to look for the showimg objects you need to change, and it can probably be more efficiently done in a function in the language than a function not in the language. The reason there is a findareanpcs function and not a findareaplayers function is because the number of players is generally low enough that you don't have to worry about optimization, but in the case of using showimg objects, you would want to because showimg objects are quite processor intensive.
Reply With Quote
  #6  
Old 10-15-2006, 10:40 AM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by jake13jake View Post
I'm thinking of a nick system. If you have to constantly redraw them, you might want to minimize the amount of data in the showimg object in which you're modifying.

Here is my conflict. You'll have to cycle through all the players to check if they're in an area since you. There's no findnearestplayers function clientside, although I would find a findareaplayers function much more usable.

Even with findnearestplayers or findareaplayers, that array would be constantly different, so the index of your showimg would be constantly changing in reference to that array. New people could enter the area, people could leave the area, and people could also reenter the area. How would this be handled? Does the index of your showimg even matter in terms of optimization?

Another thing I would worry about is if you hide an image but want to show it again at some point. At least some of the data could remain the same. While text, x, y, and rgb could all change, some have longer update times than others (text, rgb). Can you even do that or would you be forced to reinstantiate the object?

While a findareaplayers function may not be the most efficient way of showing a nick of every player, if you could store the showimg objects in an array and stop the work of showing without destroying the data, it would be good to use in the sense that it would reduce the cycles you would need to look for the showimg objects you need to change, and it can probably be more efficiently done in a function in the language than a function not in the language. The reason there is a findareanpcs function and not a findareaplayers function is because the number of players is generally low enough that you don't have to worry about optimization, but in the case of using showimg objects, you would want to because showimg objects are quite processor intensive.
Hello? Ever heard of ganis?
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #7  
Old 10-15-2006, 02:36 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by xXziroXx View Post
Hello? Ever heard of ganis?
Lol yeah. Plus alot of servers have custom nick systems without problems... I don't see how it could ever be CPU intensive really.
Reply With Quote
  #8  
Old 10-15-2006, 02:47 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by Twinny View Post
Lol yeah. Plus alot of servers have custom nick systems without problems... I don't see how it could ever be CPU intensive really.
It will take ALOT of CPU unless its scripted into a gani, trust me - Ive tried it.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #9  
Old 10-15-2006, 02:49 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Also cycling through players[] (even allplayers[]) is quite fast, I would say that the speed problem is somewhere else. On Zone the nicknames are displayed for all players when you press N, and it's fast.
Reply With Quote
  #10  
Old 10-15-2006, 09:46 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by xXziroXx View Post
It will take ALOT of CPU unless its scripted into a gani, trust me - Ive tried it.
You must have been doing it quite oddly then
Reply With Quote
  #11  
Old 10-15-2006, 11:26 PM
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 Stefan View Post
Also cycling through players[] (even allplayers[]) is quite fast, I would say that the speed problem is somewhere else. On Zone the nicknames are displayed for all players when you press N, and it's fast.
Alright, I'll time it and put in the averages. You know though, it isn't so much the cycling through players I expect to be slow, it's the modification of data based on that.

I don't know why the nick system is so slow -_-.
the GUI state system is pretty slow too, but that's because of storm's absurd use of variables in the prior system that I haven't gotten out of using yet.

Last edited by jake13jake; 10-16-2006 at 12:06 AM..
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:44 AM.


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