VaultNetwork.net Vault Network Boards
Author Topic: Question regarding plugin overhead... [Locked]
yaroz_vn  4 stars
Posts: 1,225
Registered: 2002-6-30 20:08:11
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
Drakier  4 stars
Posts: 1,486
Registered:
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.
Virindi-Inquisitor  4 stars
Posts: 1,538
Registered: 2001-11-18 22:25:54
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
Drakier  4 stars
Posts: 1,486
Registered:
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.
yaroz_vn  4 stars
Posts: 1,225
Registered: 2002-6-30 20:08:11
Alrighty.

 

-----signature-----
Proud member of The Knights of Fortune
Mr Adventure - Lil' Pew - Da Noob - Qar
Yaroz - Yanno
http://www.fortunesway.com
Drakier  4 stars
Posts: 1,486
Registered:
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.
fitzbean
Posts: 34
Registered:
I would think ACTool could even do something like this.

VaultNetwork.net is an independently operated community forum and is not affiliated with, endorsed by, or technically based on IGN, GameSpy, FilePlanet, GameStats, or the former IGN/GameSpy Vault Network.
References to VaultNetwork.net mean this site/domain. VNBoards-style presentation is a visual homage only. By using this site, you agree to the forum rules.