# Mapping Resources > Mapping Elements >  TreeThing

## Ramah

TreeThing is a simple program that is used to automatically generate forests which can then be exported in to your favourite paint program to use in your mapping.

It is written in Java and requires you to have JVM (Java Virtual Machine) installed to run it.

Here's an image to show a typical workflow...



And here is a PDF tutorial of how to use it...



TreeThing is free to use but I would ask that you credit me if you use it and if possible link to this thread so that others might find it.

Enjoy.



Edit: Latest version - 0.9

1) UI update. Tried to make it a little more user-friendly by making most of the common functions more apparent. Most of the important features should be tooltipped - detailed tooltips are on by default but once you know the functions you can turn them to basic tooltips or off altogether in the options menu.
2) Added an option to randomly add some light shades of grey to the mask layer. This can be useful in post imagine by using the masks as a multiply layer to add variation. On by default.
3) Added a Link Brushes option in the options menu (or CTRL+L) to hold the current ratio between Brush 1 and Brush 2. Can save valuable seconds when resizing.  :Smile: 
4) Added a Viewport Padding variable in the bottom menu (in Advanced) to adjust the free space surrounding a forest. This has no effect when a template is loaded.
5) Added the option to view your loaded template. Located in the View menu.
6) Various bug fixes and improvements.



Previous version - 0.81

1) It is now possible to save and load settings through an option in the File menu. Also, the current settings can be saved whenever the program is exited and these will be automatically loaded up the next time the program is run.
2) Added an option to utilise the greyscale of a template for brush positioning. This option is availble through the "Brush Weight" section of the parameter menu when a template is loaded. Obviously this needs a template tailored to greyscale.
3) Lost all memory of what was in previous versions so cannot say exactly what else is new.

Previous version - 0.75 - fixed

1) Changed the way the program handles shadows.
2) Added an option to adjust the positioning of shadows due to the way shadows are now handled.
3) UI updates.
4) Uploaded a fixed version that include the missing directory. :$

----------


## Ramah

I need to totally rewrite this to handle the change to how shadows are handled. I've edited some of the lines but there may be references still in there.

*Tutorial One - Creating Brushes*

1.) Open a new document in your favourite raster paint program.
_Doesn't really matter what size - the program will shrink your brushes to a usable size - but obviously be aware that the larger you make your brushes the greater the filesize and also the more detail will be lost when they are shrunk right down._

2.) On a new layer, draw the outline of a tree in a dark colour. You don't have to use the pencil tool but don't make the edges _too_ soft at this point. Make this the largest brush you intend to have.
_The program will work better if all brushes are roughly the same width and height, but a small amount of variation won't kill it - the program works from the largest brush so any that are smaller mmay have more space around it when placed.
If you are pressed for time or just a rebel and don't intend to make a mask to go with the tree, make sure you colour in the foliage of the tree  so the program knows where to clip. It doesn't have to be opaque but needs to be above a cerain opacity (which is quite low... maybe 10% or something) so the program doesn't just ignore it._
Any other tree brush that you make for the same set, position the base of the trunk in the *same* position.

3.) With the largest tree being displayed, crop down your image so that any excess space is removed from the brushes.
_My image size for the Vaniyan shaded brushes after cropping is 100 x 119 px._

4.) Copy the tree outline to a new layer and colour in the foliage to make your mask. Use a sharpen filter to remove some of any softness around the edge.
_I colour my masks white but it isn't essential - the colour is unimportant. The sharper edge on the mask makes for more precise clipping when one tree is overlaid over another. The mask layer of a forest is also useful if you want to layer a colour beneath the forest on your map or put a stroke around the edges for a bold statement._

5.) If you took my "don't make the edges too soft" instruction when drawing the tree outline too literally, then feel free to soften it a little now with a small blur.

6.) On a new layer, shade the same side of the tree as your shadow will fall.

7.) On another new layer, shade the other side of the tree.

8.) Open a new document and draw a shadow for your tree. Crop it so that there is no unneeded space around the shadow. You don't need a shadow brush if you don't want but if you do you can draw as many different ones as you like.

9.) Save all your layers individually to .png files:

Shadow brush filenames need to begin with "shadow". E.g. "*Shadow1.png*" _(you can ignore capitalisation on all the filename instructions)_	Tree brush filenames need to begin with "tree". E.g. "*Tree1.png*"	Mask brushes need to begin with "mask". E.g. "*Mask.png*" _ Make sure you name any mask files correctly though if your forest has more than one tree. An incorrectly named mask could assign it to the wrong tree and create odd clipping in the forest._	Shade brushes are the most awkward to name:

First shade brush - same side as your shadow) If your forest only has only one tree brush (like the TreeThing defult brush set) or your shade brush can be used for all trees you can simply make sure your shade brush file begins with "shade" E.g. "*Shade1.png*"If your forest has multiple trees of varying shapes then each shade needs to be assigned to the right tree brush. Do this by including the name of the tree in the filename and following it with an underscore character "_" E.g. "*Shade1Tree1_.png*"_ (The underscore is a bit of a speed method to save me having to put more filename parsing in. You can safely miss this off if you have less than 10 tree brushes. Any more and placement errors will occur without it.)_Second brush - opposite side to shadow) The second shade brush needs to be named in the same way as the first but have either "_r", "rev", "reverse", "reversed" at the end of the filename. _Note the underscore if you simply use the letter "r" (in case someone uses some odd file naming system and the program mistakes the end of a word and thinks it is reversed)_ E.g. "*shade1_r.png*" or "*shade1_tree1_rev.png*" or even "*shade10Tree10_thisnamestillcountsalthoughitisoddre  verse.png*"

And that's it. You can add as many shade brushes as you like to a single tree. Same with shadows. You don't have to shade both sides of the tree if you don't want (although that will stop you shifting the light source effectively) You don't need to actually have anything other than a single tree brush to use the program. No shading needed. No shadow. No mask. But the forests generated will be much more effective with them.


Example Image to follow...

----------


## Dain

Good addition Ramah!
I use quite a lot this program and i'm happy to see you adding more personal stuff. I had a look on what you improved and it's great. I particularly like the random variation in the size of the trees, controlled with some settings though. It brings definitely something good.

So far, i've found that the standard brush fits the best and has the better final render. Coniferous trees miss something and the lack of shadow effects (not available at all in fact) for the other trees don't give them the capacity to be on the same level of achievement.
I don't know how hard it is to make new brushes but the thing I thought about, when I was doing ma map, was to try to make more brushes, especially new coniferous trees, palms (for jungle) and even swamps. Then the range of trees available would be even better.
But at this stage, it is just some ideas  :Wink:

----------


## Ramah

Glad you like it, Dain. I agree with you that some of the brushes are lacking but it is made with the hope that people will create their own brushes for it. It's not hard to do. Although having shadows could be made easier, which is something I want to address in a later version of it. The Vaniya Redone brushes also have shadows btw, although the brushes themselves appear very crisp and pixellated for some reason. I need to redo them again it would seem.

If you'd like to make some bruses to use in it then I could include them in future zips.

----------


## Coyotemax

I'll totally be checking this out..  looks promising!

----------


## Ramah

Added a little more info and a screenie to the top post.

----------


## Sapiento

Congrats, Ramah! I just tested the new program: excellent.

It shouldn't be a problem to make new trees, too. Assume I right that you made alpha, shade, shadow and tree on separate layers and saved these separately?

I think it would be appropriate to create a new award category for useful map gadgets. Fluesopp and Ramah certainly deserve it.

----------


## Coyotemax

Or perhaps the Honourable Contributor badge - they certainly qualify for something!

----------


## Jaxilon

Looks good - this is Photoshop only, yes? Or do we have one for Gimp as well?

----------


## Dain

> Looks good - this is Photoshop only, yes? Or do we have one for Gimp as well?


This is an external program so you can use what you get with any program you're good with. PS, Gimp, PaintShopPro, basically any software that implements layers  :Wink:

----------


## Sapiento

> Or perhaps the Honourable Contributor badge - they certainly qualify for something!


Indeed, that would certainly do it.

----------


## Ramah

I've added a new version of the program in the original post. I've listed the changes there but I'll add them here too...

1) You can now add shading to individual trees. The Vaniyan brushset has been updated to represent this.
2) There is an option to remove badly placed trees. This is a work in progress and needs tinkering with. On tightly packed forests this will remove lots of trees with just small jitters added. This is because those forests are so close they are inherently badly placed. It's less drastic on forests that have a lower density.
3) Changed the way that mirror trees work. It doesn't move the shading, just the tree brush. You can also randomly mirror trees to get more variation in a forest.
4) Added the ability to have the other side of the tree shaded. This works in conjunction with the mirroring.
5) Added the ability to move the lightsource to the opposite side. This moves shadows and shading accordingly. Shadows utilise the normal shadow brush but shading requires two brushes for it to work properly.
6) Other small, under-the-hood changes that will barely be noticable.


I've also edited the second post into a tutorial on how to make your own brushes for the program. I intend to add an example image later. I'll also add a tutorial on how to use the program at a later date.

Enjoy.

Edit: Gah! I just tested something and realised that I have inadvertently broken the "Remove Misplaced Trees" function. Not sure if it will screw up every time but for now it's safest just to leave it alone. I'll fix it for the next version.

Ah well... here's an image of the updated Vaniyan brushset... No jitters were used on this so it's quite uniform. Also, if you study it you should be able to see that some of those trees are mirrored. The lightsource has also been shifted.

----------


## ravells

I just can't believe how terrific that looks! I'm glad you took a break from writing to become a cartographer / computer programmer par extraordinairre!

----------


## Ramah

Cheers Ravs.

I've uploaded a new version in the original post that fixes the bug with the "Remove Misplaced Trees" code and also fixes a bug I discovered when checking that which was preventing the program from saving all layers. :s

Hopefully everything is working as intended up to now.

If anyone finds any other bugs then let me know please. Cheers.  :Smile:

----------


## RecklessEnthusiasm

Hey guys, I thought that this tree program might be useful for a lot more than trees, so I made some (bad) experimental brushes for mountains and tried them out. The program seems to automatically downsize large brushes automatically a good bit, so the objects came out pretty pixilated--resizing them and applying a filter or two in photoshop fixed that a little bit. It would be neat if changing the size of the actual brushes would adjust the resolution of the actual output rather than being resized, (to better accommodate making a really large 300dpi map), but this is still amazingly useful.

The only peculiarity was that sometimes it applies the wrong shadow and shading to the wrong mountain, but I can't help but thinking maybe that was my fault somehow.

Basically, I was thinking about making a mountain brush set and a hill brush set as well. Then I could make a continent shape, three different masks indicating where I wanted each feature (mountains, hills, and trees) then click, click, click, I'd have a crazy-easy way to generate tolkien-esque maps.

Anyway, really amazing program, Ramah. You'll get some well deserved rep from me.

----------


## Ramah

Glad to see someone is experimenting.  :Smile:  I'm especially glad someone has ventured into making their own brushes for it. And yes, I would suspect that the fault with the shading going wrong sometimes would be yours. Probably with the naming of the shade file or something. Couldn't be my fault. No way, no sir.  :Smile: 

By the way, I have pages of notes already on how to make a MountainThing program. Unfortunately the way the current program works with placing trees really doesn't gel with how I would want mountain/hill placement to work so it means a complete rewrite of that code, which is basically the heart of the program. The good news is that it's the rest of the gubbins, the UI and implementing the various ideas on how to make it more useful that takes the longest to do and most of that will be reusable from TreeThing.

If you got a mountain range to work how you wanted it to be with the current program then you would be pretty lucky.

Anyway, it's on my to do list. Along with half a dozen other things I never seem to have time for. Hehe.

----------


## Ramah

New version posted up. Changes are...

New version - 0.6

