The International Simutrans Forum

PakSets and Customization => General Resources and Tools => Tools => Topic started by: Zeno on January 28, 2012, 07:13:59 PM

Title: Rail Alignment Help program
Post by: Zeno on January 28, 2012, 07:13:59 PM
Some time ago I started to code a program to help me aligning rail vehicles properly. This task is really tough when talking about @MUs. Now I wanted to paint some more EMU trains, so I have rescued the project and I have the aim to finish it before starting to paint those vehicles. I leave here a demonstration video, which will show much more than I can explain in words. I'd like to know if it would be worth to make this tool public, or adapt for other pak size (now it's only for 128), maybe to other vehicles also. Thank you in advance for your comments :)

Here, the video --> www.youtube.com/watch?v=7UQl2cnTjgA (http://www.youtube.com/watch?v=7UQl2cnTjgA)

First release: v0.1 r5 download (https://sourceforge.net/projects/vats/files/Windows%20Installer/)
Title: Re: Rail Alignment Help program
Post by: prissi on January 28, 2012, 07:58:05 PM
Most useful indeed.
Title: Re: Rail Alignment Help program
Post by: ӔO on January 28, 2012, 10:38:56 PM
this is like a dream program for painters.

is the way file also loaded like the trains? I think it would be great if road vehicles were also possible.

I would definitely support this.
Title: Re: Rail Alignment Help program
Post by: Ashley on January 29, 2012, 10:35:12 AM
Nifty! :)
Title: Re: Rail Alignment Help program
Post by: Zeno on January 29, 2012, 11:54:18 AM
As long as some interest has been shown, I think I will make a code cleanup (now that it's still rather a small thing) and then upload to my sourceforge account.
Btw, just enabled remove and save vehicle functionalities, which were already implemented, and added new variable vehicle length support, so non-standard ( not 8 ) lengths are drawn properly.
I will be testing it by aligning the DMUs I have currently waiting to be re-aligned, so there is a possibility of an initial (beta?) release in a few days :)

Quote from: AEO on January 28, 2012, 10:38:56 PM
I think it would be great if road vehicles were also possible.
I think it should not be difficult to adapt. There is a "hidden" functionality for background template loading... by using it, a road background could be drawn, then the program mechanics doesn't care of what you've painted: it will only paint what you load by using some calculated coordinates, no matter if it's a train or a bicycle :P
Considering that, it might be useful as well for road vehicles, trams and maglevs. Probably not very useful for airplanes and ships though...

The only problem I can see right now is that the program hasn't the ability to load the same object in different positions (this would apply if you want to load a loco then five wagons of same type to see how the convoi is drawn). It can be done by loading the same vehicle in different positions, but the program will allow to handle different offsets for each position and that would lead the user to confusion for sure. I will look for a workaround for that, if possible.
Title: Re: Rail Alignment Help program
Post by: prissi on January 29, 2012, 09:20:50 PM
I think the rails are a few pixel diffrent in the different paks, those alignment graphics background imges must be pak-dependent too, or?
Title: Re: Rail Alignment Help program
Post by: Zeno on January 29, 2012, 09:23:41 PM
Yes, probably the rails will differ in different paks. Anyway, the templates are just plain images that can be easily loaded, so no matter the pak you use as long as you provide the proper background images, which can be easily built with a couple of screenshots and as few gimp knowledge as mine :)
Title: Re: Rail Alignment Help program
Post by: Zeno on January 30, 2012, 10:17:54 PM
Well, I have everything ready for a first (pre-)release, let's say v0.1 :)
What about the name... Simutrans Align Helper sounds ok? Any proposal?
When I decide for a name I'll upload it to sourceforge.

At the moment you can download a minimum-functional version here (http://zeno.simutrans.com/RailAlignHelper01.7z).
I'm sorry this is a preliminar version and doesn't include any help file/documentation. You can mostly look at the video at the beginning of the thread to know how to use it. If you still have questions, ask here. If you can wait for some days, maybe I'm able to make a small help document or FAQ before end of the week.

Some tips/advices:
And remember: make a backup of your images before playing with this!!! I warned you, so don't put the blame on me later!! ;-)
Please, let me know your thoughts, bugs, ideas, whatever :)
Title: Re: Rail Alignment Help program
Post by: greenling on February 03, 2012, 09:24:41 PM
Zeno your programm it very hot!
Then your programm than be can to aligment road,tram,maglev,ships,plans and monrail.
and that in 64 pixells too.
Then have the simutrans modells devloper an Powertool with the work on new modells than go quick from the hand.
:) :)
Title: Re: Rail Alignment Help program
Post by: Zeno on February 04, 2012, 12:06:52 PM
The project is in sourceforge at https://sourceforge.net/p/vats/admin/ (https://sourceforge.net/p/vats/admin/)

There is also a small help page (wiki) as well as a first program release. The installer can be downloaded here (https://sourceforge.net/projects/vats/files/Windows%20Installer/).
The help page does not tell much how it works, so you better get guided by the youtube video I previously posted.

Remember this version has still some important limitations:
* Only 128 sized stuff
* Non changeable templates
* PNG *MUST* be in the Pak128 standard structure
** first line only text
** vehicle views in second line
** order must be the same than application buttons)
Title: Re: Rail Alignment Help program
Post by: ӔO on February 04, 2012, 01:06:45 PM
I'd call it ZAP
Zeno's Alignment Program.
Title: Re: Rail Alignment Help program
Post by: Zeno on February 04, 2012, 02:35:03 PM
Heh AEO... I don't feel like giving credits to myself through the program name :P
Anyway the period for naming proposals ended yesterday; from now on I feel too lazy to rename everything again. It's a mess, you know!
Thank you anyway for your proposal!
Title: Re: Rail Alignment Help program
Post by: jamespetts on February 04, 2012, 04:00:01 PM
I like the idea of this! I've had trouble in the past with alignment.
Title: Re: Rail Alignment Help program
Post by: Zeno on February 05, 2012, 05:18:01 PM
I am trying to give the program the option to use different pak sizes, but I'm finding trouble with the vehicle offsets.
I ask if there is someone familiar with the vehicle positioning code in simutrans to advice me if I am doing wrong; in my program I have an offset calculated based on the direction and tile size:
West: X offset is + vehicle_length * tile_size / 32;
West: Y offset is + vehicle_length * tile_size / 64;
North: X offset is - vehicle_length * tile_size / 32;
North: Y offset is + vehicle_length * tile_size / 64;
and so on...

Please, I'd like to be adviced if I am in the right path or not; maybe I'm confusing things, as I've having some undesirable results.

Another difficulty I can already spot is how will I manage the first position offset. As it's done now, it will be fixed and will force the background image to be moved/modified in order to fit the fixed initial offset. Maybe it's not the most elegant way to do it, and I'm not sure how can I handle such a thing...

Thank you in advance.
Title: Re: Rail Alignment Help program
Post by: prissi on February 05, 2012, 09:29:37 PM
Maybe it would be easier to just use the routines from simutrans ... from vehikel_basis_t::get_screen_offset


Title: Re: Rail Alignment Help program
Post by: Zeno on February 05, 2012, 09:40:17 PM
Quote from: prissi on February 05, 2012, 09:29:37 PM
Maybe it would be easier to just use the routines from simutrans ... from vehikel_basis_t::get_screen_offset
I will look into the svn for it. Thank you prissi.