Page 1 of 98

[OTTD] 2cc TrainsInNML

Posted: 12 Jan 2014 09:17
by Transportman
Important message:
Transportman wrote: 23 Feb 2020 18:20
Transportman wrote: 18 Jan 2020 19:38 I just released a new version (3.0-RC1) with two small fixes compared to the previous release. It is on BaNaNaS.

Somewhere next month I intend to make it a full release.
3.0 has been released, no changes compared to 3.0-RC1. With that I will stop development of this set, I just don't have the motivation to continue on it.
===
Original post:
Hi all,

The old 2ccTrainSet is a great set, but the main coder has not been seen in quite some time and nobody seems to understand the code left behind, making it near impossible to improve the set. Therefore I made an attempt to code it again from scratch in NML and hopefully in such a way that more people can understand and work on it. This conversion is mostly complete, and the focus is now more towards adding new features.

The DevZone-project can be found here and you can download this set from here. Most vehicles from the old set have been included since the 28th of May (version v5261 and newer).

Some Q and A stuff that might be interesting:

Q: Will this set be compatible with the old set?
A: No, that would require such an amount of work because it is very easy to break stuff, that it would be easier to start from complete scratch and not consider compatibility. However, I will try to keep vehicle properties the same as much as possible.

Q: I want to help, what can I do?
A: You could just play with this set and report any problems you find. You could also translate this set to your language using the web translator or sending the file directly to me.

Q: I want feature X or Y, can it be included?
A: As the current conversion to NML is more or less complete, it is time to look at new features. Currently planned are:
  • Even more vehicles
  • Vehicle animations

Re: [OTTD] 2cc TrainsInNML

Posted: 12 Jan 2014 11:12
by Purno
Transportman, a big thank you for doing this. :bow:

Re: [OTTD] 2cc TrainsInNML

Posted: 12 Jan 2014 11:13
by Voyager One
Oh finally!

OK, a small help from me... the templating system explanation.

Sprite #1 - engine going up - aligned always to the top

Sprite #2 - engine going up+right - aligned always to the bottom right + 1px upwards for every 1px shorter sprite (i.e. lenght 8/8 is aligned to the bottom, 7/8 is 1px up, 6/8 is 2px up etc.)

Sprite #3 - engine going right - aligned always to the bottom right

Sprite #4 - engine going down+right - aligned always to the bottom right

Sprite #5 - engine going down - aligned always to the bottom

Sprite #6 - engine going down+left - aligned always to the bottom left

Sprite #7 - engine going left - aligned always to the bottom left

Sprite #8 - engine going up+left - aligned always to the bottom left + 1px upwards for every 1px shorter sprite (i.e. lenght 8/8 is aligned to the bottom, 7/8 is 1px up, 6/8 is 2px up etc.)
---


Also, there are 4 separate templates for locomotives - as explained in pic #1 below:
Pic1.PNG
Pic1.PNG (13.58 KiB) Viewed 75081 times
Purchase menu sprites are ALWAYS included at the bottom of these templates.
---

As for passenger/mail coaches, there is only one template looking like this:
Pic2.PNG
Pic2.PNG (11.29 KiB) Viewed 75081 times
99,99% of pax/mail coaches has only the first row as they look always identical, loaded or not. Indian coaches have people hanging out from windows and doors and sitting on the roof and these sprites have different loading stages and therefore occupy all 3 rows of the template.

As for 4 variants - the idea is that the first variant receives 60-70% chance of appearing when buying the coach, others appear in the remaining 30-40% (10-15% each). Their stats do not differ, this is for eyecandy purpose only. This is a random effect that cannot be influenced in any way other than buying and buying coaches until you get what you want. (i.e. You want 10 variant-3 coaches? Buy coaches until you get 10 of them and then sell the others...)

Also - passenger/mail coaches have their P-menu sprite in a SEPARATE FILE, usually named as <coach name>-P.png.

---

Freight wagons have only two templates - one is the same as pax/mail coaches (with 3 rows), the other template has 4 rows.

1st row - empty wagon - driving/loading sprites
2nd row - half-full wagon - driving/loading sprites
3rd row - full wagon - driving/loading sprites
4th row (if applicable) - driving sprites - if wagon i.e. opens doors when loading then these are sprites with closed doors meant for travelling

