![]() |
mMinimapby Metamorphman |
To download this library for your Linux/Mac installation, enter this on your command line:
|
Advertisement Metamorphman: (Nov 17 2012, 12:12 am)
Well, as I said in my comment, I would terminate the loop when the mob's standing still. The reason I prefer using the loop is that it would take more processing power to perform checks every time Move() is called than to just do it periodically in a loop.
FIREking: (Nov 16 2012, 9:49 pm)
DM is largely event based, and you should never use loops if you can avoid it. Most of the time it can be avoided. You just need to keep track of who's viewing what, then you know who to tell something has changed in the event that the change is made. This is the most efficient way to do it. Think about it, what if there's a mob that doesn't move at all, your looping method would be redrawing that mob's position and wasting computer power and network bandwidth even though he stands still. Metamorphman: (Nov 16 2012, 9:24 pm)
Thanks for taking the time to actually write all that out! Every point you raise is of course quite right. I think I initially wrote this for a competition for a bare bones minimap system, back when I was more noobish. I don't think I ever intended for it to be used in a multiplayer environment. It might be a good idea to update it at some point in the future with all of today's new gadgets and doohickies and whatnot :P
About the one point you raised, the entire graphic is not redrawn. The main overworld is cached in background_icon and then the box is drawn over it each update. I'll use some javascript to solve this and draw the box as an overlay client-side. There are some points that get a bit more interesting upon further inspection though. I think having it in a loop with a simple check to see if the location has changed might be better than calling the check every time in Move(). Although I guess it can be terminated after some time standing still and then restarted upon movement. What do you think? Thanks! :) FIREking: (Nov 16 2012, 4:36 pm)
Hmm, there seems to be quite a bit wrong about this implementation, rightfully so being done so long ago. You should only update the tracked locations each time they change (like in Move() for example), rather than in a loop. You should also define what is trackable and what isn't via type path (like /atom/movable/trackable, for example). Finally, instead of redrawing the entire graphic in a loop, you should never update the image unless a turf is changed and then keep a copy of each tracking point and "move" it around. Creating a new icon is very costly over the wire, which is what's happening here in your demo. Just some constructive criticism. Feel free to ignore any of the points I've raised!
|
Copyright © 2013 BYOND.
All rights reserved.

That's not actually true.