On Tue, 5 Nov 2002, Jesse Becker wrote: >If you store the entire array, that would also make the .mob files larger, >unless you stored only the non-zero values. CircleMUD's convention is 0 for a skill is unlearned, so that fits. >The other downside having each mob have an entire array of skills is that >you have to then keep a second list of which ones they can actually use; >otherwise you have to do a linear search on the array for each mob to >determine what skills the can use. If you have a list, then you just walk >the list (which will almost always be very short). If the array value is 0, then they can't use it. If you don't want them to use a skill, don't set the value. :) And it might be faster[1] to scan a small, linear block of memory than it is to follow pointers all over virtual memory and back chasing nodes. -- George Greer greerga@circlemud.org 1: 300 byte array vs. 2 node list would lose, obviously. But chasing 50 nodes positioned pseudo-randomly in memory is really bad for your caches. That's the downside of a really big linked list: cache misses. And cache misses on a Pentium IV _really_ suck. -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | | Newbie List: http://groups.yahoo.com/group/circle-newbies/ | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT