MadMinute Games Message Board Forum Index MadMinute Games Message Board
This forum is for the people modding and playing TC2M games.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Garnier's Terrain Generator (and locations editor)
Goto page 1, 2  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    MadMinute Games Message Board Forum Index -> TC2M Modder's Corner
View previous topic :: View next topic  
Author Message
Garnier
Brigade Commander


Joined: 30 Apr 2009
Posts: 118
Location: New York State

PostPosted: Thu Dec 17, 2009 7:17 pm    Post subject: Garnier's Terrain Generator (and locations editor) Reply with quote

DOWNLOAD LINK

Extract the zip wherever you want, and run the included Updater.exe, this will download the current version of the program. After that use GarnierTerrainGen.exe to run the program.

This is a utility for making mapping easier. What it does:

1. It can take a bitmap file, and using a customized list of textures, create a new bitmap by replacing each pixel by a texture that corresponds to the pixel's color value.

For example, in one operation it can turn this:


Into this:


The textures are just .bmp files that can be easily changed.

The input file can be any size.

The program looks at the red value of the pixel, the green and blue don't matter. It matches the red value with a texture that is specified in the "settings.txt" file.

2. It also can copy the original image into a grayscale bmp if you want. You can customize which Red values correspond to which grayscale values. This allows you to use the original image to set the textures using any pixel colors you want and create the textured image for terrain.jpg, and then generate a grayscale image as well for copying into <mapname>.tga.

A sample input.bmp is included so you can try running this right away to see what it does.

You can turn antialiasing on or off in the settings.txt file. It isn't real antialiasing, it's just a blurring operation I wrote to make the textures blend together. It takes considerably longer to process an image with antialiasing turned on, because it has to blur each pixel from all 8 surrounding pixels. On a 2048x2048 image, that's a lot of calculating.

After generating the new images, you can copy grayscale.bmp into mapname.tga, and terrain.bmp into terrain.jpg, for your map. I have tested the sample map that's included in this download, and it worked properly in game.

New (12-22-09) Locations Editor:
I've added a new system for easily setting up objective and sound locations on your map. Click LocationFinder -> Launch on the menu, and it will open this window:


Instructions:
By default it loads terrain.bmp.
Click on the map to add an objective.
Right-click on the map to add a sound location.
Right-click on a location's label to delete it.
File->Export Locations will write the data for the locations to locations.txt
This data is ready to copy and paste into your mapname.csv.
File->Import Locations will read locations.txt and add whatever locations are in it.
File->Clear will remove all locations from the map (but not change locations.txt).





Garnier
_________________
My OOB Generator -


Last edited by Garnier on Tue Dec 22, 2009 5:44 pm; edited 4 times in total
Back to top
View user's profile Send private message MSN Messenger
7th Wisconsin
Division Commander


Joined: 08 Aug 2006
Posts: 390
Location: Wisconsin

PostPosted: Thu Dec 17, 2009 11:28 pm    Post subject: Reply with quote

Holy cats!!! Can't wait to play with this after my son's concert tonight.
_________________
"By some strange operation of magic I seem to have become the power of the land"
-G.B.McClellan
Back to top
View user's profile Send private message
Davidd
Brigade Commander


Joined: 06 Jun 2005
Posts: 194
Location: England

PostPosted: Fri Dec 18, 2009 3:38 am    Post subject: Reply with quote

The .bmp format seems to be wrong on the converted files, they seem to be .png files and just need to be renamed.

Maybe I dont have the full install?
Back to top
View user's profile Send private message
7th Wisconsin
Division Commander


Joined: 08 Aug 2006
Posts: 390
Location: Wisconsin

PostPosted: Fri Dec 18, 2009 4:38 am    Post subject: Reply with quote

Mozirry's Pea Ridge-



The west red area is a pond, the east area boulders. Is something amiss?
Edit: I got it, there is no corresponding .bmp image in the texture folder for bolder or pond.


Quote:
...they seem to be .png files and just need to be renamed.

Irfanview tells me this as well.
_________________
"By some strange operation of magic I seem to have become the power of the land"
-G.B.McClellan
Back to top
View user's profile Send private message
Garnier
Brigade Commander


Joined: 30 Apr 2009
Posts: 118
Location: New York State

PostPosted: Fri Dec 18, 2009 12:53 pm    Post subject: Reply with quote

Davidd wrote:
The .bmp format seems to be wrong on the converted files, they seem to be .png files and just need to be renamed.

Maybe I dont have the full install?


It creates .PNG files for you? Are you sure you didn't change the name of the output file in "settings.txt"?

