ID:2091029
 
Hey guys, I'm doing some simple code to do FULL SIZE map rendering through ingame code. IE, map rendering larger than 1024x1024 by using my own larger base icon imported in to blend upon, I have previously gotten 2000x2000 icons to work before, but this is a magnitudes larger at 16000x16000 size.

I believe my primary problems here are
1. Getting some mysterious runtimes that I can't find any information about what they would mean in this context, so I would assume they are unusual, they only show up twice as shown below, which is unusual since they should show up hundreds/thousands of times or not at all.
BYOND Error: failed to write new icon. at :
proc name: New (/icon/New)
usr: Deangelo Jerome (/mob/dead/observer)
src: /icon (/icon)
usr.loc: the floor (154,258,1) (/turf/simulated/shuttle/floor)
call stack:
/icon (/icon): New('icons/turf/space.dmi', "19", 2, 1, 0)
getFlatIcon(space (2,28,1) (/turf/space), 2, 1, 0)
Clusterfack (/client): nanomapgen DumpTile(1, 1)
Clusterfack (/client): maprenders()

runtime error: BYOND Error: failed to write new icon.
proc name: New (/icon/New)
usr: Deangelo Jerome (/mob/dead/observer)
src: /icon (/icon)
usr.loc: the floor (154,258,1) (/turf/simulated/shuttle/floor)
call stack:
/icon (/icon): New('icons/turf/space.dmi', "19", 2, 1, 0)
getFlatIcon(space (2,28,1) (/turf/space), 2, 1, 0)
Clusterfack (/client): nanomapgen DumpTile(1, 1)
Clusterfack (/client): maprenders()
04:09:52 Runtime detected
bad icon operation at :
proc name: Blend (/icon/proc/Blend)
usr: Deangelo Jerome (/mob/dead/observer)
src: /icon (/icon)
usr.loc: the floor (154,258,1) (/turf/simulated/shuttle/floor)
call stack:
/icon (/icon): Blend(/icon (/icon), 3, 1, 1)
getFlatIcon(space (2,28,1) (/turf/space), 2, 1, 0)
Clusterfack (/client): nanomapgen DumpTile(1, 1)
Clusterfack (/client): maprenders()

runtime error: bad icon operation
proc name: Blend (/icon/proc/Blend)
usr: Deangelo Jerome (/mob/dead/observer)
src: /icon (/icon)
usr.loc: the floor (154,258,1) (/turf/simulated/shuttle/floor)
call stack:
/icon (/icon): Blend(/icon (/icon), 3, 1, 1)
getFlatIcon(space (2,28,1) (/turf/space), 2, 1, 0)
Clusterfack (/client): nanomapgen DumpTile(1, 1)
Clusterfack (/client): maprenders()


2. I'm not getting any files outputted into my directory which I'm not sure if I'm just bad at using the file procs (which I am), or whether the runtimes above are preventing my code from running properly, or whether something internal is breaking which is a definite possibility with this magnitude.

Code:
/client/proc/maprenders(var/currentz = 1, var/allz = 0)

var/icon/map = new/icon('maprender.png') //Size 16000x16000 pixels

to_chat(world, "Map Render: <B>GENERATE MAP FOR [allz? "ALL ZLEVELS" : "LEVEL [currentz]"]</B>")

for(var/z = 1 to 1) //Allz has yet to be implemented

for(var/x = 1 to world.maxx)
for(var/y = 1 to world.maxy)
//Finding turf and all turf contents
var/turf/currentturf = locate(x,y,z)
var/list/allturfcontents = currentturf.contents.Copy()
allturfcontents += currentturf

//Preparing variables
var/atom/holder
var/p
var/player
var/j
var/jlayer

//Simple Insertion sort Algorithm by layer
for(var/sort = 1 to (allturfcontents.len - 1))
p = allturfcontents[sort+1]
holder = p
player = holder.layer

j = sort
holder = allturfcontents[j]
jlayer = holder.layer
while(j >= 1 && jlayer > player)
allturfcontents[j+1] = allturfcontents[j]
j = j - 1
if(j)
holder = allturfcontents[j]
jlayer = holder.layer
allturfcontents[j+1] = p

//Preparing to blend get flat icon of (getflaticon may need to be replaced here)
for(var/atom/A in allturfcontents)
var/icon/icontoblend = getFlatIcon(A)
map.Blend(icontoblend, ICON_OVERLAY, (x-1)*world.icon_size, (y-1)*world.icon_size)
sleep(1)

world.log << "Completed row [x]"

var/icon/result_icon = new/icon()

result_icon.Insert(map, "", SOUTH, 1, 0)

fcopy(result_icon, "map[z].png")
Ah I may have found the problem from an old bug report thread, that my folder had some parts of it set to 'read only'
What's the use case?
Well I'm not perfectly familiar with the terminology but I would say:

Making a single large scale rendered .png for each zlevel that people can download from an online resource that we will host. Time/speed isn't a significant factor since it will in no way be done at runtime with a player involved.
Ah. You might have better luck breaking up your render into chunks and then combining those chunks at the end. Write operations to smaller icons are faster/more stable than small write operations to larger icons.

Though it sounds like you solved the problem.
Yes I seem to have solved the main problem with it not writing a file