4 variants - same as for pax/mail coaches
P-menu sprite - same as for pax/mail coaches

EDIT: I forgot - freight wagons have a separate file for EACH CARGO!

Re: [OTTD] 2cc TrainsInNML

Posted: 12 Jan 2014 11:16
by planetmaker
VoyagerOne, it's probably better when you attach the templates individually instead of aggregating an image which shows all. As we now have another template ;)
(yes, might take more posts, but well :) )

Re: [OTTD] 2cc TrainsInNML

Posted: 12 Jan 2014 11:18
by Voyager One
Sorry planetmaker, I don't understand. Are you saying I have to re-template all these things? Is there another template? Please don't scare me... :|

Re: [OTTD] 2cc TrainsInNML

Posted: 12 Jan 2014 11:22
by planetmaker
Voyager One wrote:Sorry planetmaker, I don't understand. Are you saying I have to re-template all these things? Is there another template? Please don't scare me... :|
No, don't be scared.

All I tried to say: attach the templates. Rather than attaching one file which shows the templates (where they naturally have different offsets from the origin of the file than being alone). Anyway, doesn't matter, if it is clear that you didn't show an *actual* template but an image which shows them all.

Re: [OTTD] 2cc TrainsInNML

Posted: 12 Jan 2014 11:25
by Voyager One
Aha! *relieved sound*

Ouch! Re-templating would be a mission impossible... :lol:

BTW, Jake had problems finding these on devzone so...

Re: [OTTD] 2cc TrainsInNML

Posted: 12 Jan 2014 11:52
by Transportman
Purno wrote:Transportman, a big thank you for doing this. :bow:
Don't thank me yet, I haven't done anything yet.
Voyager One wrote:OK, a small help from me... the templating system explanation.
Thanks for the information. I found some offsets in the NFO files, so that should be okay with templating in the code. Only thing to watch out for is that the back engines have a different order than the rest.

Re: [OTTD] 2cc TrainsInNML

Posted: 12 Jan 2014 11:54
by Purno
Transportman wrote:
Purno wrote:Transportman, a big thank you for doing this. :bow:
Don't thank me yet, I haven't done anything yet.
Of course I'm thanking you. If you quit, you'll dissapoint me, wouldn't want that, would you? :mrgreen:

Re: [OTTD] 2cc TrainsInNML

Posted: 12 Jan 2014 18:38
by Voyager One
Transportman wrote:Only thing to watch out for is that the back engines have a different order than the rest.
Yeah, I forgot about that. All 8 sprites are orientated identically, regardless whether the engine/wagon should face the other way... So, 1st sprite is always up, 5th sprite is always down etc...

BTW, I don't know if you've seen wiki pages of the 2ccTS, maybe you can find some additional info on how things were supposed to look like, i.e. regional parameters, loading speeds etc.

Re: [OTTD] 2cc TrainsInNML

Posted: 12 Jan 2014 20:04
by Eddi
i might be biased, but i've made excellent experience with generating the nml code from a simple table, since 99.9% of the vehicles use the same code over and over, with very little variations.

adding a new vehicle would be as trivial as adding a new row to the table.

Re: [OTTD] 2cc TrainsInNML

Posted: 14 Jan 2014 10:24
by Transportman
Transportman wrote:Thanks for the information. I found some offsets in the NFO files, so that should be okay with templating in the code. Only thing to watch out for is that the back engines have a different order than the rest.
Spoken too soon. The templates I found do not match the graphics, so I need to work on figuring out the correct offsets.
Voyager One wrote:BTW, I don't know if you've seen wiki pages of the 2ccTS, maybe you can find some additional info on how things were supposed to look like, i.e. regional parameters, loading speeds etc.
Yes, I've seen that. Also found an Excel sheet with most properties for most trains. Regional parameters and running costs that depend on speed are things that I want to do later. First I want to get the trains over to the new set as good as possible.

Re: [OTTD] 2cc TrainsInNML

Posted: 14 Jan 2014 17:30
by FooBar
Transportman wrote:Spoken too soon. The templates I found do not match the graphics, so I need to work on figuring out the correct offsets.
You should be able to get them from the existing code fairly easily. Example: http://dev.openttdcoop.org/projects/2cc ... lhead.tnfo
Note that NML swaps the ysize and xsize columns. It will be annoying to copy everything, but it will be less time-consuming than realigning everything yourself.

