Quantcast
Channel: Recent Discussions — Beamdog Forums
Viewing all articles
Browse latest Browse all 105449

NWScript function efficiencies

$
0
0
I'm a little curious to see if there's any information on how efficient some of the functions in NWScript are. I've heard that local variables are stored on objects as a linked list, for instance, so I'd imagine that GetLocalString and SetLocalString are O(N).

There are a lot of functions in NWScript, so to limit my query down, I'm particularly interested in functions that perform searches of objects or creatures. Specifically:
  • GetObjectByTag
  • GetNearestCreature / GetNearestCreatureToLocaiton
  • GetFirstObjectInShape / GetNextObjectInShape
How efficient is it to find an object by a tag? Do tags get a O(1) hashtable lookup? Some sort of O(log N) tree? Or is it another linked list?

How efficient is it to search for nearest creatures or objects? Is it always an O(N) iteration over all objects in the area? Is it an iteration over a list restricted by type? Is there something more sophisticated like an quadtree lookup?

If a Beamdog dev could weigh in, I'd be very grateful!

Viewing all articles
Browse latest Browse all 105449

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>