The Dink Network

Easier way to create Dink mod map?

June 12th 2015, 10:34 AM
duckdie.gif
I know @Demian went through a lot of effort:

http://www.dinknetwork.com/forum.cgi?MID=103269

to create a map of the base Dink Smallwood game, but was wondering if
there might be a shortcut.

I'm trying to create a map of "Dink Gets Bored":

http://www.dinknetwork.com/file/dink_gets_bored/

(not to be confused with the mod Bored of the Rings) by using data
already in the dmod.

I know I could use freedinkedit to map each tile (and stitch the
results together), but that seems tedious, plus freedinkedit "creates"
a new map tile if you accidentally hit a blank tile.

I've read up a little bit on FreeDink's map.dat and dink.dat file structures:

https://github.com/alexschrod/freedink-lua/blob/88ff3c183b0891abad221c3326a8f24544fb7ba4/contrib/search_script.c

https://github.com/alexschrod/freedink-lua/blob/master/contrib/dinkdat_inspect.c

but I can't seem to get quite what I want.

Note: I originally asked this question on Stack Overflow and got
thoroughly reamed:

https://stackoverflow.com/questions/30742498/how-do-i-auto-create-a-map-of-a-freedink-game
June 12th 2015, 02:35 PM
pq_cthunik.gif
GOKUSSJ6
Peasant He/Him Poland
Everyone should get a pizza for free in each week. 
Use WindinkEdit+
June 12th 2015, 04:14 PM
duckdie.gif
Unfortunately, I don't have Windows.

Any Linux solutions available?
June 12th 2015, 08:24 PM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
What is exactly the purpose of this? Do you want to have a high-resolution map like the one Demian made or is a low resolution one fine as well? For the latter, Freedinkedit has (I believe) the minimap function of which you could make a screenshot. That's the way I made a mini-map for in-game use in one of my DMODs.

For higher resolutions I can't think of any straightforward solutions (besides the aforementioned stitching together of screenshots) that would work. It should be possible of course, all of the data is in the map.dat file (with maybe a bit in dink.dat as well, I'm not fully up to date on this), but I'd guess that a custom tool would need to be created. I kind of doubt that Windinkedit+ could do this either, I can't find any tool to do this though I might simply be looking in the wrong place.
June 12th 2015, 09:07 PM
peasantmp.gif
Skurn
Peasant He/Him Equatorial Guinea duck bloop
can't flim flam the glim glam 
How about get a bigass monitor, hide the toolbars in windinkedit, and use the screenshot function so you don't end up pasting screens together in my piece of shit mystery island map.

And also install windows so you can actually do that. don't worry, you don't have to pay those assholes.
June 12th 2015, 11:59 PM
peasantmb.gif
yeoldetoast
Peasant They/Them Australia
LOOK UPON MY DEFORMED FACE! 
I've been in the process of making a programme that does this for a while, just out of my own interest. That is, something that renders a full-size BMP/PNG/JPG of a Dink map. I've kind of been abandoning it for a while and as such it only renders the tiles, as sprites are a bit more difficult to render due to their many parameters and because of Dink.ini. I was using The Scourger as my test mod which worked well due to its large size and variance in tiles.

If you were a leet haxxor it would be interesting to see if one could somehow send the output of DinkEdit's space bar preview to a big file however.
June 13th 2015, 12:35 AM
peasantmp.gif
Skurn
Peasant He/Him Equatorial Guinea duck bloop
can't flim flam the glim glam 
You could hand draw the map?
June 13th 2015, 01:38 AM
peasantmb.gif
yeoldetoast
Peasant They/Them Australia
LOOK UPON MY DEFORMED FACE! 
That's not a question meaning it doesn't need a question mark.
June 13th 2015, 02:34 AM
peasantmp.gif
Skurn
Peasant He/Him Equatorial Guinea duck bloop
can't flim flam the glim glam 
i'm sure????? it does
June 13th 2015, 05:49 AM
peasantmb.gif
yeoldetoast
Peasant They/Them Australia
LOOK UPON MY DEFORMED FACE! 
skorn pls stahp.

Anyway I found an example of its output (bonus points if you guess what it is). I also had a full-size jpg render of Dink's map but it's about 48MB. If you're patient I may be able to come up with something that does sprites.
June 13th 2015, 07:32 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
I'm guessing it starts with an M.
June 13th 2015, 08:06 AM
peasantmp.gif
Skurn
Peasant He/Him Equatorial Guinea duck bloop
can't flim flam the glim glam 
Mist Airy Eye Land?
June 13th 2015, 08:42 AM
duckdie.gif
@metatarasal I'm looking for a high-resolution map that could be used to create a google map like http://www.oldgames.sk/docs/dink-smallwood/

I know I can create a low-resolution map using freedinkedit:

https://raw.githubusercontent.com/barrycarter/bcapps/master/DINK/dinkgetsbored.png

but I'm looking for something higher resolution.

@Skurn Even using a larger screen size, I don't think the freedinkedit map would be large enough. I'm not sure I fully understood your comments about Windows.

I'm currently working on a solution involving xdotool and xwd, but it's ugly.

Since freedink is open source, there "should" be a straightforward solution.
June 13th 2015, 12:37 PM
duckdie.gif
I've now done a proof of concept of this. The slow-and-ugly program is at:

