ID:161346
 
obj/png
New()
var/icon/i = icon('test-png.png')
for(var/turf/t in world)
i.DrawBox(t.minimapColor,t.x,t.y)
icon = i
//sleep()

..()

mob/verb/test()
var/obj/png/o = new
src << o.icon

turf/var/minimapColor

turf/grass
icon = 'grass.dmi'
New()
minimapColor = rgb( 0 , rand(125,220) , 0 )

turf/water
icon = 'water.dmi'
density = 1
New()
minimapColor = rgb( 0 , 0 , rand(175,220) )

turf/mountain
icon = 'rock.dmi'
density = 1
New()
minimapColor = rgb( rand(100,150) , rand(53,100) , 0 )


test-png.png is a 100x100 pixel png file.

The procedure checks for all turfs on the map and Draws pixels on a file according to their co-ordinates, giving the final product a minimap kind of look.

They all have random minimap colors so it looks quite good. I just can't get around the amount of time it takes to make, or the resources it uses. Isn't there any way to make this procedure more efficient and faster?
One thing I see immediately that you could do is put the icon = i line out of the loop. It only needs to be done once after the /icon object is built, so put it after the loop.
The way you have it now, for every turf the /icon object will be converted to an icon file, every iteration, which will cause much extra overhead, of course.
In response to Kaioken
Ah, thanks. Being a mediocre programmer is tough to get a hold over.
In response to Metamorphman
It's not a "mini" map if it's pixel per pixel.. unless you mean tile by tile.
In response to Kaiochao
It's an image drawn pixel by pixel. So I think It's safe you use the term here.