Prince of Persia Forum Index
Prince of Persia Forum
FAQ  FAQ   Search  Search   Memberlist  Memberlist   Ranking  Ranking   Usergroups  Usergroups   RSS
Register  ::  Log in Log in to check your private messages

Post new topic  Reply to topic Goto page 1, 2  Next 20 posts
 drawmap - map drawing utility « View previous topic :: G M Y :: View next topic » 
Author Message
htamas
PostPosted: Wed Mar 28, 2007 4:13 pm    Post subject: drawmap - map drawing utility Reply with quote

Developer
Developer

Age: 21 Pisces
Joined: 10 Aug 2006
Status: Offline
Posts: 89
Location: Budapest, Hungary

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):


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


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:
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:
drawmap level01.plv
to create a level map from level01.plv,
or
Code:
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:
for i in *.plv; do ./drawmap $i; mv drawmap.png $(basename $i .plv).png; done
or this one, if you're using windows:
Code:
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.
Back to top
View user's profile Send private message  
jora
PostPosted: Wed Mar 28, 2007 5:34 pm    Post subject: Reply with quote

Maharajah
Maharajah

Age: 15 Scorpio
Joined: 25 Jun 2006
Status: Offline
Posts: 255
Location: Setúbal, Portugal

I didn't understand, sorry, what does it do?
Back to top
View user's profile Send private message Send e-mail MSN Messenger 
starwindz
PostPosted: Thu Mar 29, 2007 1:32 pm    Post subject: Reply with quote

Valued Contributor
Valued Contributor

Age: 36 Leo
Joined: 12 Jan 2007
Status: Online
Posts: 813
Location: South Korea

So cool and nice... htamas...
Thank you for making this program... Very Happy
_________________
PoP1-Total Pack : Download V2.00-Final
All Total Packs for playing the best DOS Games
Roguelike-Total Pack


Last edited by starwindz on Fri Mar 30, 2007 2:17 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail  
adam77
PostPosted: Thu Mar 29, 2007 8:31 pm    Post subject: Reply with quote

Citizen
Citizen

Age: 28 Libra
Joined: 19 Apr 2006
Status: Offline
Posts: 41
Location: Louisiana

So is thins for POP1 or POP2 ?
Back to top
View user's profile Send private message  
jalal
PostPosted: Sat Mar 31, 2007 4:59 pm    Post subject: Reply with quote

Site Admin
Site Admin

Age: 20 Leo
Joined: 04 Dec 2005
Status: Offline
Posts: 2707
Location: Lebanon

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.
_________________
And we burned in the wine of our lips
And we were born again
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger 
jora
PostPosted: Sat Mar 31, 2007 7:05 pm    Post subject: Reply with quote

Maharajah
Maharajah

Age: 15 Scorpio
Joined: 25 Jun 2006
Status: Offline
Posts: 255
Location: Setúbal, Portugal

Wouldn't that turn the mods too easy?
if u can see what's coming it'll be less hard.
Back to top
View user's profile Send private message Send e-mail MSN Messenger 
starwindz
PostPosted: Sat Mar 31, 2007 10:45 pm    Post subject: Reply with quote

Valued Contributor
Valued Contributor

Age: 36 Leo
Joined: 12 Jan 2007
Status: Online
Posts: 813
Location: South Korea

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.
_________________
PoP1-Total Pack : Download V2.00-Final
All Total Packs for playing the best DOS Games
Roguelike-Total Pack


Last edited by starwindz on Sun Apr 01, 2007 2:40 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail  
htamas
PostPosted: Sun Apr 01, 2007 12:42 am    Post subject: Reply with quote

Developer
Developer

Age: 21 Pisces
Joined: 10 Aug 2006
Status: Offline
Posts: 89
Location: Budapest, Hungary

starwindz wrote:
I got an error (drawmap.c unknown 355).

Did you install ImageMagick?
Back to top
View user's profile Send private message  
starwindz
PostPosted: Sun Apr 01, 2007 6:44 am    Post subject: Reply with quote

Valued Contributor
Valued Contributor

Age: 36 Leo
Joined: 12 Jan 2007
Status: Online
Posts: 813
Location: South Korea

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.
_________________
PoP1-Total Pack : Download V2.00-Final
All Total Packs for playing the best DOS Games
Roguelike-Total Pack
Back to top
View user's profile Send private message Send e-mail  
htamas
PostPosted: Sun Apr 01, 2007 11:56 pm    Post subject: Reply with quote

Developer
Developer

Age: 21 Pisces
Joined: 10 Aug 2006
Status: Offline
Posts: 89
Location: Budapest, Hungary

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! Smile
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/binary-releases.php#windows

By the way, I've updated the utility to give a bit more verbose error messages, such as "NoDecodeDelegateForThisImageFormat `tiles1.png'".
Back to top
View user's profile Send private message  
poirot
PostPosted: Mon Apr 02, 2007 1:04 am    Post subject: Reply with quote

Princed Developer
Princed Developer

Age: 25 Pisces
Joined: 28 May 2006
Status: Offline
Posts: 264
Location: Buenos Aires/Ushuaia

with a few modifications you can use the FP rendering engines to produce high quality maps Wink
I'll try to make a sample asap, and perhaps an online script to draw a level.dat file.
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger 
starwindz
PostPosted: Tue Apr 03, 2007 2:39 am    Post subject: Reply with quote

Valued Contributor
Valued Contributor

Age: 36 Leo
Joined: 12 Jan 2007
Status: Online
Posts: 813
Location: South Korea

htamas, I got a blank png file(drawmap.png) after running drawmap utility.
download a following file and test it.
Download my test files
_________________
PoP1-Total Pack : Download V2.00-Final
All Total Packs for playing the best DOS Games
Roguelike-Total Pack
Back to top
View user's profile Send private message Send e-mail  
blood_445
PostPosted: Wed Apr 11, 2007 1:51 pm    Post subject: Reply with quote

The Prince of Persia
The Prince of Persia

Age: 16 Pisces
Joined: 30 Aug 2006
Status: Offline
Posts: 1773
Location: Dahye, Lebanon

wow, nice, I will make the maps of my mods Very Happy Wink + Thumb Up
_________________
if you can see the future..... you can save it.....
you cannot change your fate... no man can...



Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger 
jalal
PostPosted: Sun Jun 24, 2007 8:37 am    Post subject: Reply with quote

Site Admin
Site Admin

Age: 20 Leo
Joined: 04 Dec 2005
Status: Offline
Posts: 2707
Location: Lebanon

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.
_________________
And we burned in the wine of our lips
And we were born again
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger 
mk1994
PostPosted: Thu Aug 16, 2007 3:39 pm    Post subject: Reply with quote

The Prince of Persia
The Prince of Persia

Age: 12 Libra
Joined: 26 Jun 2007
Status: Offline
Posts: 6261
Location: Germany

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? Confused
_________________
We have a little cat,
the name is Simone.
Sie pullert auf's Parkett,
das riecht zwar nich ohne,
but is ma keen Parkett,
doing Simone a very bit klug,
she's schnurring beauty nett
and secht in DJ's shoe.

Angelsächsisch for yuh - MaxiMal

The Princess in Danger
The Princess in Danger 2
Back to top
View user's profile Send private message Send e-mail MSN Messenger 
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

Jump to:  


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2002 - 2007 Jalal Noureddine, Prince of Persia Unofficial Website
Page generated in 0.53319 seconds | 12 queries executed | GZIP compression enabled