Crop map

Paasky

Good News Everyone!
Joined
Nov 19, 2003
Messages
2,062
Location
Vantaa, Finland
So, the resize tool in the map editor is spiffy and cool, but I'd really like to crop a map. I'm using Dale's Europe map, which has a bunch of water that I don't need and is just wasting space and memory atm. Any way to make the map smaller?


I miss the days when maps were simple text files as well....
 
The is a utility I would like as well.
My reason is to create a more simplified map/mod of what I am working on for those of us with computers that are slightly slower.

Just thought I would add my two cents (in hopes of someone pursuing this issue).
 
I would like the game devs to include a cropping feature. I also want them to include a function where you display a background image for tracing purposes, so you can upload any image and trace it.

There are softwares which can make a window semi-transparent (I can't recall one by name), but I'm not sure they work on DirectX windows though.

Also the maps seem to be in some sort of text format - most of the data is composed from dots and various pipe symbols (there an be also some data which don't appear in text editor though, I didn't any map files in hex editor).
 
I have no clue what you are talking about Nercury....
please explain.
thanks!

There seems to be no way to load external libraries that could read/write files or send/receive data from network. If there was a way, it would be possible to save plot types into a text file then load this text file over map script with some settings how much to crop!

Also the maps seem to be in some sort of text format - most of the data is composed from dots and various pipe symbols (there an be also some data which don't appear in text editor though, I didn't any map files in hex editor).

Text file can be said to use binary format where every byte is a character. In those map files, however, byte can represent whatever they want. When you look at it from text editor, some bytes represent text characters, some don't. This is called binary format :)
 
Oh wait... It is possible, but crude.

- Write some mod to dump plot types into Lua log files (logging must be enabled).
- Copy this text from log files into a custom map script .lua file
- Build a mod with this map script, load this mod in World Builder, and generate new map based on this data (only using cropped area).

Pain in the ... though.
 
There are softwares which can make a window semi-transparent (I can't recall one by name), but I'm not sure they work on DirectX windows though.

Also the maps seem to be in some sort of text format - most of the data is composed from dots and various pipe symbols (there an be also some data which don't appear in text editor though, I didn't any map files in hex editor).


Thanks for that tip. I'm going to try it http://download.cnet.com/Actual-Transparent-Window/3000-18487_4-10138522.html?tag=mncol;2
 
So, the resize tool in the map editor is spiffy and cool, but I'd really like to crop a map. I'm using Dale's Europe map, which has a bunch of water that I don't need and is just wasting space and memory atm. Any way to make the map smaller?


I miss the days when maps were simple text files as well....

tbh i find the resize tool not very useful

best thing available to crop maps would be using external image editing programs that have the ability to crop, and then convert those images to maps. of course since there's still no export map to a image program, this means you either start your maps from scratch or use preexisting images of civmaps

i havent checked in a long time but iirc a lot of civ4 maps had bmps packaged with them so you could do your own editing
 
Text is easy to work with. civV is a step down from this point of view, but since we can just import civ4 maps there is still a way.

For the RFRE map I chopped 2 rows off the top, 4 columns from the left, and added 5 new columns to the right using a perl script. That map that everyone uses for the med didn't have enough room for Persia, and too much wasted space on the top, bottom, and left :/
 
Primordial,

how did you crop the map? Can you go through a more detailed process.
thanks,
-Zen Blade
 
This is perl. It runs on the cmd line like:
myperlscipt myoldmap.whatevertheextensionis

The output is always newmap.Civ4WarlordsWBSave. If there is any problem just diff the maps.

Basically, to chop from the top is just deleting plots where y > Ytotal - #chops. Adding to the right is just a loop from 0 to Xmax. Just add in tundra, and then fix in WB. Adding/deleting to/from the left is the most complicated since all of the existing plots need x adjusted to x +/- $NumNewColumns.

And the only other detail is to adjust the "num plots written" entry to be the new total, as well as "grid width=" and "grid height =".

The lines on the bottom starting with # are comments in perl. Those really belong in a different script. All those lines do is output the new plots, so then you'll have to paste those into the new map at the right location in the file (ie just after the last plot).

Code:
# $extra_width = 5;
$off{top} = 2;
$off{left} = 4;

$/ = "Begin";
open(NEWMAP,">newmap.Civ4WarlordsWBSave") || die "$! tyring to create newmap\n";
select NEWMAP;

while(<>){
	if ( /^(\S+)/ ){
		$type = $1;

                if ( $type eq "Plot" ){
		   if ( /x=(\d+)\s*,y=(\d+)/ ){
		   	$x_coord = $1;
		   	$y_coord = $2;
	  	   }
		   if ($x_coord < $off{left} ){
				next;
		   } else {
	                	$new_x_coord = $x_coord - $off{left};        # move all plots left 1
				$_ =~s/x=$x_coord/x=$new_x_coord/;
		   }
		   next if ( $y_coord >= $newMapHeight ); # skip top plots
       	 	}

		if ( $type eq "Map" ){
	           if ( /grid width=(\d+)/ ){
			   $map_width = $1;
			   if ( $extra_width ) {
			      $new_map_width = $map_width + $extra_width;
			   }  elsif ( exists $off{left} ) {
			      $new_map_width = $map_width - $off{left};
		           } else {
			      $new_map_width = $map_width;
			   }
			   $_ =~s/grid width=$map_width/grid width=$new_map_width/;
		   }
	           if ( /grid height=(\d+)/ ){
			   $map_height = $1;  
	                   $newMapHeight = $map_height - $off{top};
			   # $new_map_height = $map_height -1; # remove original bottom row  
			   $_ =~s/grid height=$map_height/grid height=$newMapHeight/;
		   }
		   if ( /num plots written=(\d+)/ ){
			   $new_num_plots = $new_map_width * $newMapHeight;
			   $_ =~s/num plots written=\d+/num plots written=$new_num_plots/;
		   }
		}
	} 
	print;
}

# # extend map east
# $extra_width--;
# foreach $i ( 0 .. $extra_width ){
# 	$new_x = $map_width + $i;
#         foreach $new_y ( 1 .. $new_map_height ){
# 	 	$new_y--;
#   print <<"EOP";
# BeginPlot
# 	x=${new_x},y=$new_y
# 	TerrainType=TERRAIN_TUNDRA
# 	PlotType=2
# EndPlot
# 
# EOP
#   }
# }

After validating in civ4 WB, the final step now is to use civV WB to import into civV. This works very well so long as the civs, etc... match. Anything that doesn't (eg culture) is dropped.

If this is all too much I can probably do it for you sometime this week. I just need a map and what chops/adds are desired.
 
Top Bottom