.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 3: The Awakening > Scenarios, Maps and Mods

Reply
 
Thread Tools Display Modes
  #1  
Old March 18th, 2007, 02:05 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 tool request (terrain math)

I COULD look at the how the terrain tools that have already been done managed the math, but I thought Id ask instead. For scenario creation could someone whip out a tool that will take a range of province numbers and mark them all nostart?

Yes I know the #nostart command but Id rather avoid making the .map file that large if I can avoid it.

Yes I know the #specstart command but that wont divide the map between AI territory and human player territory.

YaBasic preferred but anything that will run on linux or windows will work.

For ease of scenario planning I am presently choosing maps which look good for scenarios based on a "the whole top of the map" or "the whole bottom of the map". But IF someone really wanted to.... having the utility do something like 20% of the right side, or 20% of the left side, might be nice (not necessary if its a hassle)

Gandalf Parker
__________________
-- 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
  #2  
Old March 18th, 2007, 03:07 PM
DrPraetorious's Avatar

DrPraetorious DrPraetorious is offline
Major General
 
Join Date: Feb 2005
Location: Lake of Hali, Aldebaran, OH
Posts: 2,474
Thanks: 51
Thanked 67 Times in 27 Posts
DrPraetorious is on a distinguished road
Default Re: tool request (terrain math)

Linux *or* windows or linux *and* windows?

I've touched this up for legibility. First, copy these scripts into textfiles (hence, "scriptfile").

Code:

BEGIN{low=ARGV[2]; high=ARGV[3]; mask=ARGV[4]; ARGC-=3;}
{pmode = 1;}
/#terrain/ && ($2 >= low && $2 <= high){print $1 " " $2 " " or($3,mask); pmode = 0;}
(pmode == 1){print;}



usage: awk -f <scriptfile> <mapfilename> <min> <max> <mask>

ex: awk -f makemask.awk 390_mp.map 1 12 1

The output will be a version of 390_mp.map where provinces 1-12 are now large.

You can use this to set any province mask you want on any range of provinces you want - I forget what the bitmask is for nostarts but you can use this to add ocean, for example.

If you want to strip out a bitmask, use this:
Code:

BEGIN{low=ARGV[2]; high=ARGV[3]; mask=ARGV[4]; ARGC-=3;}
{pmode = 1;}
/#terrain/ && ($2 >= low && $2 <= high){print $1 " " $2 " " and($3,compl(mask)); pmode = 0;}
(pmode == 1){print;}



Identical usage.
__________________
If you read his speech at Rice, all his arguments for going to the moon work equally well as arguments for blowing up the moon, sending cloned dinosaurs into space, or constructing a towering *****-shaped obelisk on Mars. --Randall Munroe
Reply With Quote
  #3  
Old March 18th, 2007, 03:23 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: tool request (terrain math)

wow, thats cool. I didnt think to mention awk or sed.
That will work fine. Thanks.
__________________
-- 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
  #4  
Old March 18th, 2007, 03:25 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: tool request (terrain math)

Does it check to see if the bit is already set?
__________________
-- 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
  #5  
Old March 18th, 2007, 03:54 PM
DrPraetorious's Avatar

DrPraetorious DrPraetorious is offline
Major General
 
Join Date: Feb 2005
Location: Lake of Hali, Aldebaran, OH
Posts: 2,474
Thanks: 51
Thanked 67 Times in 27 Posts
DrPraetorious is on a distinguished road
Default Re: tool request (terrain math)

Oh, yeah, both of those are awk scripts. You could do it with sed as well, of course, but I don't know the bitwise operators in sed.

No, it doesn't check - but it's a bitwise or, so nothing should change if the bit is set already (or isn't set already, depending.)

If you add something like:
Code:

if (and($3,mask)==mask){print mask " already set at " $2;}



It'll check bitmasks as well.
__________________
If you read his speech at Rice, all his arguments for going to the moon work equally well as arguments for blowing up the moon, sending cloned dinosaurs into space, or constructing a towering *****-shaped obelisk on Mars. --Randall Munroe
Reply With Quote
  #6  
Old March 18th, 2007, 04:59 PM

Kaljamaha Kaljamaha is offline
Private
 
Join Date: Nov 2003
Location: Helsinki, Finland
Posts: 44
Thanks: 0
Thanked 1 Time in 1 Post
Kaljamaha is on a distinguished road
Default Re: tool request (terrain math)

I see the problem is already fixed, but here goes anyway...

I whipped up a small Perl script for this, I thought it would make a fun exercise (I haven't done Perl for some time). It became a lot bigger than I originally thought because I added some functionality to it. I wrote it in windows, so if you want to use it in Unix open it with nano or pico or something to change the line endings.

Just run the thing, it'll tell you what to do. I even tested the thing, so it shouldn't contain too many bugs.


K.
Attached Files
File Type: zip 505341-NoStart.zip (1.1 KB, 227 views)
__________________
Mental health is an extremely serious issue, which, if not detected and treated early on, will drive you mad.
Reply With Quote
  #7  
Old April 15th, 2007, 01:17 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: tool request (terrain math)

I love both the Awk and the Perl versions of this. And reading them I SHOULD be able to figure out my next request but I wasnt able to. (I HATE bitmath)

The problem is that the nostarts are hidden in the terrain bits now. If I generate a map for a 10 player game, then everyone joins, then it tries to generate the game. Only after everyone has joined will it blow up because there is no way to fit that many players on the map.

Can someone whip me out a simple script (yabasic, bash, awk, sed, perl) which will tell me how many nostarts I have. All it has to do is count them so I know how many players to limit the game to.

Gandalf Parker
__________________
-- 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
  #8  
Old April 15th, 2007, 03:43 PM
DrPraetorious's Avatar

DrPraetorious DrPraetorious is offline
Major General
 
Join Date: Feb 2005
Location: Lake of Hali, Aldebaran, OH
Posts: 2,474
Thanks: 51
Thanked 67 Times in 27 Posts
DrPraetorious is on a distinguished road
Default Re: tool request (terrain math)

Change "mask" to the actual bitmask you want.

Code:

awk '/#terrain/ && (and($3,mask)==mask){print; i++;} END{print i " start locations";}' map.mp



I'm at my folks place so I can't check to see if it works.
__________________
If you read his speech at Rice, all his arguments for going to the moon work equally well as arguments for blowing up the moon, sending cloned dinosaurs into space, or constructing a towering *****-shaped obelisk on Mars. --Randall Munroe
Reply With Quote
  #9  
Old April 15th, 2007, 04:52 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: tool request (terrain math)

It works great. Thanks again.
__________________
-- 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
  #10  
Old May 1st, 2007, 03:40 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: tool request (terrain math)

OK I thought we had this but so far I found a perl script that doesnt seem to work for me, and an online one that I cant use in lynx.

I want to package up some of the wrapped maps from PH's map generator but I notice that it has no nostarts. Can I get something (basic, awk, sed, whatever) that will nostart any province with fewer than 4 neighbors?
__________________
-- 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 06:55 AM.


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