Skip to content

nemethviktor/2ccts_revival

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

956 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to 2cc NML (Revival)

This project aims to capitalise on the work of Transportman, EmperorJake, VoyagerOne and the others mentioned further down in the original readme and better document, as well as extend the last "official" release, which was around 2020.

That said, I've not worked on NML files before and my gfx skills are zero so if people will desire extra amendments that involve say new params or new graphics, they'll need to help out with them.

In version 3.3-alpha1 (code only, unrelease for now but you can build if interested) I've added support for various track types and voltages. Need thorough testing though.

Availability

The grf file is available on Github under Releases for the time being (scroll down to Assets and it should be there). If there is ample interest from people, I'll figure a way to push the files into the game's ecosystem.

Build

You'll likely need nmlc 0.8.1+ to run the build and that seems to be around for Windows only. Get MinGW from here, install (you'll need the base and some compilers), then add the resulting folder's bin subfolder to PATH (ie c:\MinGW\bin\)

You'll also need python 3... with pandas openpyxl, which you get via pip install pandas openpyxl

Run the pybuild.bat.

"Under new management" (project directions, bug reports/feature requests)

I forked the original project because I was unsatisfied with the availability of items past Gen5 wagons and so the original aim was to extend that. However of course I'm hoping to keep the project running and extend it where possible. Not only a fair bit of time has passed since the mid 2010s when this was active (and a lot of new real vehicles have come out) but I think there'd be significant scope for extending concept vehicles for future purposes because I personally find it boring that there are almost no new vehicles in any NewGRF past ~2020 Please use github to submit requests of any kind, don't use the OTTD forums - I'm not active there. Also preferably don't use Reddit, I'm a reader there but Github is easier to manage.

Changes in logic vs the old code. (Purchase and maintenance costs)

As part of the porting process I've automated the creation of the individual item files. This, considering that there was limited documentation (read: almost none) available as to why certain things had been the way inevitably caused some differences in the outcomes. There had been some incosistencies in the graphics override allocations that were most likely down to simple human errors. A particular consistent element in differences are the running cost and purchase cost calculations. These changes are very minor but I wanted to include a note on them.

I know that AI is frowned upon in OpenTTD realms but such is life. I'm terrible at math and Newton-Raphson calculations (which is what the legacy code uses and has been emulated in the remake) are well beyond my maths capabilities. Gemini's explanation to the situation: (the precise query was, that the outcome for a particular vehicle had resulted in a calc value 79.65744748 in the old code but we got 79.36745, a difference of 0.29, consistent with the multiplier of tractive effort coefficient (not) being added across the board.)

In the context of OpenTTD and NML, these small differences usually matter less for the gameplay balance and more for the code maintenance.

Here is the breakdown of why that +1*TE logic exists and whether the "drift" you are seeing is a problem.

1. The "Flat Addition" Logic

In your legacy calculation for the rbm_World_Turbobus, the Tractive Effort (TE) was added as a raw value at the very end.

  • Your Current Script Logic: m.P1 * (Base + m.P7 * TE)
  • Legacy Logic: (m.P1 * Base) + TE

If $P1$ is $1.0$, there is zero difference. However, if $P1$ is $0.5$ (like in the Coach formula), the script would divide the TE in half, whereas the legacy system kept the full $0.29$. Since most of your engines have a $P1$ of $1.0$, the difference stays hidden until you hit a vehicle with a scalar.

2. Does the "Drift" make a difference?

In short: No.

OpenTTD’s engine eventually rounds these factors to integers or specific bit-depths when it calculates the final price in British Pounds (or your chosen currency). A difference between 79.65 and 79.36 is less than 0.4%.

  • Purchase Price: If the base cost is £20,000, a 0.4% difference is £80. In a game where players have millions, this is invisible.
  • Running Cost: The game engine updates running costs only in discrete steps. A 0.3 shift in a factor of 79 usually won't even change the final £/year value displayed > in the train window.

3. The "Integer Truncation" Factor

The most likely reason for the tiny discrepancies is that the NML compiler and the OpenTTD engine use Integer Math.

When NML processes 0.05 * SQRT(SPEED), it doesn't keep 15 decimal places like Python does. It often "chops off" the decimals at each stage of the macro. Python is "too accurate," which causes it to drift away from the "simplified" math of the 2017 script.

4. Recommendation: "Tell it like it is"