1) Fixed the "Remove Misplaced Trees" function so that it should work properly now. It is customisable in the bottom bar to increase/decrease allowed tolerance of what constitutes a misplaced tree. Making it too large will probably create strange results.
2) Added a "Remove Overlapping Trees" function. This will do as it says on the tin and remove all overlapping trees. So if you want a forest with no overlapping, feel free to add larger jitters than normal.
3) Edited all the brush sets so that they now all have reverse shading. (removed original Vaniya set as shading was built in... and they were crap.  :Smile:  )
4) Added "Merge masks" which doesn't do a lot other than to remove any tolerance on masks clipping so that if you want a blanket forest with merged trees you can use this layer and just stroke it in post imaging.
5) Renamed certain things to make way for expansion into hills and mountains.
6) Changed the filename specifications on the brush masks to "mask" instead of "alpha" as this just makes more sense.
7) Various little bits and bobs.


Edit: Forgot to add... with the "Remove Misplaced Tree" function it currently doesn't resize its parameters depending on tree size like it does for other things. So this will probably need manually adjusting if you change tree scale for now. I intended to fix it for this post but I ran out of time and doubt I'll get chance to work on it for a few days now and wanted to get this out.

----------


## sigurdbjohansson

how about a manual for the program? i absolutely love it, but sadly, my brain keeps farting when i try it out!

----------


## Redrobes

Very well done and repped.

----------


## Ramah

> how about a manual for the program? i absolutely love it, but sadly, my brain keeps farting when i try it out!


Yeah, sorry. I intend to post up a quick tutorial at the start of the thread. I'm so used to it I keep forgetting that others may need a little help in getting started with it. It is really simple to use but I know from experience with installing other programs that a wealth of options can be a little daunting at first. I'll try and get something posted up later today.

----------


## sigurdbjohansson

So looking forward to using it!
 :Very Happy:   :Very Happy:

----------


## Ramah

I've just edited the first post to include a PDF tutorial in how to use the program and showing how I did these forests with it...




Sorry for any typos/grammatical errors in the tutorial.

----------


## Marken4

Where do I download this? ^^'

----------


## Ramah

> Where do I download this? ^^'


From the first post in this thread.


Edit: Oh, forgot to say in the last post...  I realised while doing the tutorial that I had mistakenly left the program with a much larger loop than was needed during the "Remove Misplaced Trees" function. I had made it go through the whole grid whilst trying to debug it and forgot to put it back when I solved the problem.
Consequently, if this function is used it takes longer than it should and depending on the size of the template used might hang for several seconds and appear to do nothing.

This is nothing to worry about but I'll fix it for the next version I post. Sorry.

----------


## Marken4

Wops.. And one more thing.. It wont upload a template.. It's just wont..  :Frown:  I can't click on the button "Import Template" .. :\

----------


## Ramah

> Wops.. And one more thing.. It wont upload a template.. It's just wont..  I can't click on the button "Import Template" .. :\


Really? Hmm... that is most odd. I just retested it to make sure I hadn't somehow uploaded a broken version and it works fine for me.

Has anyone else had this problem?

Edit: Out of interest, is your installation of Java Virtual Machine up to date?

----------


## Ramah

An update to the program.

I've still not wrestled all my (perceived) problems from the Remove Misplaced Trees tool, and the way that brushes were handled with the extra space at the side to allow for shadows was really making things harder than they needed to be. So I've changed the way that shadows are handled. They are now drawn in separate images cropped to their size and the trees etc. are also cropped so there is no blank space. This makes things such as mirroring much easier but presents its own problems such as: where are they attached to the trees?
To this end there is an extra option on the dropdown list at the bottom, "Shadow Offsets." This allows shadows to be moved into position. As yet the program doesn't save these offsets between sessions but it is on my to do list.
I've edited all the included brush sets to work with this change to the shadows.

I've also spent some time trying to improve the UI a little. I've still some way to go and I want to include buttons for things such as mirroring, light direction and tree removal, but it's starting to look a little better. I have to say, whoever designed the stock layout managers for Java needs a punch in the mouth. :S

Here is a screenie of how it looks right now...

----------


## tilt

Looks good Ramah - gotta try that as soon as I get the time - but to save time, I'll just rep you right now  :Smile:

----------


## Sapiento

Hi Rama!

I receive this message when trying to start the program version 0.75:



Version 0.6 worked flawless. Any idea?

----------


## Sapiento

Some trees I made for Ramah's program. Just unzip into the Treething main folder.

----------


## Ramah

Hmm, sorry Sapiento, I have no idea why you are getting that error message. Unless somehow the UI enhancements with the Look and Feel have screwed something up, but the program should intercept any such problems and return to the default look if that is the case. So... hmmm. :S

Has anyone else tried it and either got it to work or is getting this error message?

I'll try and tie up a few loose ends on the version I am currently working on and upload it, see if that will get rid of the problem. There will probably be bugs and problems with the feature I am working on but everything else should work ok I guess.

It's great that you have made some brushes for it by the way.  :Smile:   I notice that your coloured brushes have some light shading in the actual colouring of the brush. You might want to avoid this if you ever want to mirror the brushes or change the light direction.

----------


## Ramah

Gah! I think I have worked out why it isn't working. Tsk. This goes to show that although 0.75 has been downloaded 10 times so far, no-one is giving me feedback. So thanks for that Sapiento.

As a quick fix, without the need for me to upload a new version, here is a missing directory that should have been included with the previous version.

This needs unzipping into the TreeThing root directory, so you should be able to see the directory in the same place as the brush directories.

Sorry about that.

----------


## Sapiento

> Gah! I think I have worked out why it isn't working. Tsk. This goes to show that although 0.75 has been downloaded 10 times so far, no-one is giving me feedback. So thanks for that Sapiento.
> 
> As a quick fix, without the need for me to upload a new version, here is a missing directory that should have been included with the previous version.
> 
> This needs unzipping into the TreeThing root directory, so you should be able to see the directory in the same place as the brush directories.
> 
> Sorry about that.


Thank you, Ramah, for the fast and useful response! It works now.

----------


## Jaxilon

Alright, I give, what am I doing wrong here? I download this thing but I can't get it to run at all.

I extracted the entire thing into it's own directory but when I click on the executable jar file it says it can't find the main class Mapmaking.main program will exit.

I know this has to be something stupid but for whatever reason I'm just not getting it.

edit: BAH nevermind, I looked up 2 posts above and downloaded the missing directory and it's going now.

----------


## Ramah

Yeah, sorry about that Jax.

I've uploaded a fixed version now in the original post.

I should hopefully have a new version posted soon. Just need to find the time to iron out a few bugs first. Here are a few images that show the changes...



I've changed the way it works slightly so it will now handle brushes of different heights (widths still need to be pretty much the same). To show this I now include a "Mixed Forest" brush set that uses, the default tree and the coniferous trees together. Fig. 1.

On top of that I've given the program the ability to use the greyscale information from a loaded template to position trees.



Fig.2 shows such a template. It doesn't HAVE to be greyscale, the program will convert any colour on a template to greyscale but obviously it is more controlable if you make it so.

Fig.3 shows an unshaded forest with the deciduous trees excluded from going on the white parts of the template. The coniferous trees are excluded from the black. They mix randomly in the greys. All these levels are adjustable.
Fig 4. shows the same forest shaded.

I've also given the program the ability to save shadow offset positions. These are stored in a text file in the brush directory. Any changes to these files that make them unreadable to the program result in a new file being made at runtime and the offsets will need re-doing. Also, if a new shadow brush is added to the set or one is taken away etc. then they will also need repositioning.

Again, hopefully I can get this uploaded reasonably soon. Just need to find the time to iron out a few annoying problems.

Edit: Oh, forgot to mention that I've also added a "Merge Shadows" option for if you want to get rid of that effect where shadows overlay each other.

----------


## Fluesopp

I got to say Ramah... You really got that programming going.  :Smile: 
More than I could ever have hoped of.

Last map I made with this program: http://fluesoppen.com/images/div/Selton.jpg

Good Job.

----------


## Ramah

Hey Fluesopp, good to know you're still hanging around the forum. Not seen you for some time.  :Smile: 

Yeah, I still keep tinkering away at this when I have the time. As I've said before, it's a bit slow going as I usually have to learn how to program whatever is I want to add but I'm getting there.

By the way, although I started a new thread for this I still credit you in the program under the "About" menu item. There are still a few lines of yours in the program I believe. Hehe.

----------


## Fluesopp

Yeah, I haven't had much time to work on mapping. I have much more important things to attend to, such as school and stuff. Right now I've been hard at work, trying to solve the Traveling Salesman Problem. I might eventually learn some algorithms which will enhance the tree positioning, but at the moment I lean more towards the idea of a complete world generator, Dwarf Fortress style. But only if I have time.

----------


## Canaille

Think I may use this in my map to replace the forests I have now..... if I can find other stuff to match... though I'm sure with the right brushes, it could be used to make mountain and deserts too... right?

----------


## JiveMiguel

I've been using this for my current project and I love it!

The only problem that I've encountered is that every time i launch the program, all the settings for jitter, spacing, etc are reset. The first time I used it, I should have written down my settings. I was able to duplicate it with some trial and error, and keep the forests of my map looking similar to each other. So I had an idea: What if the end user could save his or her settings in a file somehow, and load them up? Multiple settings could be saved and recalled for various projects. Other than that, I think this is an excellent little app. 

Thank you and have some rep!

----------


## Ramah

Thank, JiveMiguel.

Yeah, saving settings like that is definitely on my todo list. It was always one of the things I would have to look into to learn how to do but since I figured out how to save the offsets for shadows then the knowledge is there it's just finding the time to actually implement it.
I'll try to get it implemented in the next update.

----------


## JiveMiguel

I'm trying to make some brushes for this program. They are saved with correct names and as transparent PNGs, but nothing is showing up when I select them in TreeThing. I'm pulling my hair out here! Is there a certain setting I should be using when saving the PNGs? I've attached the brush files here. Please take a look if you have a moment. Thank you!

----------


## Immolate

Ramah I've been using this on this month's challenge and I have to say it's working very well. Repped and rated!

----------


## ravells

A big thank you from me too, Ramah! I've just used it in Serif Drawplus and it works like a dream. I've got to make my own trees now. If you could have a save settings option that would be fabulous.

No chance of doing a tree thing using vector objects??? Please, please please!!!

My initial efforts below

----------


## ravells

I've made a tree pattern of mixed conifers and deciduous. Zip attached.

----------


## ravells

