10-01-2007, 05:02 AM
Okay right now, for NPCs everytime they're supposed to start moving, the server does a for i = 1 to max_maps, then inside of that it does a for x = 1 to max_map_npcs (or something like that).... wouldn't it be much better... to use a multi-dimensional array, to store the NPCs location (map, x/y), so you could avoid those two loops altogether? Would it make more sense to constantly update memory with their locations rather than run thousands of loops every X amount of time? (2500 Maps x 20 Map Npcs... lots of loops just to MOVE them)
My thought was just, as soon as they spawn... store their location in an array. Then just update from there, rather than return hundreds and hundreds of 'exit subs/functions' because it ran through an unnecessary loop...
My thought was just, as soon as they spawn... store their location in an array. Then just update from there, rather than return hundreds and hundreds of 'exit subs/functions' because it ran through an unnecessary loop...