Page 1 of 1

Billboard tool 1.0 by vmaki

Posted: Sun May 13, 2018 3:19 pm
by vmaki
I'm proud to present you to my Billboard tool 1.0! This is my first real step in to the land of coding and I'll gladly listen to any and all improvements or new features. (It would be great if somebody who actually knows how to code would have the time to read the program through and give feedback!)

The main idea is that you can draw a billboard placement map with your favorite image software that supports grayscale png files and let the Billboard tool do all the tidious billboard placement work for you. The program will also randomize the lenght, scale and file used to your specification.

(0. Install latest python and Pillow after you have installed Python.)
1. Download and unzip the zipfile to your desktop.
2. Replace the information in the config file with corresponding values to your track.
3. Paint billboardmap.png with black and white as you seem fit. Remember to remove alpha channel before exporting/saving.
4. Run
5. Move generated billboards file to your track folder.
6. Open MxSim and enjoy your freshly grown vegetation (or whatever you are placing).


Re: Billboard tool 1.0 by vmaki

Posted: Mon May 14, 2018 1:44 am
by aaronr5
I don't make tracks so I won't make use of this but I did have a look at the code. I noticed a few things. I don't know if this was on purpose but you have variables named "lenght" and "lenghtrange" which I assume is a typo and is meant to be "length" but seeings how you used the same spelling throughout the code you might have done this intentionally idk. Also on line 58 where you open the billboards file and are writing to it you have two while loops "while y <= terrainsize:" and "while x <= terrainsize:" I'm not super familiar with python but unless there was a specific reason for you using 2 while loops you could have just used the and operator and done both conditions in one while loop.

Code: Select all

while y <= terrainsize and x <= terrainsize:

Also I feel like there might be a better way to handle the config file without using all the if statements. Maybe you could make the config file a python script itself or JSON format and exec/read it from the main script and store it in a dictionary. I don't see anything wrong with the way you handled the config its just an idea. I'm no professional programmer and definitely not that familiar with python so keep that in mind.

Re: Billboard tool 1.0 by vmaki

Posted: Mon May 14, 2018 8:34 am
by vmaki
aaronr5 wrote:…I assume is a typo…

That is the case. I changed the way it does the random length for the billboards as one of the last things I did and that must have slipped through. I’ll clean it up when I get home from work.
aaronr5 wrote:…you have two while loops…

This is on purpose. The point is that it loops through the area line by line like a typewriter and then randomizes the billboard placement within that step. Then if the value from the picture is black it writes it to the file. I’m not sure if the way you suggested would work with the logic I used. But that did give me an idea while taking a shower in the morning to place the billboards just randomly and not line by line. So instead of just slighty random it would be completely random the way you suggested. It would make it look more natural. I’ll look into it!
aaronr5 wrote:… config file…

The idea with the config file was that it would make using the program more easy and that there would be no need for the end user to change things within the program itself. I think I’ll leave it as it is for now since it works. But I’ll keep the suggestion in mind if I ever dare to venture outside of python!

I really appreciate you taking time to give feedback. Thank you!

Re: Billboard tool 1.0 by vmaki

Posted: Mon May 14, 2018 9:12 am
by aaronr5
No problem and you're right the config setup is probably better the way it is from a ease of use standpoint.

Re: Billboard tool 1.0 by vmaki

Posted: Tue May 15, 2018 5:09 pm
by vmaki
I updated the billboard placement logic to be random. Placement looks much more natural now! I also cleaned up the script from useless stuff.

I'm looking into making the script use rgb channels as three different layers of billboard placement zones. So you could have for example big trees, small trees and shrubs as their own overlapping placement zones. So a chance of 1.2 in the future.

If jlv is reading. Would it be possible for me to update the first post?

Re: Billboard tool 1.0 by vmaki

Posted: Tue May 15, 2018 9:07 pm
by aeffertz
Thank you for this!

Re: Billboard tool 1.0 by vmaki

Posted: Wed May 16, 2018 1:03 am
by yzmxer608
Cool! Haven't tried it out yet but sounds like it will save a lot of time, and make the end result look more natural.