Map Editor

Started by
4 comments, last by Darg 13 years, 3 months ago
So, I'm currently in the process of making a map editor. Right now, I admittedly don't have too much done but my concern is with my Tile class (this is in Java, by the way). I'd like to have my editor similar to a paint program, having different brushes to draw textures and such. However, I'm wondering how I store the texture data when it happens that half of the tile is of texture A and another half is of texture B. I know I should use some type of array, but by using a byte[width*height*4] I'd basically just be saving an image (which is obviously not good when maps will get large and numerous). I'm also using LWJGL, so that may factor into a good solution. Thanks in advance!
C++: Where your friends have access to your private members
Advertisement
You may need to provide some more detail, are you doing some sort of alpha blending on the texture (IE: placing a semi transparent texture over another texture)

Or are you putting 2 textures side by side for each tile?
IE;
____________|    |     ||tex1|tex2 ||    |     |------------


and your saying that the whole square is one tile?

Or are people going to be actually drawing all textures from inside of your editor?

I personally design all of my textures outside the editor and just import them.
All textures are just stored as PNG's with no compression for a 64x64 texture thats like 16KB
The textures are already made and be "drawn" onto the tiles. This eliminates having hundreds of different transition tiles because realistic transition can be easily made. There most likely be some antialiasing on the edges for a more natural look.
C++: Where your friends have access to your private members
What you're describing is texture blending or in this specific case texture splatting on the terrain. This is achieved by first determining how many different textures you want on the terrain.

Previously I've used 5 different textures consisting of 1 base texture and 4 assigned textures which can be painted onto the terrain wherever you want.

The way this works is pretty much as you described, you would need to store a separate 4 channel texture (RGBA) with each channel being the opacity of whatever texture is assigned to it. You can have this texture the same size as your terrain so that each vertex can be assigned different textures or you can have it larger than the size of your terrain for better blending between vertices.

When determining the final colour what I do is the following:

totalUsed = splatTex.R + splatTex.G + splatTex.B + splatTex.A;finalCol = tex1 * splatTex.R;finalCol += tex2 * splatTex.G;finalCol += tex3 * splatTex.B;finalCol += tex4 * splatTex.A;if(totalUsed > 1){    finalCol /= totalUsed;}else{    finalCol += baseTex * (1 - totalUsed);}
Portfolio & Blog:http://scgamedev.tumblr.com/
There's still the issue of how the data is saved, though. What type of array should be used to handle this type of graphical data?
C++: Where your friends have access to your private members
A texture?

Anytime I've done texture splatting before it's been through offline methods. ie making the splat texture in photoshop and importing it in. I assume that for your method if the editing is in realtime it would simply be a matter of saving the texture to a lossless format when you save the map.
Portfolio & Blog:http://scgamedev.tumblr.com/

This topic is closed to new replies.

Advertisement