Jive Miguel, I had a look at your palm trees. You have not filled the mask with white (it's transparent). I'd also suggest feathering the mask a little so the black outline of the Tree shows more.

----------


## Djekspek

wow, how could i have missed this one. thanks, this is very cool Ramah! cheers

----------


## Ramah

Right,

Added a new version of the program. Find it in the original post of the thread.

New to this version is the ability to save settings between sessions. This can happen automatically whenever you close the program and the program will then automatically reload these settings upon next start up. Also you can save and load settings through the File menu. So you can have numerous settings saved for different type of forests. These variables are saved in txt files in the settings folder. The system is not particularly robust and needs some failsafes adding. If the files somehow become corrupt through a bug (or through curious meddling) then deleting the files should sort any problems out.
Also added is a feature that lets you tie in brush placement to the greyscale values of a template. This can then be used for things such as a mixed forest where you want mainly evergreen trees around the base of mountains and then deciduous trees in the lowlands and a mix of the two in between. Access this feature through the "Brush Weight" menu (when a template is loaded). It's a little confusing how it works and a simplification is on my to-do list for future updates. But for now it works. (I explained a little more of how the greyscale templates work in a post on page 4 of this thread)

Umm... not sure if there are any other big features added - it's been so long since I updated this. There are various other little additions and fixes made to it but nothing really worth mentioning.

I've also added a line to the original post asking that if anyone uses this app in their mapping then to please credit me and depending on where the map is displayed etc. then to provide a link back to this thread. Most people already do this anyway but I've seen maps posted in various places that have clearly used this program but with no mention of that fact. I'll continue to develop this program whatever (and its sister program HillThing) but I don't have to upload them for everyone.  :Smile: 

Edit: Oh, forgot to mention. There are a couple of new brushsets included in the zip. One for swamp and one for jungle. And I think the mixed forest is new too, although I'm not certain. The jungle and swamp sets aren't too great but with some playing around half-decent results can be achieved. The jungle in particular made a really nice effect on a map a while back that I was unfortunately unable to post due to client's wishes.  :Frown:

----------


## ravells

Oh Ramah! Thanks!!!!!

You are wonderful to us!

----------


## Ramah

Cheers Ravs.

Oh, and I always forgot to reply to your question about making it utilise vector graphics... wish I knew how.  :Smile: 
I've never done anything with vectors. The one time I tried Inkscape I closed it after a few minutes, totally bewildered by all the options. They are saved as .SVG files? Somehow I doubt it would be as simple as loading up an .svg file instead of a .png.

When I get time I'll look into it but my gut says it will be awkward for a novice like me. I'll get back to you on it.... some day. Hehe.

----------


## ravells

lol! If you can code the tree thing and call yourself a novice, I don't know what that makes me!!

----------


## StillCypher

> Or perhaps the Honourable Contributor badge - they certainly qualify for something!



TreeThing is awesome and totally deserving of a badge!  :Very Happy:  I've rated the thread, but apparently I need to spread more rep around... I have a new map waiting to be tackled, and I'm looking forward to using TreeThing on it. Good work, and thank you so much for sharing!

----------


## jfrazierjr

One thing I suggest is a view port zoom.  Currently,, when you scale up/down, it seems to come from the upper left corner.  It would be nice to have the zoom stay focused on the currently visible area in the screen centerpoint as much as possible.

----------


## Redrobes

Nice one Ramah.

On the SVG thing, its just text. If you get someone like Ravs to knock up some SVG trees then you can look at the code lines. For example take this one:
http://www.openclipart.org/people/rg...imple_tree.svg
If you do a view source in the browser you can see that someone did this one in inkscape. So just suck up all the lines in that and splat them down. I am sure there must be an even easier way to do this with some kind of Java functions that load and save SVG files.

----------


## jfrazierjr

> Nice one Ramah.
> 
> On the SVG thing, its just text. If you get someone like Ravs to knock up some SVG trees then you can look at the code lines. For example take this one:
> http://www.openclipart.org/people/rg...imple_tree.svg
> If you do a view source in the browser you can see that someone did this one in inkscape. So just suck up all the lines in that and splat them down. I am sure there must be an even easier way to do this with some kind of Java functions that load and save SVG files.


I am sure there must be others, but Batik is a java lib for SVG parsing...

----------


## Hai-Etlik

I've done some work tearing apart and manipulating SVG and it's really quite easy given a decent XML library.  All TreeThing would need to do is store the symbols in the defs section, then position a bunch of use elements using translate and scale.

In fact, this is pretty much all my own tree randomizer script does except that it uses a pre-existing set of 'use' elements and just randomizes the symbols.

----------


## ravells

> TreeThing is awesome and totally deserving of a badge!


The Community Leaders agree! Congratulations on your new award, Ramah and thanks for making this wonderful application available to the community!

----------


## Tigon

Ah Ramah your timing is impeccable. This is a cracking tool and swamps/marshland are something I was just looking about for. Top banana! (sorry, closet cityzen)

----------


## Ramah

Thanks guys. The badge is a nice bonus but really seeing people getting some use out of this is its own reward.  :Smile: 

Jfrazierjr, thanks for the suggestion. I've often zoomed out or in and then lost my forest, and grumbled under my breath about it but it never registered enough for me to do something about it. Rest assured it will be addressed in the next update.

And thanks everyone for the info on vectors. It will still be a case of, "when I get time" but I guess it will give me a head start in my studying the possibilities.

----------


## tilt

congrats on the badge Ramah, well deserved  :Smile:

----------


## Gidde

Congrats, Ramah!!

----------


## Coyotemax



----------


## Sifaus

I have an error while starting this. I tried to open with Platform SE Library, console just closed instantly. Then, i tried to open with Web Start Launcher. It gives following error:


MissingFieldException[ The following required field is missing from the launch file: <jnlp>]
	at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
	at com.sun.javaws.jnl.LaunchDescFactory.buildDescript  or(Unknown Source)
	at com.sun.javaws.jnl.LaunchDescFactory.buildDescript  or(Unknown Source)
	at com.sun.javaws.jnl.LaunchDescFactory.buildDescript  or(Unknown Source)
	at com.sun.javaws.Main.launchApp(Unknown Source)
	at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
	at com.sun.javaws.Main$1.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

----------


## jfrazierjr

> I have an error while starting this. I tried to open with Platform SE Library, console just closed instantly. Then, i tried to open with Web Start Launcher. It gives following error:
> 
> 
> MissingFieldException[ The following required field is missing from the launch file: <jnlp>]
> 	at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
> 	at com.sun.javaws.jnl.LaunchDescFactory.buildDescript  or(Unknown Source)
> 	at com.sun.javaws.jnl.LaunchDescFactory.buildDescript  or(Unknown Source)
> 	at com.sun.javaws.jnl.LaunchDescFactory.buildDescript  or(Unknown Source)
> 	at com.sun.javaws.Main.launchApp(Unknown Source)
> ...


Your on windows? and your java is hosed.  uninstall.  REBOOT!!!!!!!! go to java.com, download and install.

----------


## Sifaus

I did all of them. I download 'jre-6u24-windows-i586-s.exe' but no, that didn't help me. :/

----------


## jfrazierjr

So, after the uninstall, you DID REBOOT?   

Well.. bottom line, Java install does not properly configure the "path".  this is an environment variable which tells Windows where to find executable files.  Basically, java is not in any of the locations your of your computer's path.   If you open a command prompt by: Start->Run, type cmd and hit enter.     You then type "java -version"( NOT INCLUDING THE QUOTES),  it SHOULD respond with(something similar, may not be exactly the same):




> java version "1.6.0_23"
> Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
> Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing)


likely, it will say something like: 




> 'java' is not recognized as an internal or external command,
> operable program or batch file.


 instead.   

This tells you that the install did not do ALL of the things it was supposed to do.   You CAN complete this extra setup manually, so let us know if that is the problem and I or others can tell you how once you confirm this is the issue.

----------


## Sifaus

I created a .bat file like:



```
@ECHO OFF
IF /I "%PROCESSOR_ARCHITECTURE:~-2%"=="64" "%ProgramFiles(x86)%\Java\jre6\bin\java.exe" -Xincgc -Xmn512M -Xms1024M -Xmx2G -jar "%~dp0TreeThing.jar"
IF /I "%PROCESSOR_ARCHITECTURE:~-2%"=="86"  java -Xincgc -Xms1024M -Xmx1024M -jar "%~dp0TreeThing.jar"

PAUSE
```

It worked! (:

----------


## jfrazierjr

good... I knew your install was hosed.   Did you write the above or copy from some googled code?   If the latter, I would suggest correcting your path would be a much better option or you will keep having issues with java applications...  Of course, if you know what the above does, then you probably know how to set your path manually and likely have a reason for doing the above way instead.

----------


## Sifaus

I was working on a Minecraft server. I know what that codes does (with details), but i haven't got any bat knowledge.  :Smile:  I used same code there, i just changed jar name. I didn't write specific directories, becouse i want anyone use that code easily if they have that problem too.

----------


## Ramah

Thanks for helping Jfrazierjr, I'd have been like.... ... ...... .... :S
Glad you have it working now Sifaus. Let us know how you get on with it.

----------


## voidgere

I cannot get this program to work and I am not sure what I am doing wrong.  I create the brush layer, save it as a .png, but when I try to load the template the program doesn't do anything.  I've downloaded the tut for it and I followed it to the letter.  Just not sure why its not working.  Any suggestions?

----------


## ravells

Why don't you post your brush .pngs and we can take a look.

----------


## voidgere

Here it is.  I tried to upload the .png file but it wouldn't let me so here is a jpg version.

----------


## Ramah

So when you say, "brush layer" you are meaning the template itself?

Hmm, not sure what your problem could be. And with that file being posted as a jpg I cannot see whether it is an alpha channel. In the .png file is the area surrounding your forest transparent?

----------


## Slylok

> I cannot get this program to work and I am not sure what I am doing wrong.  I create the brush layer, save it as a .png, but when I try to load the template the program doesn't do anything.  I've downloaded the tut for it and I followed it to the letter.  Just not sure why its not working.  Any suggestions?


I have the same problem sometimes. It will be working fine one minute then the next it wont load brushes or templates and none of the buttons will do anything. To fix this, I simply uninstall and re install it. by uninstall i mean i delete the treething folder and then unzip the one i downloaded from here.   I have no clue what could be causing the issue, but unzipping a fresh copy does the trick for me.

BTW Thank you ramah for this fantastic program  :Smile:

----------


## voidgere

> So when you say, "brush layer" you are meaning the template itself?
> 
> Hmm, not sure what your problem could be. And with that file being posted as a jpg I cannot see whether it is an alpha channel. In the .png file is the area surrounding your forest transparent?


*Sorry for the delayed response.  Life teamed up with drama and they ambushed me on multiple Mondays.*

I created a layer to hold the brush strokes.  That was saved and then imported into the treethingy.  But the treethingy never changes.  Its just a bunch of trees in a square formation.  Yes, the layer is completely transparent except for the brush.  The brush strokes themselves are a bit translucent as I staggered the opacity as you suggested.  Of course, I also tried a single opacity file and got no results.  I tried making a circular object, filled with black, and no dice.  I've uninstalled and reinstalled.  I'm using PS CS4 but my software shouldn't be an issue right?  I mean a .png is a .png.

*EDIT*
OK, I had to "trim" the layer to get it to upload but here is my .png file.

----------


## ravells

Hmm I tried your template and it works fine for me. It sounds like the issue must be how tree thing works on your computer.

----------


## Ramah

> I have the same problem sometimes. It will be working fine one minute then the next it wont load brushes or templates and none of the buttons will do anything. To fix this, I simply uninstall and re install it. by uninstall i mean i delete the treething folder and then unzip the one i downloaded from here.   I have no clue what could be causing the issue, but unzipping a fresh copy does the trick for me.
> 
> BTW Thank you ramah for this fantastic program


When you posted this I had no idea why this would be happening to you. But for some reason as I lay awake thinking last night it popped in to my head that I had included the ability to save settings in the last release. I think the problem is probably something to do with that. My advice to you would therefore be that if it happens again, rather than deleting the whole thing and reinstalling, try going into the directories and deleting the default settings text file. If it works then when you start it up it should just return to default settings. Hopefully.

Unfortunately this is not something I can just rush out a quick fix for as when I last touched the program I was deep in a complete overhaul of the code to allow for forests with perspective and it wasn't stable. Hopefully I'll get back to it soon.

----------


## voidgere

Well, I checked the settings and the folder was empty.  However, on a lark, I tried to load the trimmed png and it worked.  Is there a canvas size or file size limitation?  The only thing I could think of.

----------


## Ramah

That settings comment was really an answer to a different problem further up.

Umm, well there is an upper limit to how big a forest it can create but it is far bigger than your png file is. I had one 5000 x 5000 pixels working. Originally anything much bigger than 1k x 1k would cause errors and I had to go in to the java environment and alter the amount of memory it allocated to a compiled program. Now I would assume that this information would be carried across in a compiled program but being a pure amateur at this thing I could be wrong I guess. Would be a bit daft if it didn't.

The only problem I was aware of with a png file not being read correctly is that it needed to be surrounded by transparent pixels. If your image went right up to the edge then it would throw up an error. I'm guessing as you cropped it and it is surrounded by transparency that this wasn't the case.

Hmm, I'm a bit stumped to be honest. Do you still have the original unedited png file that wouldn't load that you can somehow post?

----------


## Thac0

This is awesome and has compensated for my lack of artistic skill.  

Any chance Mountainthing is in the works ???

----------


## Ramah

Yes it is, although it is in its most very basic form right now. I don't get much time to code and when I do TreeThing always seems to be more important. Hopefully I'll get some time to work on it some day. It's actually supposed to be hill/mountainThing, with the program using the greyscale of the template to decide if a mountain goes there or a hill.

----------


## Thac0

that would be awesome.  Looking forward to this.

----------


## voidgere

Its to big for the site to accept.  Let me upload it my server and send you a link.

----------


## voidgere

Had to upload it to my mediafire account.  my server wouldn't serve the file.

http://www.mediafire.com/i/?qexp8sz6han9498

----------


## Fluesopp

This thing is still in development? Quite.
I like what you have done  :Smile:

----------


## Ramah

Hey Fluesopp. Yeah it's still in development when I have the time. Last time I worked on it I was overhauling it completely, changing the way it held the forest patterns but I had to stop for a while so it's stayed in a bugged state with me now unable to recall exactly where I was with it. Hehe.

So it may be some time before I get enough time to unravel where I was before being able to make some actual progress. Ah well, one day.

Didn;t you say you were working on some kind of world generator now or something? Any progress with that?

----------


## Ramah

Zzzzz @ trying to pick up where you left off after 6+ months break and not knowing WHY you broke a core part of the program when it was obviously intentional that you did so. :S

Anyhoos, update to this coming soon although it will mainly be UI-centric. And bug fixes.  :Smile: 



EDIT: Added a screenie of where I am right now. UI is hopefully a little easier now with most of the common functions being readily available. It might be a little more overwhelming when coming to it for the first time but dunno... is it hard to use? It's hard for me to be objective. Seems easy enough to me.

Image shows the faux perspective view that I probably won't enable for the next release as it is still very much a WIP.

----------


## Djekspek

man this is getting better and better... love the perspective effect ... now just add some mountains, rivers and a landmass fractal generator, and we'd need nothing else for our maps  :Smile:  ... cheers, DJ

----------


## tilt

looks really great - just make sure you have "tool tips" for the buttons so people know what they do  :Smile:

----------


## Ramah

> looks really great - just make sure you have "tool tips" for the buttons so people know what they do


Hehe. Already sorted that bit so no worries there.  :Smile:

----------


## tilt

maybe I should try using it for my Cartographia map... can I use my own images?

----------


## Ramah

If you mean can you use your own images to make your tree brushes then yes you can. It's not the simplest thing in the world to wrap your head around how to make the brushes I guess but if you can make maps digitally then you can make a few trees, masks, shades etc. and name them correctly.  :Smile: 

The version I am working on now is stable and mostly debugged. With just a few more fixes and the perspective code, such as it is, disabled then it will be up to update standards. If you are serious about trying it then I'd recommend you hang on for the updated version first.

----------


## Slylok

Cant wait!  :Smile:

----------


## Ramah

Ok, so just updated the original post in the thread with a new version of the program. I'll just copy and paste here what I wrote in the new features thingy...

Latest version - 0.9

1) UI update. Tried to make it a little more user-friendly by making most of the common functions more apparent. Most of the important features should be tooltipped - detailed tooltips are on by default but once you know the functions you can turn them to basic tooltips or off altogether in the options menu.
2) Added an option to randomly add some light shades of grey to the mask layer. This can be useful in post imaging by using the masks as a multiply layer to add variation. On by default.
3) Added a Link Brushes option in the options menu (or CTRL+L) to hold the current ratio between Brush 1 and Brush 2. Can save valuable seconds when resizing.
4) Added a Viewport Padding variable in the bottom menu (in Advanced) to adjust the free space surrounding a forest. This has no effect when a template is loaded.
5) Added the option to view your loaded template. Located in the View menu.
6) Various bug fixes and improvements.