https://github.com/barrycarter/bcapps/blob/master/DINK/bc-gets-bored.pl

and the far-from-perfect results are at:

http://test.barrycarter.info/DINK/

[They're still getting copied over, so if you don't see them all, just wait a few moment and refresh]

I've reshaped each screen to 768x512px so it can later be sliced into
6 256x256px tiles for Google Maps.

Next steps will be to slice the tiles for google and then create the
lower zoom tiles.
June 13th 2015, 01:36 PM
peasantmp.gif
Skurn
Peasant He/Him Equatorial Guinea duck bloop
can't flim flam the glim glam 
That was quick and you're probably a wizard and should teach us how to magic.
June 17th 2015, 02:24 PM
peasantm.gif
shevek
Peasant They/Them Netherlands
Never be afraid to ask, but don't demand an answer 
My editor does this sort of thing as well, but it adds some extra stuff (tile hardness, boxes for sprite hardness, markers for the que value, warp targets). It's easy to remove that. If you run it full screen on a server with a huge screen (which can be virtual, through vncserver), you should be able to create a screen shot of the whole thing at once.

It would require converting the mod to its format first, though, and that isn't a user-friendly process. Also, if you have custom graphics, I'm not sure if it works well (but I think it does). I've done the conversion before, so if it's a one time thing, I can do it for you. Let me know if I should.
June 17th 2015, 02:36 PM
duckdie.gif
I'm trying to create a general method for converting DMODs to google maps, so a one-off wouldn't be helpful, except as a check.

I'm getting closer to doing it the "right way" (using map.dat and dink.dat instead of xwd), but sprite placement still confuses me:

https://github.com/barrycarter/bcapps/blob/master/DINK/bc-dinkles.pl
June 17th 2015, 06:27 PM
peasantm.gif
shevek
Peasant They/Them Netherlands
Never be afraid to ask, but don't demand an answer 
My editor does it the right way, and when you've done it once, it's pretty easy to repeat, I think.

Anyway, without looking at your code:

Sprite placement is based on screen pixels, not world pixels. The coordinate of the sprite is where the "depth dot" (defined in dink.ini) is placed; the image is positioned around it. 20 is added to the X coordinate, because there is a 20 pixel border on the screen.

For the Z coordinate, you need the "depth que" value. This is either 0, which means it is identical to the Y coordinate, or an absolute number. Lower values are placed below higher values. Negative values are allowed, but 0 is not (because it would make it equal to the Y coordinate of the sprite). Background sprites are always behind all others, and their que value is ignored.
June 17th 2015, 06:38 PM
peasantm.gif
shevek
Peasant They/Them Netherlands
Never be afraid to ask, but don't demand an answer 
Oh, and I forgot the part that probably puzzled you most: this is how the position (the depth dot) is computed for sprites that don't have a definition in dink.ini:

position = (imwidth - imwidth // 2 + imwidth // 6, imheight - imheight // 4 - imheight // 30)


All those divisions are integer math; they truncate the result to an integer value.
June 17th 2015, 07:04 PM
duckdie.gif
This was exactly the piece I was missing, thank you!!

I had worked out the image was "anchored" at something like 72.5% of the x and y width, but couldn't work it out exactly. (I was way off for the x coord).

I'd also figured out the "SET_SPRITE_INFO" lines in Dink.ini overrode this, but couldn't figure out exactly how.

I'm still not sure I understand that last four fields of the SET_SPRITE_INFO lines, but hopefully they're not important? The others (just in case anyone else is wondering):

SET_SPRITE_INFO sequence frame xcenter ycenter (4 unknown-to-me fields)
June 17th 2015, 07:07 PM
peasantm.gif
shevek
Peasant They/Them Netherlands
Never be afraid to ask, but don't demand an answer 
Those last fields are the hardbox, relative to the depth dot. Every sprite, if hard, adds a rectangular box to the parts that cannot be moved through by Dink or monsters. Those numbers define the size and location of that box. You do not need it for drawing maps, indeed. But for completeness, this is how to compute it if it isn't specified:

hardbox = (-imwidth // 4, -imheight // 10, imwidth // 4, imheight // 10)
June 18th 2015, 01:45 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
For understanding the dink.ini I like to use this file. Has much of the info you need.
June 18th 2015, 10:04 AM
duckdie.gif
Thanks again, @shevek!

If anyone's interested, I've now created hardcoded "fake" SET_SPRITE_INFO lines for all sprites mentioned in Dink.ini except for this line (which is commented out anyway):

//load_sequence graphics\lands\firemoun\mound- 172 NOTANIM

The "extra" dink.ini file is at:

https://github.com/barrycarter/bcapps/blob/master/DINK/dink-more.ini

on the off chance it helps anyone.
June 18th 2015, 10:08 AM
duckdie.gif
Thanks @metatarasal! I knew about http://www.dinknetwork.com/file/the_ultimate_dink_file_format_faq/ (which, as @yeoldetoast points out, has quite a few errors), but didn't know about the dink.ini format file.
June 18th 2015, 05:14 PM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
I'm not sure, wasn't there some limit in how many set_sprite_info lines could be loaded by the engine? Not sure if that has been fixed, but it always was one of the most annoying limitations of the engine...