I am running the same thing that I uploaded (I download it to be sure I'm using the same thing), and my output files are .bmp. I wrote the code and did not write anything that would format the picture differently from standard BMP. But, if you change the name of the output file, it will create a file with whatever name you specify, and if you change the extension it will need to be changed back.



The red just means you didn't have a .bmp for that name, as you discovered. It's fully customizable, you can change which color shade goes to which texture, and add new textures for the colors between the existing ones if you want, then convert those in turn to whatever you want when generating the grayscale file.
_________________
My OOB Generator -
Back to top
View user's profile Send private message MSN Messenger
Davidd
Brigade Commander


Joined: 06 Jun 2005
Posts: 194
Location: England

PostPosted: Sat Dec 19, 2009 4:47 am    Post subject: Reply with quote

I did'nt change the settings.txt.

The files created have the .bmp extender, but they are png format and I have to rename the extender accordingly. Only then will the file load into PhotoShop. Maybe it's a PhotoShop thing, my setups etc?

It is in the hex identifier as PNG too though.

Its not bad thing in png - nice compression compared with the bmp format, it just needs the right extender to load, no complaints though, very nice util!
Back to top
View user's profile Send private message
Crikey
Corp Commander


Joined: 25 Jul 2007
Posts: 530
Location: UK

PostPosted: Sat Dec 19, 2009 10:54 am    Post subject: Reply with quote

Garnier welcome to the mod community. This looks an extremely useful tool. Thanks for taking the time to produce it.

Could this program be adapted to provide an option to seek certain terrain files linked to different terrains......for example if a terrain set was created for winter, this could be stored in a directory within the program. Once the grayscale is ready you could then choose which terrain you wished to apply? i.e. the program seeks textures from a winter terrain set, arid terrain set etc.

Wink
Back to top
View user's profile Send private message
Garnier
Brigade Commander


Joined: 30 Apr 2009
Posts: 118
Location: New York State

PostPosted: Sat Dec 19, 2009 3:28 pm    Post subject: Reply with quote

That's a good idea, and can be done at some point.

For now, just have two folders with textures and change settings.txt (or rename the folders) to switch between them.


Quote:
The files created have the .bmp extender, but they are png format and I have to rename the extender accordingly. Only then will the file load into PhotoShop. Maybe it's a PhotoShop thing, my setups etc?


I don't have photoshop, I open these in MS Paint or Paint.NET and then copy into GIMP.
_________________
My OOB Generator -
Back to top
View user's profile Send private message MSN Messenger
Garnier
Brigade Commander


Joined: 30 Apr 2009
Posts: 118
Location: New York State

PostPosted: Tue Dec 22, 2009 5:31 pm    Post subject: Reply with quote

I've added a location finder system, instructions at the end of the first post. Run the Updater.exe to automatically install this update. Note that this will also install the original texture set. You can rename your textures folder so it doesnt get overwritten, if you've created textures of your own. Smile



The "Convert to texture" operation now also exports a minimap file (mm.bmp) which is the terrain file resized to 572*572 and rotated properly.
_________________
My OOB Generator -
Back to top
View user's profile Send private message MSN Messenger
sweeteye
Division Commander


Joined: 14 Apr 2009
Posts: 223
Location: Ohio

PostPosted: Thu Jan 14, 2010 3:59 pm    Post subject: White Line Reply with quote

I am getting a thin white line around the edges of the terrain map when I generate one. Kind of looks like a yard line on a football field. I am wondering what might be causing this. The grayscale map I am using is 2048 x 2048 pixels.
_________________
26th OH Ind Battery Ohio Light Artillery
Sons of Union Veterans
Back to top
View user's profile Send private message
Garnier
Brigade Commander


Joined: 30 Apr 2009
Posts: 118
Location: New York State

PostPosted: Thu Jan 14, 2010 5:31 pm    Post subject: Reply with quote

It doesn't happen for me. You could post your settings file (if you changed it from the standard one), and the grayscale and terrain images if you want.

Has it done this every time since you started using it?

Is the white line just one pixel wide?

Does it happen both when you have antialiasing on and off? (this is in the settings file).
_________________
My OOB Generator -
Back to top
View user's profile Send private message MSN Messenger
sweeteye
Division Commander


Joined: 14 Apr 2009
Posts: 223
Location: Ohio

PostPosted: Thu Jan 14, 2010 5:46 pm    Post subject: Reply with quote

The line has showed up on all three maps I have made using it so far. The line seems to be one pixel wide. Going to try some more tests and see what happens. Cropping the image did not seem to work unless I did not do it right.
_________________
26th OH Ind Battery Ohio Light Artillery
Sons of Union Veterans
Back to top
View user's profile Send private message
Garnier
Brigade Commander


Joined: 30 Apr 2009
Posts: 118
Location: New York State

PostPosted: Thu Jan 14, 2010 5:49 pm    Post subject: Reply with quote

What I meant by cropping was, make your input image 2050 x 2050 pixels, and then generate, then crop the output to 2048 x 2048 so the white line is cropped out.

Another solution would be to select a 2 pixel strip around the entire image (select all and then shrink selection by 2), and blur that edge so the colors that are there get blurred into the white.

But work-arounds like this are often a waste of time, I'd like to find out what's causing it.
_________________
My OOB Generator -
Back to top
View user's profile Send private message MSN Messenger
sweeteye
Division Commander


Joined: 14 Apr 2009
Posts: 223
Location: Ohio

PostPosted: Thu Jan 14, 2010 6:47 pm    Post subject: Reply with quote

I managed to get rid of the white line but now I have a faint blue one. The program I use to create the grayscale input file for the generator is flipping and rotating the image so that I have had to flip and rotate the output file. I corrected the input file and the white line disappeared but as I said I now have a faint blue one.


_________________
26th OH Ind Battery Ohio Light Artillery
Sons of Union Veterans
Back to top
View user's profile Send private message
Garnier
Brigade Commander


Joined: 30 Apr 2009
Posts: 118
Location: New York State

PostPosted: Thu Jan 14, 2010 6:49 pm    Post subject: Reply with quote

I can't really help without seeing the files, it doesn't do anything like that for me.
_________________
My OOB Generator -
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    MadMinute Games Message Board Forum Index -> TC2M Modder's Corner All times are GMT
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


Powered by phpBB © 2001 phpBB Group

Chronicles phpBB2 theme by Jakob Persson (http://www.eddingschronicles.com). Stone textures by Patty Herford.