A few extra things I'll add here...

The default item in the bottom menu is View Angle now. This actualy does very little at the moment - it appears to change the Y density of the forest from spaced out nicely at 90 to a single line of forest at zero, with everything in between. It is hard-coded to lower the amount of rows it draw at lower values to prevent massive overdraw so that may appear odd. Basically, it is there for a future version when I change the way all the trees are placed. It can be ignored unless you want a really tightly placed forest.

Likewise, feel free to ignore the maxBrush parameters in the advanced menu. 

I forgot to remove the View Control Panel option in the View menu. The plan was to have all the new controls removable but as Java seems to suck at resizing frames via code I've decided to drop this idea. You can remove the right Jitter panel with it if you like but it has little use other than that.

There are a few other commands I have disabled such as the Faux Perspective and the allignment option as they are still in development or broken in some way.

Umm, think that's about it for now.

If you have any feedback about the program then let me know here.

Cheers.

----------


## Sapiento

Hi Ramah. I tried to test the new version, but it doesn't work for some reason. It opens, but if I click a command in the menu, nothing happens. It seems to freeze, because I also cannot close it regularly.

----------


## Ramah

Hmm, ok, thanks for letting me know, Sap. I wonder if the other people who downloaded it also had the same problem? I'll try looking into it today.

----------


## ravells

Wow, I hadn't realised that there had been an update. I will get on and play with it forthwith and report my findings! I remember that from the last version of tree thing I couldn't get the density mask to work...but it's been awhile and I'll have another play with the new version!

Thanks a million for offering this to the community Ramah. You should really put a 'donate' button somewhere so I can make a contribution!

----------


## Ramah

Sapiento: I just took a quick look and I cannot find any problem with it. Using the downloaded version works fine for me. :S  The only thing I can think of off the top of my head is that maybe you installed it in the same directory as your previous version? If so you may have a curent settings files left over from the previous version that the program may be stumbling over trying to read. If that is the case then delete it or rename it and try again.
If not... not sure right now. Is it just a menu command that freezes it? Can you add jitters with the buttons? Does it appear to have loaded correctly looks wise?


Ravs: Cheers.

I doubt that the mask opacity density will work this time if it was broken last time. I've totally neglected that to get other things working and as I was moving more towards greyscale templates anyway I was going to phase out anything that used template opacity as they don't really go well together - low opacity white becomes grey for instance and then it screws up the ability to decide where trees will go...

Is there a way to extrapolate what colour something would be if it's alpha was ramped up to 100%?

Anyway... if you do use that command then I'll be sure to take a look at it and see what's occurring with it.

By the way - please let me know if it works for you.

----------


## ravells

I've just downloaded it and tried it. It works a treat but the 'faux perspective view' seems disabled.

Te template utilities work after a fashion now, yay! I have a sneaky suspicion that it didn't work the last time because I was using a black to white rather than a black to alpha gradient fill.

 I'm not sure what the 'approximate elevation relative to opacity' option does - for me it seems to shift the trees a little bit. 

The main use I'd have for the template opacity option would be to weight the brushes so I could determine where to put coniferous trees and deciduous trees. I'm sure that in the last version there was a way to do this (which I couldn't get to work) but I can't find it now!

Best

Ravs

::edit:: ah! I've found the viewing angle setting which gives me the faux perspective!

----------


## Ramah

Ravs, I disabled the faux perspective for this release as it isn't yet complete enough to be worthwhile.

Yes, most of the template utilities use the alpha channel on a template to work. Just go round your template with a low opacity, soft eraser and you should be able to get some effect. But as this goes against the way I've been heading with templates I doubt I will develop these further.
The approximate elevation uses the greyscale of a template and not opacity. Where a template is lighter it will shift the trees up a variable amount. So if you had a very basic greyscale heightmap for a template you should notice some attempt to show this in tree placement. Lowering the view angle should make it more apparent if memory serves. By the way, this was very much a WIP option that I haven't touched for a long time so I'm not sure if it would produce any usable results.

To decide where to put coniferous trees then use a greyscale template. The program automatically changes a template to greyscale but if it has areas of low opacity then this will produce false results. I still haven't come up with a better system but if you go into the Brush Weight menu at the bottom, when a template is loaded it should open up a couple of sliders at the side of the viewport - these can be used to tell the program what colour of template the trees are allowed to be placed on - 255 being white and 0 being black. So for all coniferous trees raise the MIN slider to 100 or so and for deciduous tree lower the max slider to 150 or so. It's best to make sure there is some overlap on those values or you may get some trees placed where you don't want, also the overlap allows mingling so adjust these to suit. This way, coniferous trees will be placed on white template and down into grey, deciduous trees will be placed on black template and up into grey and always the twain shall meet.

Viewing angle, although different in how it is used, is basically another form of YDensity right now. This should have more utility once faux perspective is working better.

----------


## Sapiento

> Sapiento: I just took a quick look and I cannot find any problem with it. Using the downloaded version works fine for me. :S  *The only thing I can think of off the top of my head is that maybe you installed it in the same directory as your previous version?* If so you may have a curent settings files left over from the previous version that the program may be stumbling over trying to read. If that is the case then delete it or rename it and try again.
> If not... not sure right now. Is it just a menu command that freezes it? Can you add jitters with the buttons? Does it appear to have loaded correctly looks wise?


Thank you, Ramah, this was the reason. Now it seems to work properly.

----------


## Ramah

> Thank you, Ramah, this was the reason. Now it seems to work properly.


Ok, great.  :Smile: 

I'll have to make sure that in the next release I include a current_settings file in the zip so that it overwrites any previous one and avoids this problem. Thanks for letting me know, Sap and sorry about the problem.

----------


## ravells

Brilliant! Thanks for the explanation on the coniferous forests, I tried it and it works a treat! 

Cheers Ramah!

----------


## paulbhartzog

Really gracious of you, Ramah, to share so many of your tools and techniques.
I can only save the resulting forest as a single flat .png and not "all layers" like the pdf manual says.  Ideas?
I'm on a Mac.

----------


## Ramah

Hmm, off the top of my head I cannot think of a reason why it shouldn't be working for you. I'm on a PC but as far as I am aware the JVM should translate it faithfully. I might be wrong but I thought that as long as I stay away from referencing specific windows commands or keys then it should be ok cross-platform. Can anyone else verify this?

Unfortunately I don't tend to get a lot of feedback here. It's been downloaded 22 times so far and only a few people have commented so I am never sure what problems, if any, people are having. I'll take a look into it and see if I can find a problem with the saving, although why it would save the image and not the layers I don't know. :S

Anyone else had this problem? If so are you on a mac?

Just out of interest though, on the mac does the program appear graphically similar to how it was in the last screenshot that I posted? I have often wondered if the LookAndFeel would translate correctly across platforms.

----------


## ravells

Oh, I always thought the 'all layers' save was meant to be a flat .png in the sense that you only have one image saved....or have I misunderstood?

----------


## Ramah

Hmm... well that doesn't sound good if you don't know that eaither, Ravs.

The "Save Image" command just saves out exactly what it sees in the viewport, minus the green background. So if shades, shadows etc. are all turned on then it spits it out as one image. Limited use really.
The "Save All Layers" command spits out up to four images, one each for: _brushes.png, _shades.png, _shadows.png and _masks.png. This way they are kept separate and can be manipulated individually in PS or whatever. Are you not getting them either, Ravs?

----------


## ravells

lol, I just tried it and it worked! I never appreciated that TT could do this! Fantastic! It makes editing in Drawplus even easier!

You are just a genius, Ramah!

----------


## paulbhartzog

> Hmm... well that doesn't sound good if you don't know that eaither, Ravs.
> 
> The "Save Image" command just saves out exactly what it sees in the viewport, minus the green background. So if shades, shadows etc. are all turned on then it spits it out as one image. Limited use really.
> The "Save All Layers" command spits out up to four images, one each for: _brushes.png, _shades.png, _shadows.png and _masks.png. This way they are kept separate and can be manipulated individually in PS or whatever. Are you not getting them either, Ravs?


Ah thanks for telling what we should expect.
It doesn't do that.
It pulls up a Save dialog asking for a filename,
and then spits out this Java error:



```
Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.String.substring(String.java:1768)
	at mapmaking.Main.saveAll(Main.java:5173)
	at mapmaking.Main.saveAll(Main.java:5165)
	at mapmaking.Main$11.actionPerformed(Main.java:1433)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1882)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2202)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
	at javax.swing.AbstractButton.doClick(AbstractButton.java:334)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1050)
	at apple.laf.CUIAquaMenuItem.doClick(CUIAquaMenuItem.java:119)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1091)
	at java.awt.Component.processMouseEvent(Component.java:5617)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3129)
	at java.awt.Component.processEvent(Component.java:5382)
	at java.awt.Container.processEvent(Container.java:2010)
	at java.awt.Component.dispatchEventImpl(Component.java:4083)
	at java.awt.Container.dispatchEventImpl(Container.java:2068)
	at java.awt.Component.dispatchEvent(Component.java:3918)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3936)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866)
	at java.awt.Container.dispatchEventImpl(Container.java:2054)
	at java.awt.Window.dispatchEventImpl(Window.java:1801)
	at java.awt.Component.dispatchEvent(Component.java:3918)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:501)
	at java.awt.EventQueue.access$000(EventQueue.java:80)
	at java.awt.EventQueue$1.run(EventQueue.java:462)
	at java.awt.EventQueue$1.run(EventQueue.java:461)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:84)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:95)
	at java.awt.EventQueue$2.run(EventQueue.java:476)
	at java.awt.EventQueue$2.run(EventQueue.java:475)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:84)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:473)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
```

----------


## Ramah

Thanks for that Paul, that was very helpful to me. I did some digging and found that the Mac version of Java is bugged in certain ways, one of which is the way it responds to ShowSaveDialog, returning an incorrect path which in turn is giving me the substring error. I'll have a play around and try and get a fixed version up soon. It may be that the program will lose the ability to create a new folder for saved files as this is the easiest fix.

Ravs: Heh. The ability to separate the layers was the reason why I took up the programming of this in the first place and has been there since the very first version that I implemented. I'm impressed that you got such good results in your last map with just the single layer and also realise now that you probably had no idea what I was talking about when I said you should have used the mask layer to underpaint your trees to stop coasts and rivers showing through.  :Smile:

----------


## paulbhartzog

Awesome. Glad to help.
Perhaps the user could select the destination folder for the layer images?  This would mean the user would have to make the folder first (which is fine) and then that takes it out of the the program's "hands" entirely.

There's always: JFileChooser (Swing)

Thanks for continuing to work on the program.

----------


## Ramah

> Awesome. Glad to help.
> Perhaps the user could select the destination folder for the layer images?  This would mean the user would have to make the folder first (which is fine) and then that takes it out of the the program's "hands" entirely.
> 
> There's always: JFileChooser (Swing)


The user can already select the destination folder and can also create a new folder for said images if they want.
It also already uses a JFileChooser and it is the dialog box for this that apparently casuses the problem on mac OS.

Anyway, I've changed the program to what I hope will now work correctly on a mac. Having no way to test this myself all I can rely on is troubleshooting forums on the web for answers so if you could let me know if it works now Paul then that would be cool.

I'll upload this new version here and if it works then I'll update the original post.

This is version 0.96.

I've disabled most of my WIP elements on it. I've enabled the faux perspective option this time although it still isn't integrated properly and is of limited use right now.

I guess the only main additions to this version are:

1) the ability to load a background jpg image (depending on size this may take a short while to load and it can also have a negative effect on how large a forest can be created) 