Also this: http://dev.openttdcoop.org/projects/dut ... plates.txt
I believe that these are all the unique combinations in the 2cc set. I do vaguely remember that the Dutch Trainset aligns it's vehicles differently in the blue boxes than the 2cc Trainset, but I'm not sure. I'm sure Voyager knows. If it's the same, then you can grab the templates from the Dutch Trainset.

Re: [OTTD] 2cc TrainsInNML

Posted: 14 Jan 2014 17:55
by Transportman
FooBar wrote:
Transportman wrote:Spoken too soon. The templates I found do not match the graphics, so I need to work on figuring out the correct offsets.
You should be able to get them from the existing code fairly easily. Example: http://dev.openttdcoop.org/projects/2cc ... lhead.tnfo
Note that NML swaps the ysize and xsize columns. It will be annoying to copy everything, but it will be less time-consuming than realigning everything yourself.
If switching ysize and xsize is the only difference, this should be correct:

Code: Select all

//dmu / ice / tgv / wagons back
template template_2cc_dmu_back(x, y) {
    //[left_x, upper_y, width, height, offset_x, offset_y]
    [x+88 , y,  8, 24,  -3, -12]
    [x+97 , y, 22, 18, -14, -10]
    [x+120, y, 32, 14, -16, -10]
    [x+153, y, 22, 18,  -6, -10]
	[x    , y,  8, 24,  -3, -12]
    [x+9  , y, 22, 18, -14, -10]
    [x+32 , y, 32, 14, -16, -10]
    [x+65 , y, 22, 18,  -6, -10]
}
And the whole bunch of other templates and the normal direction. On top of that, I don't get white pixel errors (nor any other graphical glitches), so the sizes are good, but the offsets are wrong.[/s]
Also this: http://dev.openttdcoop.org/projects/dut ... plates.txt
I believe that these are all the unique combinations in the 2cc set. I do vaguely remember that the Dutch Trainset aligns it's vehicles differently in the blue boxes than the 2cc Trainset, but I'm not sure. I'm sure Voyager knows. If it's the same, then you can grab the templates from the Dutch Trainset.
The Dutch Trainset aligns them differently. I realigned a lot of the vehicles from the original set to the new template, and it is different then the 2cc template.

[EDIT]Only the depot sprite seems to be wrong now[/EDIT]

Re: [OTTD] 2cc TrainsInNML

Posted: 14 Jan 2014 18:25
by Voyager One
FooBar wrote:Dutch Trainset aligns it's vehicles differently in the blue boxes than the 2cc Trainset, but I'm not sure. I'm sure Voyager knows.
The 2cc set indeed has a different alignment system - don't ask me why, DJ requested that. It is explained in my first post in this thread.

http://www.tt-forums.net/viewtopic.php? ... 6#p1108628

Re: [OTTD] 2cc TrainsInNML

Posted: 14 Jan 2014 20:49
by FooBar
Voyager One wrote:It is explained in my first post in this thread.

http://www.tt-forums.net/viewtopic.php? ... 6#p1108628
Ah, my bad. I didn't bother to read properly, as it seems.

Re: [OTTD] 2cc TrainsInNML

Posted: 14 Jan 2014 21:06
by Transportman
I got it fixed now, pushed my work so far to the repo.

Re: [OTTD] 2cc TrainsInNML

Posted: 15 Jan 2014 10:16
by Transportman
Just a question regarding MUs:
Should I use the old way with regards to consist length (free to make a consist as long as you want, using the MU/Maglev wagon and use a new engine for a new consist), or use fixed consist lengths (like for example the Dutch Trainset and was considered at some point for the old 2cc set)?

Re: [OTTD] 2cc TrainsInNML

Posted: 15 Jan 2014 10:51
by Voyager One
Definitely non-fixed consists. That was also one of the major features of this set.

Re: [OTTD] 2cc TrainsInNML

Posted: 15 Jan 2014 11:33
by Transportman
Voyager One wrote:Definitely non-fixed consists. That was also one of the major features of this set.
And then using the same method as the old set (MU/Maglev wagon), or could I leave it out and have players place engines behind each other?