Billboard tool 1.0 by vmaki

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

Billboard tool 1.0 by vmaki

Postby vmaki » Sun May 13, 2018 3:19 pm

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/z7adzmu48cz7137/Billboard_tool_1.0.zip
Image

User avatar
aaronr5
Posts: 571
Joined: Wed Dec 29, 2010 8:03 am
Team: DAM
Location: North Carolina
Contact:

Re: Billboard tool 1.0 by vmaki

Postby aaronr5 » Mon May 14, 2018 1:44 am

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: 180
Joined: Sat Jun 02, 2012 2:46 pm
Team: Privateer
Location: Suomi, Finland

Re: Billboard tool 1.0 by vmaki

Postby vmaki » Mon May 14, 2018 8:34 am

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

User avatar
aaronr5
Posts: 571
Joined: Wed Dec 29, 2010 8:03 am
Team: DAM
Location: North Carolina
Contact:

Re: Billboard tool 1.0 by vmaki

Postby aaronr5 » Mon May 14, 2018 9:12 am

No problem and you're right the config setup is probably better the way it is from a ease of use standpoint.

vmaki
Posts: 180
Joined: Sat Jun 02, 2012 2:46 pm
Team: Privateer
Location: Suomi, Finland

Re: Billboard tool 1.0 by vmaki

Postby vmaki » Tue May 15, 2018 5:09 pm

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/33rqegmtqf8o76z/Billboard_tool_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

User avatar
aeffertz
Posts: 2811
Joined: Sat Sep 06, 2014 7:01 am
Team: Malt Liquor Boiz
Location: Wiscansin

Re: Billboard tool 1.0 by vmaki

Postby aeffertz » Tue May 15, 2018 9:07 pm

Thank you for this!
Image

User avatar
yzmxer608
Posts: 15181
Joined: Mon Dec 29, 2008 4:30 am
Team: Race Tech/SD
Location: Wisconsin, U.S.A

Re: Billboard tool 1.0 by vmaki

Postby yzmxer608 » Wed May 16, 2018 1:03 am

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.


Return to “Track Editing”

Who is online

Users browsing this forum: No registered users and 1 guest