Author Topic: Question regarding plugin overhead...
yaroz_vn 
Posts: 12,255
Registered: Jun 30, '02
Extended Info (if available)
Real Post Cnt: 12,168
User ID: 693,371
Subject: Question regarding plugin overhead...
I'd like a plugin that would read a .xml file with a main character and all of their alt's listed, then whenever they say something in /a or whatever, it puts their name in parentheses. How much of a burden would this put on the client, and how easy would it be to do? I imagine having at least 100 characters listed for an allegiance, with 20ish mains.

 

-----signature-----
Proud member of The Knights of Fortune
Mr Adventure - Lil' Pew - Da Noob - Qar
Yaroz - Yanno
http://www.fortunesway.com
Link to this post
Drakier 
Posts: ????
Registered: ????
Extended Info (if available)
Real Post Cnt: 0
User ID: 0
Subject: Question regarding plugin overhead...
yaroz_vn posted:
I'd like a plugin that would read a .xml file with a main character and all of their alt's listed, then whenever they say something in /a or whatever, it puts their name in parentheses. How much of a burden would this put on the client, and how easy would it be to do? I imagine having at least 100 characters listed for an allegiance, with 20ish mains.


Plugins without views actually have very little memory requirements or other overhead. If all your plugin did was sit there and look at /a chat with no configurable or view options, then I'd imagine it would be pretty tiny.

 

-----signature-----
Link to this post
Virindi-Inquisitor 
Posts: 6,908
Registered: Nov 18, '01
Extended Info (if available)
Real Post Cnt: 6,646
User ID: 511,923
Subject: Question regarding plugin overhead...
Be sure to use an O(1) hashtable to hold the player names.

 

-----signature-----
Virindi
---
****Virindi Plugins FAQ**** http://www.virindi.net/wiki/index.php/Virindi_Plugins_FAQ
http://www.virindi.net - Virindi Tank, Follower, Integrator, Reporter, VCS5, XPHelper, Item Tool, HUDs, etc...
Decal Core Dev - http://www.decaldev.com
Link to this post
Drakier 
Posts: ????
Registered: ????
Extended Info (if available)
Real Post Cnt: 0
User ID: 0
Subject: Question regarding plugin overhead...
Virindi-Inquisitor posted:
Be sure to use an O(1) hashtable to hold the player names.


yes.. a very good suggestion. You don't want to be "Searching" through the list each time to attempt to find the name of the player.

 

-----signature-----
Link to this post
yaroz_vn 
Posts: 12,255
Registered: Jun 30, '02
Extended Info (if available)
Real Post Cnt: 12,168
User ID: 693,371
Subject: Question regarding plugin overhead...
Alrighty.

 

-----signature-----
Proud member of The Knights of Fortune
Mr Adventure - Lil' Pew - Da Noob - Qar
Yaroz - Yanno
http://www.fortunesway.com
Link to this post
Drakier 
Posts: ????
Registered: ????
Extended Info (if available)
Real Post Cnt: 0
User ID: 0
Subject: Question regarding plugin overhead...
yaroz_vn posted:
Alrighty.


I don't know how much you know about Hashtables, but here is a basic intro.

Hashtables are also called "Dictionaries". They have 2 pieces needed for storage. A Key which has to be unique, and a Value which is the data you want to reference by the Key.

A hashtable works by performing a "hashing" function on the "Key" which gives an instant Index for the array. The Array is fairly large to accommodate a lot of values initially. The actual size varies on declaration and implementation. You trade off space for speed.

they normally do something like hash(name) % arraysize to produce a value between 0 and (the size of the array - 1)

This allows almost instant access to your Value since hash(name) will ALWAYS produce the same number. That's the point of the hash function.

So.. if you use the "alt name" as the Key (since it should be the unique name anyway) then you can QUICKLY use that name to determine the VALUE associated with it (the Non-unique MAIN identity).

So you'd basically have hashtable['altname'] = 'mainname'

Then when you want to read the main name, you'd just again reference hashtable['altname'] and it would give you the mainname directly. No "Searching" through arrays or other collections. Even a binary search takes time AND the names have to be sorted first.

 

-----signature-----
Link to this post
fitzbean 
Posts: ????
Registered: ????
Extended Info (if available)
Real Post Cnt: 0
User ID: 0
Subject: Question regarding plugin overhead...
I would think ACTool could even do something like this.

 

-----signature-----
Link to this post

Valid XHTML 1.0 Transitional Powered by PHP