Billboard tool 1.0 by vmaki

All about making tracks for MX Simulator
Post Reply
vmaki
Posts: 196
Joined: Sat Jun 02, 2012 2:46 pm
Team: Privateer
Location: Suomi, Finland

Billboard tool 1.0 by vmaki

Post 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.

Instructions:
(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 billboard1.0.py
5. Move generated billboards file to your track folder.
6. Open MxSim and enjoy your freshly grown vegetation (or whatever you are placing).

Image

http://www.mediafire.com/file/z7adzmu48 ... ol_1.0.zip
Image
aaronr5
Posts: 596
Joined: Wed Dec 29, 2010 8:03 am
Team: DAM
Location: North Carolina

Re: Billboard tool 1.0 by vmaki

Post 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.
vmaki
Posts: 196
Joined: Sat Jun 02, 2012 2:46 pm
Team: Privateer
Location: Suomi, Finland

Re: Billboard tool 1.0 by vmaki

Post 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!
Image
aaronr5
Posts: 596
Joined: Wed Dec 29, 2010 8:03 am
Team: DAM
Location: North Carolina

Re: Billboard tool 1.0 by vmaki

Post by aaronr5 »

No problem and you're right the config setup is probably better the way it is from a ease of use standpoint.
vmaki
Posts: 196
Joined: Sat Jun 02, 2012 2:46 pm
Team: Privateer
Location: Suomi, Finland

Re: Billboard tool 1.0 by vmaki

Post 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.

http://www.mediafire.com/file/33rqegmtq ... ol_1.1.zip

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?
Image
aeffertz
Posts: 4029
Joined: Sat Sep 06, 2014 7:01 am
Team: Studio ATE
Location: Wiscansin

Re: Billboard tool 1.0 by vmaki

Post by aeffertz »

Thank you for this!
Image
yzmxer608
Posts: 15352
Joined: Mon Dec 29, 2008 4:30 am
Team: SYS
Location: Wisconsin, U.S.A

Re: Billboard tool 1.0 by vmaki

Post 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.
TeamHavocRacing wrote:If I had a nickel for every time someone asked for this, I would have a whole shitload of nickels.
Post Reply