2) the ability to remove trees from a generated forest. This is still in its early stages and I plan to do a lot more with this but for now you can press Alt to bring up the tree origins and then click on an origin to toggle it. Then once you have selected all that you want to press Refresh at the top and it should remove/replace all toggled trees.

EDIT: Removed bugged version. Fixed version a few posts below.

----------


## paulbhartzog

Tested using:
File > Save Layers

1) The "Save" Dialog that pops up does not have a way to create a new folder (as you mentioned it should.  SCREENSHOT BELOW)
2) The "Save" Dialog that pops up does not let you select a folder (the "Save" button stays greyed out and does not activate)
3) The "Save" Dialog that pops up only continues if you select a file (the "Save" button activates), but the save fails with the same error as before.

I'm a Java programmer too, and I LOVE this program, so feel free to talk to me independently, or we can keep going in here and share the news with everyone as we go.

----------


## jfrazierjr

Ramah, if you want to share that section of the java code, I could eyeball it to see if I see any obvious issues...here or offline, either way is fine if your up for it.

----------


## Ramah

Thanks guys. 




```
	public void saveAll() {
            
                jfc.setDialogTitle("Save Layers");
                jfc.setApproveButtonText("Save");
            //    jfc.setApproveButtonMnemonic(KeyEvent.VK_S); //Doesn't seem to work
                jfc.setSelectedFile(new File(""));
                jfc.setApproveButtonToolTipText("Save Files");

		int returnVal = jfc.showOpenDialog(frame);
		if (returnVal == JFileChooser.APPROVE_OPTION) {
			File f = jfc.getSelectedFile();
			if (f.exists()) {
				int ans = JOptionPane.showConfirmDialog(frame, "File " + f.getName() + " exists already. Overwrite?", "Save", JOptionPane.YES_NO_OPTION);
				if (ans == JOptionPane.OK_OPTION) {
					saveAll(f);
				}
			}
                        else saveAll(f);
		}
	}

        
	public void saveAll(File f) {

                String where = f.getPath().substring(0, f.getPath().lastIndexOf("\\"))+ "\\";
                String what;
                File f2;
                int x = 0;
                int y = 0;
                boolean saveImg = true;

                if (templateLoaded) {
                    x = 25;
                    y = 25;
                }
                int w = width - (x * 2);
                int h = height - (y * 2);

                    if (f.getName().toLowerCase().endsWith(".png"))
                            what = f.getName().substring(0, f.getName().lastIndexOf("."));
                    else what = f.getName();

                String fileName = where + what;

                for (int i = 1; i <= 4; i++) {

                    saveImg = true;
                        
                        if (i == 1) layerShow = "Trees";
                        if (i == 2)
                            if (maskButton.isEnabled()) layerShow = "Masks";
                            else saveImg = false;
                        if (i == 3)
                            if (shadeButton.isEnabled()) layerShow = "Shades";
                            else saveImg = false;
                        if (i == 4)
                            if (shadowButton.isEnabled())layerShow = "Shadows";
                            else saveImg = false;

                        populateLayers();

                        if (saveImg) {
                            f2 = new File (fileName + "_" + layerShow + ".png");

                            try { ImageIO.write(workImg.getSubimage(x, y, w, h), "PNG", f2); }
                            catch (IOException ex) {
                                    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                            }
                        }
            }
                    
                    if (textCheck.isEnabled()) {
                        f2 = new File (fileName + "_Labels.png");
                        try { ImageIO.write(textImg.getSubimage(x, y, w, h), "PNG", f2); }
                        catch (IOException ex) {
                                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                        }
                    }

            layerShow = "All";
            populateLayers();
        }
```

Here is the relevant piece of code. If you two know what you are doing then the above code probably doesn't look too pretty.  :Smile: 

On a forum I read it said that the mac had a problem with showDialog and showSaveDialog, giving the wrong path as a result. Apparently it can be deduped to get the correct path but without seeing the resultant path I cannot really do that. I've edited a showOpenDialog to work as a save dialog and according to the forum this was supposed to work.

So take a look at that and see if you can see a problem there, although out of context like that it may be a little awkward.

Odd that you cannot change directories or anything Paul. On mine, I have no problem changing directories but for some reason (it might be to do with changing it to an openDialog) I cannot create a new directory until I've changed direcory at least once. The option is greyed out. After changing to Desktop or whatever it works fine.

I've found one annoying bug though whilst checking this out that slipped through today due to messing with the saving code. I've noticed that if you don't have the layers switched on when you save the layers the files it spits out for those layers are blank. I cannot see from your screenshot paul what layers you have active (do the jToggleButtons work correctly on the mac?). I can see from your forest that you only have the brush layer active but the brush button at the top doesn't appear selected. Have you tried saving the layers after making sure that all four layers are active?

----------


## Ramah

Here is a replacement for the last version I posted with the "blank images when layers turned off" fix.

I also added some code to change the cursor when it is performing long operations so any comments on whether that is working ok would be cool.

Edit: File removed.

----------


## jfrazierjr

You are thinking in windows... don't do that... :Smile: 



```
         String where = f.getPath().substring(0, f.getPath().lastIndexOf("\\"))+ "\\";
```


I assume you are looking for the fully qualified directory name right?  For one, backslash is the folder seperator on windows only.   Also, there is a system property for this you should use instead of hard coding  

```
System.getProperty("path.separator");
```

  OR, just use forward slash (/) as I am 99.999% sure that just works on all machines(I know it works on windows).

However, in this case, you just need to use the correct file method, I THINK getCanonicalPath() is what you want.  From my understanding, this should also properly resolve to symbolic links as *NIX has used and as windows 7+ now uses for it's "libraries" folder structure.  




```
what = f.getName().substring(0, f.getName().lastIndexOf("."));
```

should be just f.getName() to get the "basename" of the file.   One question here, why are you checking to see if the file is a .png or not?  Or are you checking to see if it's a directory?  If the latter, then just use .isFile() or .isDirectory() as needed.



Note: If I am missing something on your logic flow, please let me know and I will try to correct my brain...lol

----------


## jfrazierjr

```
if (i == 1) layerShow = "Trees";
                        if (i == 2)
                            if (maskButton.isEnabled()) layerShow = "Masks";
                            else saveImg = false;
                        if (i == 3)
                            if (shadeButton.isEnabled()) layerShow = "Shades";
                            else saveImg = false;
                        if (i == 4)
                            if (shadowButton.isEnabled())layerShow = "Shadows";
                            else saveImg = false;
```

Also, on another side note, I "personally" would suggest never using the optional braces format for anything.   ie, add braces (and indention) to each "if" statement.   It just really makes it easier to read IMHO and it keeps someone(you) from forgetting to add them when you add additional statements since they are already there....Again, that is a) personal preference and it also conforms to Sun's coding style guidelines(of which I don't agree 100%, but that's neither here nor their!!!)

For that matter, I personally would probably just refactor that bit out into it's own method, passing the "name" as an enum and just remove the whole for statement all together(again, just personal preference).

----------


## Ramah

Cheers, for that man.

I've altered it to use getCanonicalPath. I do use that command elsewhere, to point the filechoosers towards a template or background image that was previously loaded instead of the program root directory but it hadn't occurred to use it there. :S

The f.getName without the substring removal doesn't return the base name... well, it does but if the user enters ".png" on the end then the filename would end up as:  forest_Trees.png.png which is a bit crap. But you are right to question why it does it for .png as someone may be as likely to add .jpg on the end I guess. Changing it to a substring up to firstIndexOf "." would make more sense.

As for curly brackets... tsk! Real men use global variables whenever possible and no curly brackets. \0/

----------


## Ramah

Actually, getCanonicalPath and getPath in this respect work the same for me. The problem was as you say, extracting the path from the filename irrespective of what I used to get it. getParent() works great though for returning the path alone. In conjunction with a "/" when stitching them back together it should now hopefully work ok on a mac.