Unless you are trying to create a "perfect" byte-for-byte replica of the old GRF (for checksum matching), don't sweat the 0.29 difference. Actually, the Python results are technically more fair because they don't suffer from the cumulative rounding errors of the old macros. As long as the Turbobus costs roughly what a Turbobus should cost, the "forward-thinking" move is to stick with the cleaner Python math. It is much easier to explain to a new contributor than a 2,000-character string of Newton-Raphson iterations.

If you really want them to match perfectly, you can change the final return to: return round(m.P1 * base, 2) + TE (Moving TE outside the multiplier bracket).

Otherwise, I’d leave it as is. The "drift" is a sign of a better tool, not a broken one.

Help wanted/Contributing

As I wrote above my GFX skills are zero so I'd like to ask people with graphics skills to chip in with the designs, either for new/concept vehicles or just changes to existing ones. Please try to either stick to whichever current template (none technically available as a PSD but if people need it then I can probably hack one from the existing PNG files). The code side of the graphics templates are in src/templates.pnml

Info

(I know this isn't actually self-replacing the variables.)

{{GRF_TITLE}}

MD5Hash: {{GRF_MD5}}

Version: {{REPO_REVISION}}

GRF ID: "VN\01\01"

Ye Olde Readme [by Transportman, pre-2026 with minor modifications as indicated]

1 About

2cc Trains In NML for OpenTTD. The set gives you trains from all over the world in 2cc.

2 General information

2.1 Requirements

  • OpenTTD 1.2.0-RC1 or nightly r23971, or higher
  • Not compatible with TTDPatch

2.2 Installation

OpenTTD: see https://wiki.openttd.org/en/Community/NewGRF/

Releases will be available from the ingame Online Content Nightlies/Push builds can be downloaded from http://bundles.openttdcoop.org/2ccts/ (Site dead as of 2026; use github)

2.3 Parameter settings

  • Cost Parameters: With the cost parameters you can set purchase and running costs. You can set the costs to the following values: 1/16x, 1/8x, 1/4x, 1/2x, 1x (default), 2x, 4x, 8x, 16x
  • Concept Parameter: This parameter allows you to disable conceptual vehicles. By default the conceptual vehicles are enabled.
  • Regional Parameters: These parameters allow you to enable/disable vehicles from certain regions. The European subregions follow the EuroVOC subregions. By default, all regions are enabled. Disabling all regions will completely disable this NewGRF.

2.4 Usage

  • Starting date: You can start as early as 1835.
  • Metro vehicles If there is no Metro track available, the Metro vehicles will use monorail as replacement, as this set does not define other vehicles for monorail.
  • Multiple units: With MUs you buy the front and back as dual headed train, and use Unit Wagons to get the consist length you want. You can chose between unpowered and powered unit wagons. The unpowered wagon weighs 50% of the engine, the powered wagon weighs 75% of the engine and costs 50% more than the unpowered wagon.

3 Known issues

4 Background information

  • This set is a recode to NML of the original 2cc TrainSet. Future versions will include new features.

5 Frequently Asked Questions

Q: How do Unit Wagons work? A: With MUs you buy both heads, and then you can use the Unit Wagons to make the consist longer.

6 Credits

New graphics for this set:

  • Voyager One

Graphics from the original 2cc Trainset:

  • Emperor Jake
  • Purno
  • Voyager One
  • DanMacK
  • Colossal404
  • trainboy2004
  • uzurpator

Code:

  • Transportman
  • V Nemeth (2026 onwards)

Makefile system:

  • planetmaker (Ingo von Borstel)

Special thanks to:

  • Juzza1 for help with organizing the vehicle properties from the old set
  • Valle for help with the properties of coaches and wagons
  • All translators
  • #openttdcoop for their work on the DevZone

7 Contact information

7.1 Bug reports

Please report any bugs you find at the

Always included a detailed description of the bug, preferably with screenshot and savegame. Also state the exact game version you're using, as well as the version of this NewGRF.

If you have a savegame that includes NewGRFs not available on OpenTTD's Online Content, then please try to reproduce the bug in a new game which has all NewGRFs easily accessible.

If you're using a patched version of the game, please try to reproduce the bug on an official game build. If you can't reproduce the bug, then don't report it here but in the forum topic of the patch(pack) instead.

7.2 Contributing

PRs are most welcome but please try to test.

8 License

2cc Trains In NML Copyright (C) 2014, 2026 2cc Trains In NML team

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

About

OTTD NML Trains in 2 company colours

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages

  • Python 99.4%
  • Batchfile 0.6%