drawmap - map drawing utility

Discussions about all other tools (CusPop, SAV/HOF editors) and hex editing.
htamas
Efendi
Efendi
Posts: 10
Joined: February 22nd, 2009, 7:49 pm

drawmap - map drawing utility

Post by htamas »

This topic was originally available at http://popuw.com/forum/viewtopic.php?t=1579. I tried to salvage posts from my locally saved files and the Internet Archive's Wayback Machine. If you have some additional material, please share it. Thanks.
htamas @ popuw.com (Wed Mar 28, 2007 4:13 pm) wrote: Jalal has asked me to create a thread about the map drawing utility I wrote last summer. It creates simplified maps from PoP1 and PoP2 levels, similar to the small images shown in Roomshaker.

A level map looks like this (RoT level 1):
Image

This is a room map (from PoP2 level 5):
Image

Downloads:

source code (released under GPLv2)
binary for suse 10.2 (should work with other distros too)
binary for windows

You'll also need the ImageMagick library. For windows, download it from here. Linux users should install the ImageMagick package. If you would like to compile from source, you should also install ImageMagick-devel (and gcc, of course).

Compiling from source:

After installing the prerequisites, run:

Code: Select all

gcc drawmap.c -lWand -o drawmap
Usage:

First, extract the .plv files from levels.dat (pop1) or prince.dat (pop2) using PR.
Then, from the command line, use e.g.

Code: Select all

drawmap level01.plv
to create a level map from level01.plv,
or

Code: Select all

drawmap level01.plv 18
to draw a map of room 18 from level01.plv.

Note that the output file is always called drawmap.png. The program is designed in a way that the caller script/application handles renaming/moving the resulting file.

Should you need to iterate through a list of .plv files, you could use this shell command on linux:

Code: Select all

for i in *.plv; do ./drawmap $i; mv drawmap.png $(basename $i .plv).png; done
or this one, if you're using windows:

Code: Select all

for %i in (*.plv) do (
  drawmap %i
  rename drawmap.png %~ni.png
)
(if you write it in a batch file, you need to escape the percent sign with another: % -> %%)

Notes :

* You can't create a level map from a level with irregular room linking. In such a case, you should understand the rooms' structure from the ordinals of adjecent rooms shown at the side of the room maps.
* Maps only show background & foreground elements (no guards, starting locations, etc.). Also, some blocks (particularly the ones unused in the original game) are shown by their hex code instead.
* This utility is licensed under the GNU General Public License, version 2. This means that you're free to use, learn from or modify the source code, and release modified versions. Derivatives should use a compatible license. While I hope this program is useful, there are no warranties of any kind. For more details, see the license text.
* Don't be put off if I don't answer your questions, I don't have much free time.
jora @ popuw.com (Wed Mar 28, 2007 5:34 pm) wrote: I didn't understand, sorry, what does it do?
starwindz @ popuw.com (Thu Mar 29, 2007 1:32 pm) wrote: So cool and nice... htamas...
Thank you for making this program... :D
adam77 @ popuw.com (Thu Mar 29, 2007 8:31 pm) wrote: So is thins for POP1 or POP2 ?
jalal @ popuw.com (Sat Mar 31, 2007 4:59 pm) wrote:
jora wrote: I didn't understand, sorry, what does it do?
adam77 wrote: So is thins for POP1 or POP2 ?
It creates simplified maps for PoP1 and PoP2, like the simplfied maps of: PoP1, PoP2, 4D Prince, PoP TGE, etc.

So now you can generate maps for your own mods.
htamas wrote: Usage:

First, extract the .plv files from levels.dat (pop1) or prince.dat (pop2) using PR.
For those who do not know to extract .plv files, read this thread for usage under linux, and this one for Windows.

@starwindz: Wouldn't it be a good idea adding a new tab called "Maps" under the Info one (besides manual, review and etc tabs)? So if someone has his or her mod's maps, he or she could add or send them for the next PoP1-TP's release).