Edit: Heh. Just went through the rest of the program to adjust all the other file saving and reading that goes on from the Windows standard and it turns out that in all other places I had used "/", hence the program only falling over on the mac in that one place.... So... D'oh! for doing that particular one like that. :s

----------


## Ramah

Ok then, another fixed version. This one should work.  :Smile: 

EDIT: Removed file. Newer version later in thread

----------


## jfrazierjr

> The f.getName without the substring removal doesn't return the base name... well, it does but if the user enters ".png" on the end then the filename would end up as:  forest_Trees.png.png which is a bit crap. But you are right to question why it does it for .png as someone may be as likely to add .jpg on the end I guess. Changing it to a substring up to firstIndexOf "." would make more sense.


Not necessarily.   It is typically common place in *nix for files to have multiple "dot"(.) in the filename, BUT since you already test for endsWith(".png") anyway, you should already be safe.  Sorry..I thought you were trying to do something else AND I was also confusing java with a perl module( that does all of that fiddly breaking down crap for you).


Also, on a side note, you might want to look into using the FileNameFilter so you can have it just show .png files to begin with and let the OS deal with the whole (is it showing file extensions or not).  Typically, even if someone types in "forest_Trees.png" in a file save dialog, IF there is a file filter, you will always get back EXACTLY "forest_Trees.png", at least in my experience.  Now... there is one BIG caveat to this, and that is that if the user actually types in "forest_Trees.png" into the dialog box AND also puts quotes around it, in which case it takes the literal input string and then adds the FileNameFilter to the end.  Of course, if someone REALLY wants to do that, then they should know what they are doing anyway since it's far beyond be realm of what a "normal" person would do.

I hope that makes sense.

----------


## Ramah

It already uses a filefilter to only show png's. This is just the save option where it is attempting to keep the filename entered reasonably clean. Anyway, it seems ok at the moment. Hopefully it works on the mac too.

----------


## paulbhartzog

> Thanks guys. 
> Odd that you cannot change directories or anything Paul. On mine, I have no problem changing directories but for some reason (it might be to do with changing it to an openDialog) I cannot create a new directory until I've changed direcory at least once. The option is greyed out. After changing to Desktop or whatever it works fine.
> 
> I've found one annoying bug though whilst checking this out that slipped through today due to messing with the saving code. I've noticed that if you don't have the layers switched on when you save the layers the files it spits out for those layers are blank. I cannot see from your screenshot paul what layers you have active (do the jToggleButtons work correctly on the mac?). I can see from your forest that you only have the brush layer active but the brush button at the top doesn't appear selected. Have you tried saving the layers after making sure that all four layers are active?


Thanks for the effort.  Good eye!

I have tested the latest version (TreeThing_962).
The screenshot remains the same, but you may have identified the problem.  YES, the JToggle buttons are darkened when all the layers are visible, BUT as soon as the Save dialog pops up, they go light (unselected) again.  Still can't select the destination folder, and the Save button stays greyed out, but this may be due to the fact that the layers are being de-activated by the Save dialog.

Oh, and you say you can create a directory but how? What do you click on?  As you can see in the screenshot there is no interface to create a new directory (which may be a separate issue, or the same one).

Hope that helps. :-)

----------


## paulbhartzog

Separate post for a few other things.

The "thinking" icon is a MAJOR enhancement.  Seriously.
You'll want to know that on a mac the "Auto re-generate" is always active even when it is turned OFF in the menu.  Consequently, anytime you click a button (removal, layers, etc) you get the "thinking" icon.  Before the icon, I wasn't sure what was going wrong, but the icon helped to make it clear.

Also, if you turn on the layers via the Menu and NOT the buttons, then the "thinking" icon does not appear (This is the same behavior as it always was).

----------


## Ramah

I would guess that the Mac isn't unselecting the layer buttons but the effect is just graphical when a dialog is open. Do the buttons resort back to being selected when the dialog closes? There is no code in the save routine to unselect them so it just cannot be happening. So, if it's graphical it's just an annoying mac thing.
As to still having a greyed out save button... :S  Stupid question maybe but you ARE giving them a filename? The save button obviously doesn't work until it has a filename to save the file to.
As for the directory creation... that may be because I am using the modified showOpenDialog instead of the showSaveDialog (to get around the supposed mac Java problem). I'll post up a new version later using a save dialog instead. It works fine on the PC as it is but zzz @ macs.  :Smile: 

Glad the thinking icon is working ok for you. Odd that it doesn't work with the menu though. It's written to automatically change cursor upon UI actions that take longer than 300ms.

It isn't actually auto-regenerating upon layer change (well... not as much as I class as regenerating, it isn't resizing the arrays or reapplying jitters etc.) but it is redrawing the forest image. I tried having each layer on a separate image so that switching layers on and off was just a matter of refreshing the screen but the memory usage when a large forest was generated was becoming a problem. I prefer it this way. It means recreating the forest image upon each layer change (and layer save) but as that shouldn't really happen that often it isn't that big a deal.

----------


## jfrazierjr

Search for Mac new folder dialog missing....   I have found that it is a bug in Java(meaning OSx since they made the user interface API's for java) and there is a system property you can set to get the "create new directory" to show up on the Save Dialog window.    

On that note, Ramah, you might want to look into using SystemLookAndFeel of the UIManager class(I think I got those right) to make it use the OS's native "skin" instead of the standard Java one for the open/save dialogs.   Worst case scenario it just falls back to the Metal LAF anyway if the chosen LAF is not available.

----------


## Ramah

Heh. Ain't no way I'm using system lookandfeel. It took me an annoyingly long time to get Nimbus working and I ain't replacing it with something that looks terrible. I'd sooner have it broken on macs. Lol!

Thanks for the tip on the missing create folder thing. I'll take a look into that.

I was going to upload a new version yesterday which is hopefully fixed for Paul but as I was checking the exe I noticed it was behaving differently to the one in the developing environment. For some reason when I try to load up a large template or background image (4k x 4k ish) it just has the busy cursor for about 3 seconds or so and then just goes back to normal as if I never even sent the request. Although it loads smaller images fine.
It's quite odd. It loads them up fine in NetBeans. :S So... gonna try and see if I can get to the root of that problem before I update.

----------


## Ramah

Ok, so after spending some time on the probelm mentioned above (not the saving on macs problem) I've deduced that the fault seems to lie in the memory allocated to the program. This is annoying as I've altered the VM settings in NetBeans to allow up to 1gb of heap memory in the jar file but this doesn't seem to be the case, only in the IDE (to which I had also edited the startup file to do the same).
So any large template or background image loaded is blowing the allocated heap size and the program continues on its merry way without loading stuff. I have no idea how long it has been like this really. Has anyone who has used this to create forests in the past had a problem with larger templates?

Anyway, I've found a pseudo work around for now. By using a wrapper on the jar file I can create an exe and redefine the memory allocation of the program. The program I have used to wrap it is called Launch4j which is a free app that apparently can also create mac, linux and solaris executables. I'm new to this though and not sure if I can create a mac executable on the PC though just by giving it a different extension or whether it needs to be done on a mac.
So for now I think I'll just get it into a presentable state and then upload the jar file as usual so Paul can test the saving on the mac and if anyone has any comments on this memory problem I'm all ears.

----------


## jfrazierjr

> Heh. Ain't no way I'm using system lookandfeel. It took me an annoyingly long time to get Nimbus working and I ain't replacing it with something that looks terrible. I'd sooner have it broken on macs. Lol!


ummm .... nevermind.. not quite sure where my brain was....for some really odd reason, I thought you were using the "default".... but just for the record.... when I say SystemlookandFeel, I don't mean the really ugly "metal" one, but the "systemlookandfeel" which will check the actual OS in use and pick the correct LAF for that OS meaning that it appears "fairly close" to the actual OS's buttons, dropdowns, etc.    In any event, the Nimbus LAF looks pretty darn good, so... well.. nevermind!!!





> Thanks for the tip on the missing create folder thing. I'll take a look into that.
> 
> I was going to upload a new version yesterday which is hopefully fixed for Paul but as I was checking the exe I noticed it was behaving differently to the one in the developing environment. For some reason when I try to load up a large template or background image (4k x 4k ish) it just has the busy cursor for about 3 seconds or so and then just goes back to normal as if I never even sent the request. Although it loads smaller images fine.
> It's quite odd. It loads them up fine in NetBeans. :S So... gonna try and see if I can get to the root of that problem before I update.

----------


## Ramah

Here's an updated version for test purposes. Mainly to see if the Save Layers option is now working correctly on macs.

As I said in my previous post, this is suffering from a low memory allocation for some reason. I'm not sure what the upper limit is on size right now but if I attempt to load a 4k x 4k template in it refuses to play ball. If you want to get bigger forests the only option right now is to wrap it in an exe maker and allot more memory to the program that way. I'll do this myself in later version if I cannot sort out why the heap is being a git.

On this version I've now put most of the workhorse routines into swingWorkers, which means you need a reasonably up to date version of JVM to run it (version 6 I believe). I would think that most would be ok there though. The swingworkers have allowed me to finally put in a status bar that can relay update messages. I'm still early on in the process though so for now, whenever a process is in operation I've disabled all the controls to stop it being interrupted and throwing up errors. I aim to peel away this disabling in future updates so that button presses will reset the workers or whatever.

So if Paul or anyone with a mac could test this please and let me know if the Save Layers option works now I'd appreciate it. Cheers.

----------


## paulbhartzog

963 won't even run.  Apple's "Software Updatae" control panel provides it's own version of Java, currently at:

java version "1.5.0_30"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_30-b03-389-9M3425)
Java HotSpot(TM) Client VM (build 1.5.0_30-161, mixed mode, sharing)

and won't update beyond that.
:-/

----------


## bradlavario

There is unrest in the forest, there is trouble with the trees...

----------


## Ramah

> 963 won't even run.  Apple's "Software Updatae" control panel provides it's own version of Java, currently at:
> 
> java version "1.5.0_30"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_30-b03-389-9M3425)
> Java HotSpot(TM) Client VM (build 1.5.0_30-161, mixed mode, sharing)
> 
> and won't update beyond that.
> :-/


Hmm... well that's odd. Although I did add a line to the code based on something JoeJr posted about a mac command...

        System.setProperty("apple.awt.fileDialogForDirecto  ries", "true");  //Hopefully solves missing "Create new directory" button on macs.


I can't see why it would cause a problem but meh. I'll remove that line, shore up any massive problems with the current code and post up a new test version. Thanks for trying Paul.

EDIT: Unless of course the reason for the problem is the swingworker code that I mentioned in the previous post. I'm pretty sure I read that it requires version 6 of Java although that has been out for over two years so I wouldn't have though it would be a problem. You said you were a Java programmer? Are you able to work with swingworkers?

EDIT 2: I just did a brief search and I see that some people say that mac Java 1.5 reached the end of its life two years ago (although it still seems to be updated)? So maybe no swingworker support there?
Is 1.6 only for Intel based 64-bit macs? Zzz... so confusing.  :Smile:

----------


## jfrazierjr

> There is unrest in the forest, there is trouble with the trees...



For the maples want more sunlight And the oaks ignore their please.

----------


## jfrazierjr

> EDIT 2: I just did a brief search and I see that some people say that mac Java 1.5 reached the end of its life two years ago (although it still seems to be updated)? So maybe no swingworker support there?
> Is 1.6 only for Intel based 64-bit macs? Zzz... so confusing.


Reasons I won't own a Mac:  if you want to upgrade to the latest version of Java, you have to buy the newest Mac OS X version.

----------


## Ramah

Really? Wow, that sucks a bit. :s

----------


## ravells

Hi Ramah,

