.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

Raging Tiger- Save $9.00
winSPMBT: Main Battle Tank- Save $6.00

   







Go Back   .com.unity Forums > Illwinter Game Design > Dominions 2: The Ascension Wars

Reply
 
Thread Tools Display Modes
  #1  
Old December 17th, 2004, 10:44 AM

CJN CJN is offline
Private
 
Join Date: Dec 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
CJN is on a distinguished road
Default Dominions II mapfile parser

I have made a Python script that reads a .map file and prints out info from it on the screen. The script is attached as a zip file to this post.
It started when I wanted to get the terrain specifications to a more readable format, and I later decided to add all map-file commands that I know of.

It should be considered beta, so report any errors and suggestions for improvements.
Feel free to host it on your Dom 2 sites if you want.

EDIT:
Updated to v0.6.0:
v0.6.0:
- Reworked internal handling of terrain.
- Added calculation of number of land and sea neighbours.
- Prints out terrain as plains if no other terrain type is set.
- Moved many-sites from terrain line.
- Use only one type of output for nostart.
- Added information based on terrain of neighbours (island, coastal , etc.)
- Allways print out province owner special info line and moved it after neighbours.
- Switched province id and province name in output.
- Added parsing of independents command.
Attached Files
File Type: zip 318224-mapinfo-0.6.0.zip (7.3 KB, 179 views)
Reply With Quote
  #2  
Old December 18th, 2004, 10:58 AM

PDF PDF is offline
Colonel
 
Join Date: Apr 2002
Location: Near Paris, France
Posts: 1,566
Thanks: 0
Thanked 0 Times in 0 Posts
PDF is on a distinguished road
Default Re: Dominions II mapfile parser

Interesting, but I can't make it work, the .py files aren't executables, I suppose I should have some Pythonnesque runtime lib ??
Reply With Quote
  #3  
Old December 18th, 2004, 12:07 PM

CJN CJN is offline
Private
 
Join Date: Dec 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
CJN is on a distinguished road
Default Re: Dominions II mapfile parser

Quote:
PDF said:
Interesting, but I can't make it work, the .py files aren't executables, I suppose I should have some Pythonnesque runtime lib ??
I guess that you are using Windows?
- First make sure you have installed Python. It can be found at Python Programming Language. The only libraries used are sys, re and string which should be part of the standard installation.
- I have no Windows installation, so I can't test, but try either to open it in IDLE and run it from there or type the following at command line:
Code:
python mapinfo.py <mapfile.map> 

Reply With Quote
  #4  
Old December 18th, 2004, 11:45 AM
Skolem's Avatar

Skolem Skolem is offline
Corporal
 
Join Date: May 2004
Location: Münster, Germany
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Skolem is on a distinguished road
Default Re: Dominions II mapfile parser

I wanted to test it and I receive the following error:
IndexError: list index out of range

File "mapinfo.py", line 156, in ?
fname = sys.argv[1]
What should I do?
__________________
Algebraic geometry seems to have acquired the reputation of being esoteric, exclusive, and very abstract, with adherents who are secretly plotting to take over all the rest of mathematics. In one respect this Last point is accurate. --David Mumford
Reply With Quote
  #5  
Old December 18th, 2004, 12:14 PM

CJN CJN is offline
Private
 
Join Date: Dec 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
CJN is on a distinguished road
Default Re: Dominions II mapfile parser

Quote:
Skolem said:
I wanted to test it and I receive the following error:
IndexError: list index out of range

File "mapinfo.py", line 156, in ?
fname = sys.argv[1]
What should I do?
Sounds like you didn't add the mapfile name when you ran it.
(sys.argv[1] = first command line argument)
Did you use IDLE to run in windows? Is it possible to add command line arguments when you use IDLE?

EDIT:
A new Version is now available, which has some improvements.
For details & download, see the first post.
Reply With Quote
  #6  
Old December 18th, 2004, 01:40 PM
Skolem's Avatar

Skolem Skolem is offline
Corporal
 
Join Date: May 2004
Location: Münster, Germany
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Skolem is on a distinguished road
Default Re: Dominions II mapfile parser

I tested it again with orania nasty ed. and it works great!
Last thing, he warned about one unknown command: #independents 9.
I'm pretty sure this maps use almost all possible map commands so it is indeed a good result. This will be surely very usefull for making maps
Thanks!
__________________
Algebraic geometry seems to have acquired the reputation of being esoteric, exclusive, and very abstract, with adherents who are secretly plotting to take over all the rest of mathematics. In one respect this Last point is accurate. --David Mumford
Reply With Quote
  #7  
Old December 19th, 2004, 11:27 AM

CJN CJN is offline
Private
 
Join Date: Dec 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
CJN is on a distinguished road
Default Re: Dominions II mapfile parser

Quote:
Skolem said:
I tested it again with orania nasty ed. and it works great!
Last thing, he warned about one unknown command: #independents 9.
I'm pretty sure this maps use almost all possible map commands so it is indeed a good result. This will be surely very usefull for making maps
Thanks!
Well, that command is not in mapedit.pdf. I will add it next time I update. I guess that it sets the strength of independent forces, right? Does anyone know of any other undocumented map commands?
Reply With Quote
  #8  
Old December 19th, 2004, 03:31 PM
Gandalf Parker's Avatar

Gandalf Parker Gandalf Parker is offline
Shrapnel Fanatic
 
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
Gandalf Parker is on a distinguished road
Default Re: Dominions II mapfile parser

Nicely done. The format isnt as friendly toward further programming as I might want, but I can see where it would be useful for many.
__________________
-- DISCLAIMER:
This game is NOT suitable for students, interns, apprentices, or anyone else who is expected to pass tests on a regular basis. Do not think about strategies while operating heavy machinery. Before beginning this game make arrangements for someone to check on you daily. If you find that your game has continued for more than 36 hours straight then you should consult a physician immediately (Do NOT show him the game!)
Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 12:39 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2024, Shrapnel Games, Inc. - All Rights Reserved.