|
|
|
|
|
December 21st, 2004, 01:25 PM
|
|
Shrapnel Fanatic
|
|
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
|
|
Re: Dominions II mapfile parser
By The Way, your neighbor line could be used by someone for computing "quickest path from A to B" routines. Very nice.
DomMap added some info to its output for programming special sites and such..
Code:
#neighbour 49 50
#neighbour 51 53
#neighbour 52 53
#terrain 1 2 -- L-S0L2
#terrain 2 208 -- L-S0L1
#terrain 3 130 -- L-S0L4
If a province is L-S4L1 then its saying its Land with 4 Sea neighbors and 1 Land neighborsm or a penninsula. L-S4L0 would be Land with 4 Sea and no Land neighbors, or an island. S-L4S0 would be Sea with 4 land neighbors and no Sea neighbors, or a lake. Yoiu might want to do something like that but probably in a more user format like actually saying island and lake.
__________________
-- 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!)
|
December 22nd, 2004, 05:43 PM
|
Private
|
|
Join Date: Dec 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Re: Dominions II mapfile parser
Quote:
Gandalf Parker said:
Only my own comment. If others dont jump in then its not worth doing anything about it. It depends on what you program in..
|
Don't worry about that, I program it mostly to improve my programming skills.
Quote:
Code:
<random>(46):
NOSTART
forest small
neighbours: ['37', '55', '68']
<random>(62):
NOSTART
neighbours: ['58', '76']
<random>(82):
neighbours: ['73', '78', '81', '84', '89']
<random>(100):
forest mountain
neighbours: ['85', '87', '91', '97']
Its a very readable format for user info which may be all it needs to do. But not good for programming. If there is no terrain you leave a blank line. Actually 0 terrain is plains (default) so you might want to make that change. But if there is no blankline for NOSTART. That means that in a program the code would be something like "find swamp, check next line for neighboring 32, back up one or two lines to get province number for including special site location".
Im not sure if everything can be placed on one line and still be good for user reading, but possibly the NOSTART and terrains could be on the same line as the province number. That would make parsing abit easier, and make the neighbor line always be in the same spot in relation to those.
|
How about :
Line 1: Name, id
Line 2: Terrain
Line 3: Neighbours
Line 4: NOSTART, START, VP, etc.
Line 5->: commanders, features, population, buildings
There is also the problem that there are two ways to add nostart. As a terrain flag and as a separate command. Should the output differ for them?
I will consider these changes and adding counting of number of land-sea neighbours to next Version. It will take to after Christmas before I have time however.
|
December 23rd, 2004, 11:32 AM
|
|
Shrapnel Fanatic
|
|
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
|
|
Re: Dominions II mapfile parser
Quote:
CJN said:
How about:
Line 1: Name, id
Line 2: Terrain
Line 3: Neighbours
Line 4: NOSTART, START, VP, etc.
Line 5->: commanders, features, population, buildings
|
Oohhh name of the province? Much variable there. That is difficult to parse. How about if as much as possible, which can easily be parsed, be on one line. Then the difficult to parse can be seperated by "newline" as long as they always can be found on that line each time. Such as...
Line 1: Name
Line 2: id, Terrain, NOSTART, VP, etc
Line 3: Neighbors
That way even if there are no Neighbors it should still have a line which says Neighbors with no other output.
Quote:
There is also the problem that there are two ways to add nostart. As a terrain flag and as a separate command. Should the output differ for them?
|
Well the purpose I see is either for Users/map-makers who want readable info.. or for people who want to include it into a scripting pipe as an easy way to get info they didnt want to figure out how to extract. So Id say just put NOSTART when applicable no matter how its generated.
Quote:
Line 5->: commanders, features, population, buildings
|
OUCH that puts a wrench into the whole thing. It means that I cant just count lines and say "if line 2 has NOSTART skip next 2 lines and check again".
OK now Im thinking there are two ways to go. One is to have a unique character or Groups of characters flagging the begining of each province output. Such as -=- which can be used to count from or jump to the next province. The problem is finding something which in a script environment such as linux doesnt mean something special already. OR add a switch such as -v for more verbose output and have two outputs. One for all info, and the other for easy-parse info. Hmmm wait, the more casual user should always be considered for defaults. So maybe have the fully englished curious-user output be default with a -s short-Version for script programmers.
__________________
-- 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!)
|
December 30th, 2004, 03:13 AM
|
Private
|
|
Join Date: Dec 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Re: Dominions II mapfile parser
Quote:
Gandalf Parker said:
Oohhh name of the province? Much variable there. That is difficult to parse. How about if as much as possible, which can easily be parsed, be on one line. Then the difficult to parse can be seperated by "newline" as long as they always can be found on that line each time. Such as...
Line 1: Name
Line 2: id, Terrain, NOSTART, VP, etc
Line 3: Neighbors
That way even if there are no Neighbors it should still have a line which says Neighbors with no other output.
Quote:
Line 5->: commanders, features, population, buildings
|
OUCH that puts a wrench into the whole thing. It means that I cant just count lines and say "if line 2 has NOSTART skip next 2 lines and check again".
OK now Im thinking there are two ways to go. One is to have a unique character or Groups of characters flagging the begining of each province output. Such as -=- which can be used to count from or jump to the next province. The problem is finding something which in a script environment such as linux doesnt mean something special already. OR add a switch such as -v for more verbose output and have two outputs. One for all info, and the other for easy-parse info. Hmmm wait, the more casual user should always be considered for defaults. So maybe have the fully englished curious-user output be default with a -s short-Version for script programmers.
|
Version 0.6.0 is now available. Take a look at it.
I decided to move the province id first in the first line of province info to make parsing easier. Just look for lines starting with "(". some basic neighbour info is also added.
For details & download see first post.
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is On
|
|
|
|
|