Quick question....sometimes the trees are really pixellated and sometimes they look great. I think it has something to do with the size of the .png mask. Is there some sort of optimum size for the png mask to work to?

best

Ravs

----------


## Ramah

> Hi Ramah,
> 
> Quick question....sometimes the trees are really pixellated and sometimes they look great. I think it has something to do with the size of the .png mask. Is there some sort of optimum size for the png mask to work to?
> 
> best
> 
> Ravs


Do you mean on different brush sets? Or the same brush set can sometimes appear pixellated? I would guess you mean different brushsets.

I myself experienced this on one set I made where the brushes were crazily sharp with seemingly no anti-aliasing going on. I remade the set and they came out fine. I never tried to replicate the problem but I always assumed it was something to do with when the program translates the brush pngs into the sizes required by the program. When I first took this project up I arbitrarily decided that the brushes should have widths between 5 and 30 pixels - anything smaller was insane and anything bigger just seemed too much. So the program takes whatever pngs you supply and scales them to suit these dimensions.
Since then I've done very little experimentation as to what makes optimum size brushes - I always seem to have too many other things to fix on it. It may well be that if you can create your brush pngs at 30 pixels across then they will look their best. Maybe if you just shrink your brushes a gnat's gonad in PS first they will come out ok.
Sorry I can't be more specific here. I'll add it to my checklist of things to do.  :Smile:

----------


## ravells

No worries, Ramah!

I'll try and replicate the issue in pictures so it makes more sense (bet it doesn't happen now!)

----------


## Thesslian

This program rules.  I've been playing with it for hours. The best part was when I realized any stencil could be turned into a forest.  I went and grabbed a maze off google and turned it into trees in a few minutes.  Very cool, since I had an idea for a d&d adventure that took place in a forest maze, but god forbid I ever have to map it.  Now I can just convert any basic maze into trees.  So awesome.  I keep thinking of other uses for this.  If you put some building icons where the trees are you might be able to spawn cities by laying down some black.  About the only thing I don't care for are the jungle trees.  Ugly things.  Other than that it is perfect.

----------


## Sapiento

Does anyone know the maximum dimensions in pixels for a template to get loaded?

----------


## Coyotemax

I remember I had mine set to about 2000x2000 max 

capabilities may have been changed since then though.

----------


## Ramah

> Does anyone know the maximum dimensions in pixels for a template to get loaded?


Good question. I cannot remember how much memory I allocated to it in the version I uploaded but in the IDE I was able to do 4k x 4k and a bit larger. I tried to streamline it a little by cutting down the amount of buffered images it uses, for instance it used to have four images for each of the main layers (trees, shades, shadows and masks) and switching them on and off was near instantaneous but buffered images take a massive amount of memory up when they are large so I changed it to use only one image but it needs to rebuild it whenever a layer is switched on or off. Slower but more efficient.

Having said that... I seem to recall that I was having a problem with netbeans actually allocating the memory. I had come the the conclusion that the next time I uploaded a version I would have to wrap it in an exe wrapper in order to get a workaround.

Are you finding that it only works with small templates, Sap?

----------


## Ramah

> This program rules.  I've been playing with it for hours. The best part was when I realized any stencil could be turned into a forest.  I went and grabbed a maze off google and turned it into trees in a few minutes.  Very cool, since I had an idea for a d&d adventure that took place in a forest maze, but god forbid I ever have to map it.  Now I can just convert any basic maze into trees.  So awesome.  I keep thinking of other uses for this.  If you put some building icons where the trees are you might be able to spawn cities by laying down some black.  About the only thing I don't care for are the jungle trees.  Ugly things.  Other than that it is perfect.


Glad you like it, Thesslian. The jungle trees are indeed pretty crappy but a decent looking jungle can still be made from them. If you check out my latest WIP thread (unnamed world) I have posted a snapshot of a map I am working on now with, what I think, is a pretty cool jungle and it was done using those brushes.

If you manage to create some better brushes yourself for it I'd be happy to include them in the next update.  :Smile:

----------


## Sapiento

> Good question. I cannot remember how much memory I allocated to it in the version I uploaded but in the IDE I was able to do 4k x 4k and a bit larger. I tried to streamline it a little by cutting down the amount of buffered images it uses, for instance it used to have four images for each of the main layers (trees, shades, shadows and masks) and switching them on and off was near instantaneous but buffered images take a massive amount of memory up when they are large so I changed it to use only one image but it needs to rebuild it whenever a layer is switched on or off. Slower but more efficient.
> 
> Having said that... I seem to recall that I was having a problem with netbeans actually allocating the memory. I had come the the conclusion that the next time I uploaded a version I would have to wrap it in an exe wrapper in order to get a workaround.
> 
> Are you finding that it only works with small templates, Sap?


In the contrary, Ramah. I used a template of 8000 x 3000 pixels at 72 dpi and it worked well. I was just curious where the limit is.
It is a fantastic tool!

----------


## Ramah

Ah, cool. Glad to hear it's working ok.  :Smile:

----------


## Sapiento

> Ah, cool. Glad to hear it's working ok.


It works very well!
Do you think you will implement the 'Hill Thing' in the foreseeable future?

----------


## Ramah

> It works very well!
> Do you think you will implement the 'Hill Thing' in the foreseeable future?


Yes. I was planning to really start it a while ago (Ive added some basic stuff to the program already in preparation) but I wanted to get TreeThing out of the way first. I keep on thinking of extra things to add to TreeThing but my list is shrinking and right now I'm on internal version 0.98 - I plan to add one more major feature for .99 and then general bug fixing and UI improvements will take me up to version 1.0 and I feel I'll be able to put it to one side then.
After that I'll start on HillThing. It really shouldn't take anywhere near the time spent on TreeThing to develop as 90% of the code is there for me to reuse with some tweaks. The main problem I can forsee is the algorithm for mountain placement and ensuring there is enough graphical variation in mountains. I have some ideas but until I put them into practice I won't know for sure if they'll be good enough.
Anyway, yes, hopefully it will be started soon.

----------


## FoxtrotAnonymous

I'm having a bit of an issue with TreeThing, and it usually occurs only if I use a brush set with more than one tree brush (I'm unsure if this has anything to do with my using of a Mac). Sometimes it will work with the "Mixed Forest", but that seems to only be if it is in a smaller area. What gets me is that you had stated a few posts ago that it will work with your 8000 x 3000 pixel map, and my entire map is only 3000 x 2000 pixels. If I select a brush set with multiple brushes and I load my template, TreeThing will show that it has loaded the template, but the original square-shaped copse of trees remains on the screen. I figured that maybe it just needed a little while to render everything, but everything remained the same. 

When I've been able to get TreeThing to load my templates and render all of the trees, something similar to what I mentioned before occurs at this time as well. Nothing will happen if I change some of the different parameters and hit the "Generate" button. What I have had to do is just hit "Clear Template" and re-load the template back into the program and it will show all of the changes. I've been using some work-arounds, so you really have no need to rush to find me an answer to the question. I just wanted to post this issue to give you some sort of feedback if you wanted to fix some various bugs and whatnot. 

Other than this whole spiel, you have a great program on your hands! +Rep!

----------


## Ramah

Thanks for the info Foxtrot.

I'm not sure if any of this has to do with you being on a Mac or not. To be honest, I'd got to the stage where I was willing to just drop even pretending to get cross-platform compatability sorted. This was due to me making extensive use of SwingWorkers which I believe aren't supported by earlier versions of the Mac JVM. Are you using the last version I posted? I need to check it out and see if I had implemented any workers in that version because if I did, this at least gives me hope that it can still work on newer OS's.

As for the problems... I think I recognise the second one you mention, where generate doesn't seem to refresh it. I vaguely recall having a bug where I had somehow broken generate under certain conditions. If it is that bug, then it should be possible to refresh your parameter changes by either using the "apply" button at the bottom, or by using a command such as "apply spaces" or something and then turning it off again.

I would have put the first problem down as a memory problem if not for the fact that it happens when using a brushset with more than one brush. This shouldn't really have an effect on memory usage. I'm at a bit of a loss really.

I'll have to try and find some time soon to get a new version uploaded. It may be that I've already solved all your personal problems with it as I did spend quite a bit of time on it after that last update. I'll try to tie up some loose ends on it and get a new version posted soon.

----------


## FoxtrotAnonymous

> Are you using the last version I posted?


Yes, I am. I checked the revision numbers, and everything checked out, so that was sort of out of the question.




> I'll have to try and find some time soon to get a new version uploaded. It may be that I've already solved all your personal problems with it as I did spend quite a bit of time on it after that last update. I'll try to tie up some loose ends on it and get a new version posted soon.


No worries! Don't feel the need to rush it at all. Like I said, I've been able to work around it.

----------


## Canaille

If there are brushes for this, I'd love to get them. I sucketh at making my own map elements lol

----------


## Schwarzkreuz

Hi Ramah, how is your progress on the other tools? Anything New to Test,?

----------


## anomiecoalition

I'm really new to mapping and was really struggling to create forests - this program rocks

However - I am using this with CC3 (because I have a very very limited working knowledge of photoshop.)  I can get the forest I want, but it exports it in greyscale.  On your tutorial, you briefly mention a few steps you take to add some color and definition to your forests - I was wondering if it would be possible to add some detail to those steps for those of us that are complete noobs?

----------


## Ramah

Hey there everyone. I just thought I would let anyone who is interested in watching the development of this know that I just updated my blog on here with my recent progress.

http://www.cartographersguild.com/bl...-progress.html

Unfortunately though, for those who are hoping for an update or a HillThing... it ain't that.  :Smile:

----------


## Thordred

Hey Ramah(If you still keep track of this thread).

I was directed here from the General Mapping section since I asked for good ways to achieve forests in my map and your thingy looks great! I only have one small problem. 

I'm not sure that the pdf I have is up to date with the program, is there a recent tutorial on how to use your thingy? My saved .png-images are totally transparent, it doesn't generate etc. I'm sure I'm just doing something wrong, but I can't find any explanation in the pdf I have.

Thank you in advance
David(Thordred)

----------


## Thordred

I am no longer in need of help, so no one have to bother to reply to this. I simply redid everything(I think my png-file went corrupt or something simular).

----------


## Ramah

Ok, good to know you sorted your problem.

The PDF, by the way, is woefully ouy of date for the program. I will have to have a look at updating that when I get the time.

----------


## AEA

Hey guys.

the tree thing is awesome.
Iam a total newbe, but I figured the program out... The only thing I dont get is how to get the trees green after adding them as layer.

can somebody throw me a hint?
Iam using Adobe Photoshop

Anyone?

My eternal awe is his lol.

PS: Ramah, you are awesome... saves so much time and work.

Alex.

----------


## Korash

@ AEA can you show us what you mean?

I believe the easiest way would be to color the brush itself....or using the tree layer as a mask on a green layer under them....if the brushes are transparent...

***EDIT***
or you could look at the bottom post of this page....

----------


## AEA

Hey Korash.

This sounds ridiculously stupid, but you helped me alot! 
LOL

Thank you mate!!!

Alex.

----------


## WillP

I had to search high and low for this thing, but I'm glad I found it.  This makes it so easy A+++++

----------


## vorropohaiah

this is great. i had downloaded a previous version though never got round totrying it out. i'll have a go at this over the next few days and report back. thanks for all the hard-work!

----------


## Ramah

Hope it works out for you.  :Smile: 

I'm toying with the idea of creating a website, mainly so I can add a "Donate" button. I'm thinking donators would get access to the advanced version of the program with more save options, obstruction templates, other features, TextThing integration, BorderControl and also HillThing (when it becomes available).

Would this be of interest to anyone?

----------


## vorropohaiah

I for one would not mind donating for a good piece of software. I would have suggested a kickstarter but its appeal might be a bit too limited and you'd need to waste a lot of time advertising a kickstarter that's probably better spend working on the program!