Thread Stickyed.
jora @ popuw.com (Sat Mar 31, 2007 7:05 pm) wrote: Wouldn't that turn the mods too easy?
if u can see what's coming it'll be less hard.
starwindz @ popuw.com (Sat Mar 31, 2007 10:45 pm) wrote: I got an error (drawmap.c unknown 355).
I used PR to extract plv files from 'PoP1 original' and
run 'drawmap level1.plv'. What is going on?
jalal wrote:
@starwindz: Wouldn't it be a good idea adding a new tab called "Maps" under the Info one (besides manual, review and etc tabs)? So if someone has his or her mod's maps, he or she could add or send them for the next PoP1-TP's release).
As you can see 'showing map' is something like spoiler.
Anyway I will add this feature(adding 'Map tab') to 'to do list'
for the next version of total pack.
htamas @ popuw.com (Sun Apr 01, 2007 12:42 am) wrote:
starwindz wrote: I got an error (drawmap.c unknown 355).
Did you install ImageMagick?
starwindz @ popuw.com (Sun Apr 01, 2007 6:44 am) wrote:
htamas wrote:
starwindz wrote: I got an error (drawmap.c unknown 355).
Did you install ImageMagick?
Yes, I have installed ImageMagick.
Hmm... I will check it out again.
htamas @ popuw.com (Sun Apr 01, 2007 11:56 pm) wrote:
starwindz wrote: Yes, I have installed ImageMagick.
Hmm... I will check it out again.
I just thought that, because previously jalal had the same error message, and solved that by installing the ImageMagick libs (quotes from PM):
jalal wrote: Hi,
I tired it, but I got an error:
drawmap.c unknown 355
jalal wrote: Great!
It has worked! :)
I've just downloaded:
ImageMagick-6.3.0-0-Q16-windows-dll.exe (Dynamic at 16 bits-per-pixel) from here: http://www.imagemagick.org/script/binar ... hp#windows
By the way, I've updated the utility to give a bit more verbose error messages, such as "NoDecodeDelegateForThisImageFormat `tiles1.png'".
poirot @ popuw.com (Mon Apr 02, 2007 1:04 am) wrote: with a few modifications you can use the FP rendering engines to produce high quality maps ;)
I'll try to make a sample asap, and perhaps an online script to draw a level.dat file.
starwindz @ popuw.com (Tue Apr 03, 2007 2:39 am) wrote: htamas, I got a blank png file(drawmap.png) after running drawmap utility.
download a following file and test it.
Download my test files
blood_445 @ popuw.com (Wed Apr 11, 2007 1:51 pm) wrote: wow, nice, I will make the maps of my mods :D :yees:
jalal @ popuw.com (Sun Jun 24, 2007 8:37 am) wrote: starwindz has sent me a couple of PMs about drawmap (it's not working for him (the Windows version)), I've been trying till I've found out what the problem was.

The map drawing utility does only work under ImageMagick-6.3.0-0-Q16-windows-dll.exe (10/15/06).

If running under the newest version (ImageMagick-6.3.4-10-Q16-windows-dll.exe 06/30/07) or older versions, you will either get drawmap.c unknown 355 error if using drawmap-win-20061015 or ../drawmap.c unknown 355 NoDecodeDelegateForThisImageFormat `tiles1.png' if using the latest version ... (it works if you delete the DLL files but a black blank image will be generated).

I would upload version 6.3.0-0 if I had high speed Internet.

PS: I think it will work if you compile drawmap under ImageMagick-6.3.4-10.
mk1994 @ popuw.com (Thu Aug 16, 2007 3:39 pm) wrote: One question:

You can make PoP2 maps with this, as well, can't you? But you need a *.plv file or something - and that you'll get from PR, right? So, how the heck do you make a *.plv file of PoP2? :?
programmer @ popuw.com (Thu Aug 16, 2007 7:29 pm) wrote: You have to extract it from PRINCE.DAT file.. It was said in this topic.
mk1994 @ popuw.com (Sat Sep 22, 2007 7:04 pm) wrote: Where?
Oloil @ popuw.com (Sat Sep 22, 2007 7:19 pm) wrote:
jalal wrote: Stickyed
lol
Veke @ popuw.com (Sun Sep 23, 2007 5:49 am) wrote: What's so funny?
mk1994 @ popuw.com (Sun Sep 23, 2007 6:30 am) wrote: Yeh, I wonder, too.
  • further messages written after Nov 11, 2007 may have been lost
OrSpeeder
Sheikh
Sheikh
Posts: 49
Joined: July 24th, 2005, 8:05 pm
Location: Valinhos

Re: drawmap - map drawing utility

Post by OrSpeeder »

htmas you tought of doing a version that can draw using in-game graphics? That would be a immensely usefull tool...
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: drawmap - map drawing utility

Post by Norbert »

htamas wrote:This topic was originally available at http://popuw.com/forum/viewtopic.php?t=1579. I tried to salvage posts from [...]
htamas @ popuw.com (Wed Mar 28, 2007 4:13 pm) wrote: Jalal has asked me to create a thread about the map drawing utility [...]
Downloads: [...]
The download links are outdated and no longer work.
Thanks to htamas, I've been able to add them to popot.org:
http://www.popot.org/other_useful_tools ... ol=drawmap

Note that this utility was created several years ago, so some (small) changes may be required to make it work on more modern operating systems.
See the beginning of this thread for htamas' instructions on how to compile/use this utility.
RusFan
Sheikh
Sheikh
Posts: 21
Joined: May 28th, 2011, 4:07 am

Re: drawmap - map drawing utility

Post by RusFan »

I have latest version of drawmap sources from 07.10.2006 (or maybe even from 26.05.2011 by modification dates). You can add it on your site.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: drawmap - map drawing utility

Post by Norbert »

RusFan wrote:I have latest version of drawmap sources from 07.10.2006 (or maybe even from 26.05.2011 by modification dates). You can add it on your site.
Is that an officially released version or just what you found in a repository?
RusFan
Sheikh
Sheikh
Posts: 21
Joined: May 28th, 2011, 4:07 am

Re: drawmap - map drawing utility

Post by RusFan »

It's official, htamas has sent me it personally week ago.
htamas @ popuw.com (Wed Mar 28, 2007 4:13 pm) wrote:Jalal has asked me to create a thread about the map drawing utility I wrote last summer.
"Last summer" thread now available from here and quoted thread from first post from here and here (page 2).
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: drawmap - map drawing utility

Post by Norbert »

Here's a new version that I've created.
The attached package is for GNU/Linux.
It probably also compiles on Windows, but someone else can/might look into that.

Anyway, the changes for this version:
- - - - - - - - - -
+ Added optional 3D support for PoP1, with dungeon and palace.
+ In 3D mode, modifier values are taken into account.
+ Optionally, the grid can be removed.
+ Added a docs/ directory, with AUTHORS.txt, ChangeLog.txt, gpl-2.0.txt, README.txt, and a templates/ subdirectory.
+ Added various command-line options.
* Moved the tile thumbnails into a new png/ directory.
* Using a Makefile instead of a make.sh script.
* Made the source code slightly easier to read and edit.
- - - - - - - - - -

Basically, "drawmap level1.plv" still works as before...
...but something like "drawmap -d=3 -e=d level1.plv" is now also possible.
The latter creates a 3D map (2.5D), using the dungeon environment.
Also works for the palace environment. PoP2 can still only do 2D.

Still far from perfect, of course.
Doesn't show guards yet, for instance.
And more stylized 3D variants for the tile thumbnails would be better.
The code already allows switching to a different 2D or 3D set.
These better set images simply do not exist (yet).
Attachments
old.png
new.png
drawmap-0.4.tar.gz
(140.16 KiB) Downloaded 110 times
User avatar
starwindz
Sultan
Sultan
Posts: 133
Joined: March 8th, 2009, 4:48 pm

Re: drawmap - map drawing utility

Post by starwindz »

Norbert wrote:Here's a new version that I've created.
The attached package is for GNU/Linux.
It probably also compiles on Windows, but someone else can/might look into that.
....
Great program! I have a question and a request for your program.

1. After running old version from http://www.popot.org/other_useful_tools ... pr2007.zip , I got a strange error message as follows. Please check it out.

drawmap level001.plv <enter>
../drawmap.c unknown 355 NoDecodeDelegateForThisImageFormat `tiles1.png'
(level001.plv is attached in this article(level001.zip))

2. Could you please upload Win32 version of 0.4?
Attachments
level001.zip
(784 Bytes) Downloaded 106 times
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: drawmap - map drawing utility

Post by Norbert »

Just to prevent misunderstandings, this program was created by htamas.
All I've done is improve it a bit and released version 0.4.

The error you get: according to jalal (quoted by htamas in the first post) that win32 version will "only work under ImageMagick-6.3.0-0-Q16-windows-dll.exe (10/15/06)".
I choose to not create a Windows version of 0.4; you or someone else could try creating it.
The reason is that I'm busy and I've already spent too much time working on this.
User avatar
starwindz
Sultan
Sultan
Posts: 133
Joined: March 8th, 2009, 4:48 pm

Re: drawmap - map drawing utility

Post by starwindz »

Norbert wrote:Just to prevent misunderstandings, this program was created by htamas.
All I've done is improve it a bit and released version 0.4.

The error you get: according to jalal (quoted by htamas in the first post) that win32 version will "only work under ImageMagick-6.3.0-0-Q16-windows-dll.exe (10/15/06)".
I choose to not create a Windows version of 0.4; you or someone else could try creating it.
The reason is that I'm busy and I've already spent too much time working on this.
Okay, I understand. I would try to compile and run it using related files. Thank you.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: drawmap - map drawing utility

Post by David »

Norbert wrote: + Added optional 3D support for PoP1, with dungeon and palace.
+ In 3D mode, modifier values are taken into account.
I see it uses the tile images of Apoplexy.

This reminds me... I guess I should begin working on that level-screenshot feature of SDLPoP proposed here: viewtopic.php?p=21023#p21023
salvadorc17
Calif
Calif
Posts: 553
Joined: August 27th, 2011, 2:04 am

Re: drawmap - map drawing utility

Post by salvadorc17 »

Also want a windows version, if you could help. This should not be moved to other tools section?
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: drawmap - map drawing utility

Post by David »

Norbert wrote:I choose to not create a Windows version of 0.4; you or someone else could try creating it.
Here it is.

I did not include the many big DLLs, but I added a note on how to get them. (Windows-notes.txt)
Attachments
drawmap-0.4-win32.zip
(153 KiB) Downloaded 113 times
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: drawmap - map drawing utility

Post by David »

salvadorc17 wrote:This should not be moved to other tools section?
Moved. (For the record, this topic was in the "New Levels and Mods For DOS" section.)

BTW, for some reason, the drawmap topic on PoPUW was also in the mods section.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: drawmap - map drawing utility

Post by Norbert »

David wrote:BTW, for some reason, the drawmap topic on PoPUW was also in the mods section.
Maybe PoPUW had no forum board about/for tools. If the available PoP1 boards were "General Discussion" and "Mods", the latter is a more likely candidate to contain releases (of any kind) than the former.
Post Reply