ID:2164486
 
(See the best response by Fat Albert.)
Code:
mob/var/radius = 15

mob/proc/radar( r = radius )
for( var/x in client.screen )
if( !istype( x, /obj/hudbg ) )
client.screen -= x

var/isOdd = ( radius*2+1 % 2 )
screen_loc = "radar:" + ( isOdd ? "[radius+1],[radius+1]": "[radius+1]:16,[radius+1]:16" )
client.screen += src

for( var/atom/movable/a in orange( r, src ) )
var/hx = "[r+1+(-( x-a.x ))][isOdd? "":":16"]"
var/hy = "[r+1+(-( y-a.y ))][isOdd? "":":16"]"
a.screen_loc = "radar:[hx],[hy]"
client.screen += a

mob/verb/changeRadius( n as num )
radius = min( max( 1, n ), 25 )
client.screen = list()
var/reach = radius*2+1
client.screen += new /obj/hudbg( "1,1 to [reach],[reach]" )
radar()

obj/hudbg
icon='GRND.dmi'
icon_state="grass"
layer = 1
New( screen_loc )
. = ..()
src.screen_loc = "radar:[screen_loc]"

client/New()
screen += new /obj/hudbg( "0,0 to 30,30" )
..()

mob/Move()
. = ..()
if( . )
radar()



Problem description:
i been trying to make it so it doesnt show just objects but turfs i made it show but it made so much lag i removed it and i been trying to add it but without success can anyone tell me if theres a way to do it
There is but, individually looping your surrounding atoms per call will definitely cause unwanted lag spikes. I was planning on releasing a nice minimap demo when the stable 511 is released with TILE BOUNDS flags. I can however release a demo for ya, but your going to have to do a bunch of playing around with variables because the minimap will produce unwanted screen borders depending on the size of your world map.
Best response
Okay, I quickly put together a project that you can use or look at to help you can create a minimap that suits your needs.
http://www.byond.com/developer/FatAlbert/x_minimap

Basically, the worldmap is rendered/loaded into a single icon. Every player receive a copy of the icon. Onscreen hud objects crop the entire minimap to a specific area. And whenever the player moves the worldminimap shifts onscreen in appropriate direction.


The code isn't perfect, but it works. I use it for many of my games. If you have any questions feel free to ask.
Like Fat Albert said, those loops are going to cause some serious damage. Alternatively, there are additional alternative mini map libraries that can be found here: http://www.byond.com/developer/?text=mini+map

There also is the library Fat Albert suggested; I'm not familiar with any of these libraries but I'd bet that Fat Albert's one works just fine and dandy.