Aces High Bulletin Board
General Forums => Terrain Editor => Topic started by: F1Bomber on October 25, 2003, 03:03:26 AM
-
Okay i had to make a program to convert a bmp image to a typ file for the aces high terrian engine.
Its simply accepts a bmp image, and you add in the color types that you have put into the 24 bit 512 pixcel., 512 pixcel image. And it spits out the terrian as a typ file. Put the typ file into your terrian and wala, your got your WHOLE terrian textured without needing to use ah editor.
Still working on it, but will have a demo pretty soon.
-
And what's the difference between this and AK's BMP2MAP?
-
Originally posted by NHawk
And what's the difference between this and AK's BMP2MAP?
If you don't want to accept BMP2MAP's height-to-terrain-type conversion algorithm, you can roll your own with this.
-
Do you have exectly description of all this formats: typ, elv etc.. and the rest......
I'd like to write some usefull utilites for file convertion, clipboard map building, filling it with objects. Sometimes it is more usefull to work with numbers and not trying to put object of fields exectly.
thank you
-
OKay i have attached the following files and the address were to get them from.
You will need java run time enviroment to actualy use this program. I wont be holding anyones hands and walking them though the proccess but here is the requirements for the little program.
BMP Image , 512 X 512 pixcel. 24 Bit color.
Place the bmp image that you wish to be converted onto c:\ drive.
run the following program with the following in command promot
java Changer
This will make a file called Demo.typ
Copy and past this into your folder that currently holds your map for example, i have a folder called demo, i place the demo.typ file into that folder.
Run ahedit and see your new terrian.
---------------------------------------------------------------------------
Okay heres a walkthough for people who dont really understand the above.
1. Open paint
2. Copy and past this file into paint.
(http://www.bushtech.com.au/chads/demo/demo1.bmp)
3. You will see pre-defined color pattern on the top right hand side of this image above. These are the following order.
Black - water
Green - grass
Dark Green - Forest
Brown - Farm
White - snow
Grey - Rocky
Next you will see the little island that i have created using those above color patters.
P.S Please dont use photshop or paintsho pro, the program is very basic and will only read the colors above. Or you can use them, but just use hard tools that dont creat white pixcels of different color types when you mix them.
4. Rember your map needs to be 512 pixcel by 512 pixcel, ahedit will die if your bmp map isnt 512 x 512.
5. Run the java application
6. Copy and past into the aheditor and see the difference.
Hes is a image i have included.
(http://www.bushtech.com.au/chads/demo/demo2.jpg)
add some height into the terrian and you got this.
(http://www.bushtech.com.au/chads/demo/demo3.jpg)
-
Here is the java file
http://www.bushtech.com.au/chads/demo/Changer.class
Source code..
*
* Created on October 25, 2003, 12:53 PM
*/
/**
*
* @author Chad Lion
*/
import java.io.*;
public class Changer {
/** Creates a new instance of Changer */
public Changer() {
try{
// Open File and start a fiel called demo.typ
File inputFile = new File("c:\\demo.bmp");
File outputFile = new File("c:\\demo.typ");
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
int b;
int e;
while ((c = in.read()) != -1){
b = in.read();
e = in.read();
// Grass
if( (c == 8364 )&&(b == 255) && (e == 0) ){
out.write( 1 );
}
// farm
if( (c == 0 )&&(b == 8364) && (e == 8364) ){
out.write( 3 );
}
// Forest
if( (c == 0 )&&(b == 8364) && (e == 0) ){
out.write( 5 );
}
// Rocky
if( (c == 8364 )&&(b == 8364) && (e == 8364) ){
out.write( 2 );
}
// Snow
if( (c == 255 )&&(b == 255) && (e == 255) ){
out.write( 6 );
}
if( (c == 0 )&&(b == 0) && (e == 0) ){
out.write( 0 );
}
}
in.close();
out.close();
System.out.println( "finish" );
}
catch( Exception e ){};
}
public static void main( String args[] ){
Changer hse = new Changer();
}
}
// You accept the code as is.
// P.S if your going to edit the code for future use do the following.
BMP format 28,80,60
SWAP left and right
60,80,28
Will give you the correct value to edit.
Very basic, because i only want to use it once, and then kill it.
-
Okay basic rundown of the typ file type.
Each mile has a value of either 1,2,3,4,5,6,0 interger value type. The typ file basicaly holds these values for the 512,512 square map. Though i only noticed this well reading the value within the typ file and testing out different example.
So if you want to creat your own program all you have to do is follow this.
Read RGB Pixcel color. Depend on the type the color is, then either write a 0 to 6 into a typ file depending on what tile you want.
You will see from my program above, that i read in 3 values. The 3 Values are the different colors for the RGB bitmap. THen depending on the RGB color i write a 0 to 6 depending on the input. Its as easy as that. It does the job, and i hope you can find this information helpfull for building your own program to do this. But i dont have the time to mess around with the file types right now.
-
Just FYI... you can open a .typ file in Photoshop also.
-
How do you open a typ file in photoshop, are we talking about the same kind of typ file?
-
Are you on about the RAW way dux?
-
Yes, use the RAW option. It pretty much guesses the right size, etc.
Here's the trick, though... when it opens it'll look like a pure black square; it isn't. Change it to Indexed Color mode and open the Color Table. Change the first 6 colors in the palette to something more meaningful... color 1 = blue (water), color 2 = green (grass), etc.
Paint the terrain (using those 6 colors) the way you want it, and close out of the file... no "save as..." or anything. Just Quit and Save.
Works like a charm. :)