Sign in to follow this  

Map Editor

This topic is 2544 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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);
}

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 2544 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this