----------


## ravells

Ramah, I'm happy to give someting to you now for everything you've done with TTT!

Tell me you've got a paypal account and the associated email address and I'll do it right away!


best

Ravs

p.s. I'm sure I'm doing something wrong but I've lost the ability to get shading to work...I'll keep with it and send you an email if I get too stuck!

----------


## Ramah

Bad and limited brushes... no placement options yet other than the default that comes with inherent problems... very first test pass...

----------


## Sapiento

Not bad for a first test.

----------


## ravells

Really glad to see that you're back to TTT!  I'm using it on a map commission I'm working on now and working my dedication of thanks to you as an easter egg in the map.  I'll put it up here when it's done!

The first test is looking pretty good!

----------


## darkenraja

I am having a world of trouble with this program. I simply can't load a template. I create my mask in photoshop and save as a PNG (on it's own layer, with transparency etc). I then load into tree thing and select it as my imported template - but nothing happens. I can see it HAS loaded whatever the file is, but I can't do anything, and all I'm presented with is the default square of trees. I've tried many different variations of the file saving process in Photoshop - but nothing is working. Can someone please help me. I really hope this isn't a bug!

Thanks.

----------


## Ramah

> I am having a world of trouble with this program. I simply can't load a template. I create my mask in photoshop and save as a PNG (on it's own layer, with transparency etc). I then load into tree thing and select it as my imported template - but nothing happens. I can see it HAS loaded whatever the file is, but I can't do anything, and all I'm presented with is the default square of trees. I've tried many different variations of the file saving process in Photoshop - but nothing is working. Can someone please help me. I really hope this isn't a bug!
> 
> Thanks.


What size is the template you are trying to load? It has a problem with templates above a certain size but I'm not sure of the exact size - it may be dependant up on the amount of ram you have in your machine. Also... is this PC or mac? Because I think I destroyed mac compatability several updates ago when I included swingworkers. It may work on the latest OS for mac as I believe that included an up to date java build but I've never been able to verify that.

----------


## Schwarzkreuz

Seems to look fine for me. What would be the maximum Mountainsize? And could you stabilize the program to work with Templates of 10.000 px and highter?

----------


## vorropohaiah

thats pretty good for a first test!

----------


## Ramah

Still quick brushes but a few more now in the mix - 18 in total I think. Other than "brush weighting" the program doesn't yet try to be clever about placements so that (in conjunction with the limited brushes) means there will be lots of places where brushes are repeated or so close to each other that it is obvious.

Some improvement on the general positioning (this is one of three different placement algorithms) but currently only uses the shape of the template and difference in brush size to create randomness in positioning. No jitters or anything yet, and if my logic is correct I won't need jitters like TreeThing, rather it will just use variance in density.

Anyway... here's the image:



Onwards and upwards...

Edit: Gah! I pasted the wrong final image into that larger one. Nevermind, it was made from the same template but had been regenerated into something I found a little less pleasing. That is why the outlines on the previous image do not match the final one. D'oh!

----------


## Ramah

Still using the same limited brushset...

A mountain range with generated shadows yesterday.

----------


## Azélor

Thank for you program Ramah. I used it with custom trees and here's the result so far. 

Attachment 56391

This is only a portion of the trees I have avaible but I still need to improve them a bit in order to have more homogeneity.

Attachment 56392

creating snowy forest 

Pictures removed because I did not own the rights. 

but I might have problems with the last one...

----------


## ravells

Nice trees, Azelor! Is there any chance you could share your brushes with us?

----------


## Ramah

Hey Azelor, glad you are liking the program and thanks for showing what you're doing with it. Loving your snowy brushes.  :Smile:

----------


## Azélor

To share my trees well... they are based on images I found on the iinternet because I am a really bad drawer. Of course, most of the time I remade the tree using the 3 layers, so it's not really the same tree anymore. It's heavily inspired but don't really look the same in the end.

----------


## Avulsion

This program is really quite amazing!

Thank you for sharing this, Ramah. Also, please check your PMs  :Smile:

----------


## AntonioFrade

Then Are you working on the HillThing?




> Still quick brushes but a few more now in the mix - 18 in total I think. Other than "brush weighting" the program doesn't yet try to be clever about placements so that (in conjunction with the limited brushes) means there will be lots of places where brushes are repeated or so close to each other that it is obvious.
> 
> Some improvement on the general positioning (this is one of three different placement algorithms) but currently only uses the shape of the template and difference in brush size to create randomness in positioning. No jitters or anything yet, and if my logic is correct I won't need jitters like TreeThing, rather it will just use variance in density.
> 
> Anyway... here's the image:
> 
> Attachment 55792
> 
> Onwards and upwards...
> ...

----------


## Ramah

> Then Are you working on the HillThing?


Yes, indeed I am.

----------


## AntonioFrade

> Yes, indeed I am.


That are really great news. Your WIP imagen look awesome.

Also, your idea about a website seems quite good to me too.

----------


## Ramah

A mountain ranged photographed yesterday...



This image uses a brushset kindly donated by Schwarzkreuz. I still have a lot of work to do regarding the placement routines but that can wait as most of my time now on this is spent trying to get all the other components running and stable.

----------


## Azélor

This is fantastic.

----------


## Korash

ooooooooo!!!!!! I am LOOOOOOVIIINNG this !!!!!!

Those mountains ROCK!!!

----------


## AntonioFrade

Yes, indeed. Those mountains look terrific!

----------


## Korash

just out of curiosity, is there a line art/uncoloured version of the mountains? This is quite a bit of beggars being choosers, but.....just thinking for greyscale/black and white maps.

----------


## Azélor

Korash, they are not the same I think but pretty similar: http://www.cartographersguild.com/ma...-elements.html

I was wondering, what is the viewing angle required to make an isometric forest? Is it 35.264 degree ?

----------


## Korash

Thanks for the link Azelor  :Smile: 

rep to ya for finding it.  :Very Happy:

----------


## ExxonPirate

A portion of my map will require a ton of hills, and it's becoming tedious to do each one individually. Is HillThing still in the works? 

Your treething is amazing btw. I can't believe I functioned without it previously.

----------


## Kyaarmi

I have some problems with TreeThing.. It doesn't load template, even they are .png.. What should I do?

----------


## Azélor

I think it's because the template might be too big.

----------


## Kyaarmi

How big it can be?

----------


## Azélor

I don't know the exact limitation but you can't do your whole world with just one template.

----------


## PaintbrushDog

I'm having a lot of problems with making my own brushes. I'm following the directions in the post to the letter, but it just doesn't ever seem to work. If anyone could show me how to make a brush set for TreeThing using this outline, I would greatly appreciate it.

----------


## Gallien

> I have some problems with TreeThing.. It doesn't load template, even they are .png.. What should I do?


I have the same problem. And I have tried to make the png image smaller - with no effect.  :Frown:

----------


## Azélor

can you post 1 set of mask/shade/tree in PGN ?

I know there is something wrong in the instruction or it's something very suptle but I also had problems. It's been a while I haven't used treething so I don't remeber what the problem is. 

maybe the files are not named properly
maybe they are not the same size


@ Gallen, try to see if it work with an even smaller template because I know the limit is pretty small. You can't do a complete world with one template. Your are limited to 1 forest or so.

----------


## Ramah

Hey there people,

A new image to show you. This is a test done to see how easy it is to integrate work done in HillThing with work done in TreeThing.



The mountains in HillThing automatically generate an obstruction template to use in TreeThing - this allows the tree template to be just drawn around the outside of the mountains and the program handles chopping off trees behind the mts etc.

----------


## Schwarzkreuz

Its start to look realy nice. Maybe some more organic Sample next time?

----------


## Francissimo

I'm not sure but i think your (wonderfull) app isn't working with windows 8. I downloaded it on a win 7 computer without problems but when i unzip the archive on a win 8 computer i only have a .jar file instead of an exe, and i can only unzip it if i change the extension file name, but with no usefull results.

----------


## Ramah

It's supposed to be a .jar file. As long as you have Java installed then it will run like an .exe.  Maybe you need to update your java? I've never used Windows 8 so I don't know if Java comes built-in or whether it's a seperate download or what.

----------


## Francissimo

Hi ramah and thx for the quick reply. I didnt think at all to update java on my computer and that's now working perfectly so the problem was the user not the app :Wink:

----------


## stormweasel

I just discovered this thread - wow this looks awesome (bothe TreeThings and HillThing) I will be playing with these in a little while. Thanks for sharing your time and talent.

----------


## D1060

Hi, Ramah.

I`ve been using TreeThing for quite some time, and would like to make some additions to the source code. Namely, I`d like to add an option to have TreeThing change the poarsity of plotted elements according to the PNG mask's transparency, and I`d also like to add an option to the brush rescaling which would allow the app to be used for Mountains as well as trees more seamlessly.

Could I interest you in putting TreeThing in a GIThub, or in sharing the source code with the community?

Thanks,

D.

----------


## paulbhartzog

> Hi, Ramah.
> 
> I`ve been using TreeThing for quite some time, and would like to make some additions to the source code. Namely, I`d like to add an option to have TreeThing change the poarsity of plotted elements according to the PNG mask's transparency, and I`d also like to add an option to the brush rescaling which would allow the app to be used for Mountains as well as trees more seamlessly.
> 
> Could I interest you in putting TreeThing in a GIThub, or in sharing the source code with the community?
> 
> Thanks,
> 
> D.


I'd like to second this.  Ideally HillThing, TreeThing, etc. should all be shared.  After all, we are supposed to be a "community" right? :-)

Caveat:  I wrote a paper called "The Success of Openness" about open-source development when I was an instructor at the University of Michigan, and am an open-source advocate.

----------


## ChickPea

As someone who is artistically challenged, I'm very interested in trying this out (I wasn't aware of it before now.) Does anyone know if it'll run under Linux? I believe from the other comments that it only needs Java RTE so I assume it's OS-agnostic and therefore should work on my Ubuntu box. I'll try it later tonight if I get the chance, but wondered if anyone had firsthand knowledge.

----------


## ChickPea

To answer my own question, and for the benefit of other Ubuntu users, this works well on Ubuntu 14.04 with the default Java RTE from the repos. I'm quite excited by what it can do and can't wait to play around some more.

Only minor issue I had, and this might be me being blind/dumb, but when I try to save all layers (via the File | Save All Layers menu option), nothing happens. It acts like it's saving, and there's no error message, but no file is created. It's not that big of a deal because I can export each layer individually and combine them in Gimp, but I'm not sure if I'm doing something or if it's an Ubuntu issue. Either way, it's no biggie.

Thanks Ramah for creating this. You're the man!!  :Cool:

----------


## Wired

Really cool program. I'll have to try to get the hang of this sometime.

----------


## Fluesopp

As the original developer of TreeThing, I agree.
Making it open source allows for others to add new features, improve already existing features, and clean up the code.

----------


## ravells

And we love you for it, Fluesopp!

----------


## soyasun

Thank you for sharing. This is a really useful tool. If only there were also one for mountains :-)

----------


## 3l3phant

Hi all -I was trying to find a download link for HillThing (TreeThing is _amazing!_) but I'm not having any luck. Is it a separate application or is the functionality part of TreeThing? In advance, thanks!

----------


## Azélor

> Hi all -I was trying to find a download link for HillThing (TreeThing is _amazing!_) but I'm not having any luck. Is it a separate application or is the functionality part of TreeThing? In advance, thanks!


It's separated and I'm not sure if it has ever been available for download.

----------


## 3l3phant

> It's separated and I'm not sure if it has ever been available for download.


That's really too bad. PS doesn't have an image-hose function like Gimp or some of the other similar applications. HillThing looked like it would be a great alternative.  :Smile:

----------

