Realtime 3.1-maybe-beta (12.2 base)

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

working code update

Post by SciFurz »

Updated the patch file with the current code I'm running on, the last replacement round had an unexpected efficient copy and paste process.

The major change is the (nearly) complete replacement of the Docommand variable strings (tile, p1, p2, flags, CMD_xx) to the already available CommandContainer struct, which I have expanded to include variables used in all the DoCommand functions, and increased p1 and p2 to range from p1 to p12 (the highest count of bitstuffed parameters I've seen so far at a signal function).
Only a few p1 and p2 parameters have been changed in timetable functions, the rest are still the original bitstuffed ones. I'll only modify those that I need to for the realtime implementation for now, or for the extra features I add.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Patch for TTD 1.9.2 uploded

Post by SciFurz »

Uploaded the patch for the 1.9.2 branch.

Major change is I switched function calls of DoCommand so that the call with variables gets translated to the CommandContainer, and the main function is being supplied that one instead of the other way around. This way I won't have to replace all function calls in the code while still getting the benefit of dynamic way to increase parameters when they're needed. Wish I had thought of that before I replaced all calls in the JGR branch, but then I'd want to replace those anyway in the end. There's also a good chance I'll simply start with clean code again and manually modify it from the diff file like I did before to sort of clean up the cruft that has been building up.

The patch looked savegame compatible when I only patched the saveload files and the variables, but after patching the rest of the code the intro game no longer loaded. Threw in some debug lines but so far all I can see is something's not matching up during the loading of the settings chunk. I can't tell which setting triggers it until I find out where exactly the sequence of loading settings is done (doesn't seem to follow the sequence of arrays in the file) and if and where I can squeeze in a line to check per setting. Otherwise maybe I'll try splitting the whole chunk in smaller pieces to narrow the search.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Slowly getting there for TTD 1.9.2

Post by SciFurz »

Figured out a way to change the command code to use the CommandContainer at its core without (relatively) major changes.
The DoCommand functions are switched around and an extra method added to run Cmd functions with either variables or the container. Existing functions wont have to be modified unless there's a need for extra variables or refactoring to make the code more readable. An example of that is in the timetable functions where 64 bit time is implemented and a few processes have been simplified for clarity (removed all bit stuffed elements).

I'm going to use the same method for the next JGR patch, which was the experimental basis for the nice method now used in the vanilla patch.

As an extra feature, enabled timetable arrival and departure times permanently. Why not display them when the order times are filled in anyway?

With this it's slowly becoming bug hunting time, especially to find out why loading settings from older games goes tits up.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Savegame compatible (TTD patch))

Post by SciFurz »

I had completely overlooked version setting for the configuration file variables, that's where the loading of older game snagged.
So, the vanilla TTD patch is now savegame compatible.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Vanilla patch update for 1.9.3

Post by SciFurz »

Updated the last code changes to version 1.9.3 when I got back to working on it.

The patch seems savegame compatible now and fully functional, apart from one bug.
Using ctrl to link stations crashes the game because the struct with the data is lost at the OnClick function call. I haven't found the cause yet and a test change in calling the station function prevented placing road stations all together. Other stations can still be placed so I think I'll begin with unifying station placement code as much as possible to find out where the differences lie.
Workaround is to temporarily place rail station tiles to where the linked station is to be placed, then removing them again.

Haven't found other bugs during my latest test game, so it seems the whole code conversion to CommandContainers is a success. Increasing the number of any objects or flags should be easy now.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Intermezzo: Dutch trainset wagons modification

Post by SciFurz »

Tinkered with the Dutch trainset grf as a little distraction on the side, getting to know a bit more about NML/NFO, and added a new stake wagon because the others are too toy-like for a serious cargo train.
The prototype; 4 axle, 50 t load, maximum speed 120km/h, based of off the 35t stake wagon.
50t_stakewagon-01.jpg
50t_stakewagon-01.jpg (83.38 KiB) Viewed 14086 times
The wood train suddenly looks so much better (no, no idea why this image isn't set inline).
50t_stakewagon-02.jpg
50t_stakewagon-02.jpg (170.2 KiB) Viewed 5856 times
Made the graphics fit with direction, matched wheel style with the locomotives. The empty version is complete but I still have to draw the diagonal sprites with cargo.
I might modify the other stake wagons when I'm done with this one since the cargo label for metal needs correction anyway. Adding other cargo sprites like crates is an option.

edit:
Couldn't refrain from trying a few more things and ended up adding two more colour variations to the coil wagon, a crate variation of the large stake wagon, and tweaked the wheels on the Eass and tankers wagons. Also activated the brown version to the random livery of the Eass.

Looking at the last screenshot, I realised a lot more tweaking is needed to fit the wagons correctly to the locomotives. Buffers don't match, length is incorrect, and I wonder if the wagons can be changed without things getting real ugly.

edit 2:
Modified wagon length properties (causing a possible crash warning in OpenTTD but no problems so far), and redid the sideviews while keeping to the original design as much as possible.
modified_wagons_dutch_trainset-old-new.jpg
modified_wagons_dutch_trainset-old-new.jpg (99.19 KiB) Viewed 14022 times
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

More bling intermezzo

Post by SciFurz »

Had a few more ideas last night, and went creative for a while again today.
Made a tiny multi-purpose locomotive which can refit to any cargo, including passengers. It'll come in handy when I'm experimenting. Named it Mier (Ant) because it can do anything, and a network with lots of these crawling around will look like an ant hill.
Tweaked more wagons, added an extra large livestock wagon for 50 cattle, and replaced the second green livery of the Takkis compost wagon with the orangy VAM potgrond livery. There's also a green striped one which I might add later.
Added food and non-food tanker copies of the existing ones, which will prevent refitting between chemical cargo and food cargo, and doubled capacity of the largest one to 50000 liters. Have some ideas for liveries for these, which will likely take some effort to draw.
modified_wagons_dutch_trainset-e.jpg
modified_wagons_dutch_trainset-e.jpg (22.94 KiB) Viewed 13979 times
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Modded trainset grf

Post by SciFurz »

Made the basic changes that I had in mind for the wagons with the last split of the Takkls VAM wagons between farm supplies and recyclables. While searching for photos of the wagons, I found a few more liveries that fit well into their own cargo category, thus the split. Two of the liveries I added, and even the striped one, which didn't turn out as horrible as I expected.
Made one new livery for a new tanker, which should be obvious as to what cargo it carries.

A preview:
modified_wagons_dutch_trainset-f1.jpg
modified_wagons_dutch_trainset-f1.jpg (210.71 KiB) Viewed 13921 times
For the curious, here's the grf;
dutchtrains-2.1.0-mod.tar
(2.99 MiB) Downloaded 214 times
Remember, not all tilesets are completely done, but it should give an idea of what I have in mind. When loading a game that already has the Dutch trainset in use, the warnings can be resolved by replacing the coil, VAM, and Eass wagons, but I noticed sometimes a wagon isn't available in my test game. A new game will show all as it's supposed to.

Unless I see other interesting wagons or need a different version of an existing one, I'll only be finishing the rest of the images later, maybe adding one or two liveries to wagons that have only one to make a long train look more interesting.

Now how come images here are sometimes inline, and sometimes only available as download?
Attachments
modified_wagons_dutch_trainset-f.jpg
modified_wagons_dutch_trainset-f.jpg (238.37 KiB) Viewed 5856 times
Last edited by SciFurz on 09 Dec 2019 08:47, edited 1 time in total.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
kamnet
Moderator
Moderator
Posts: 8532
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: Modded trainset grf

Post by kamnet »

SciFurz wrote: 09 Dec 2019 08:09 Now how come images here are sometimes inline, and sometimes only available as download?
Inline images have a maximum with of 800 pixels and a maximum height of 600 pixels. If it is larger than that in either direction then it's not available inline.
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Re: Modded trainset grf

Post by SciFurz »

kamnet wrote: 09 Dec 2019 08:25
SciFurz wrote: 09 Dec 2019 08:09 Now how come images here are sometimes inline, and sometimes only available as download?
Inline images have a maximum with of 800 pixels and a maximum height of 600 pixels. If it is larger than that in either direction then it's not available inline.
Ahh, indeed, two were larger. Thanks!
Maybe it was in the previous version, but I thought I had uploaded a larger one before which showed up fine. I'll have to scale as well next time then.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Train size templates

Post by SciFurz »

I knew the sizes were off with most wagons but it was hard to get it right by modifying a wagon by itself, so I created and tested wireframes for each size from 16 to 32px length.
desktop.jpg
desktop.jpg (176.54 KiB) Viewed 13803 times
.

These are the sizes which will correctly display a one pixel gap between rail objects at the diagonal and front/rear view. It clearly shows the smallest size has such a short diagonal view, it's practically useless. I redid my Mier diesel unit at 20 pixel length to make it fit, and created a six axle Big Ant version. Changed specs to maximum axle load for respectively class A and D as well, giving them a load capacity of 33 and 84 tonnes.
Mier_Big_Mier.jpg
Mier_Big_Mier.jpg (135.98 KiB) Viewed 13803 times
.

Pondering about what configurations to make for each wagon type before I recreate new sets with existing specs and fictional ones from light to heavy. A heavy eight axle raw mineral wagon with a load of 135 tonnes (including wagon) for class D might be something. It'll take a few locs to pull a line of these things away from a mine.

The five templates files if anyone wants to use them:
train_size_templates.7z
(49.58 KiB) Downloaded 199 times
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
abssalom
Engineer
Engineer
Posts: 1
Joined: 20 Dec 2019 15:18

Re: "Real" time patch (TTD 1.9.3 + JGR 0.31.2)

Post by abssalom »

Anyone has the compiled version for TTD 1.9.3? :roll:
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

A few thoughts

Post by SciFurz »

I found money a factor that got boring quickly in the game. Once you have a few lines running money keeps pouring in, something I've seen others mention as well. I cut payement rates and industry funding in my patch to avoid ending the year with billions of simolians on the bank for that reason. I still have to look into maintenance costs to figure out how to deduct the costs on a daily/weekly basis to offset the easy income.
More/better risk of losing money would add another need to keep an eye on the game and thus interesting, just like disasters do. There is a yearly cost for vehicles, but there is no cost of fuel. A plane going from one airport to the other would still generate income with a single passenger, while in reality there should be a cost based on distance and fuel consumption of the plane. Maybe I can add something based on the weight of the vehicle and force the need to have at least half the vehicle filled to break even.
A rule to cargodist to choose transport method depending on how much a passenger would have to pay would be nice. Few choose the expensive plane, most take the cheaper and slower train.

Another thing I thought about recently was fluctuating production. According to the game mechanics documentation, the chance of a change in production is only 4.5% each month. Raising that to a lot more, even up to 100%, means it's another thing to keep up with (cargo overflow at a station with rating decline, losses due to transport overcapacity). Hmm, another thing to twiddle in my patch and see what happens.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Small status update

Post by SciFurz »

I downloaded the 1.10.1 source code, there's been more rejects while applying the patch from 1.9.3, so it'll be a bit more work to integrate it.
When that runs as intended I'll post the new patch.

In the meantime I couldn't hold back on tweaking my modified version of the Dutch trainset, as well as trying my hand at creating an articulated wagon. Discovering several articles from a Russian manufacturor of wagons lately enticed me to do it.
Now I have the basic framework done for wagons ranging from 20 to 32px long (per articulated half) with 6 to 9 and 12 axles on the longer versions. Using the designated maximum axle load of 40t for class D rail, the most extreme one is the 28+28px, 12 axle one with a total possible weight of 480 tons. :-p
.
articulated_78-12axle_demo.png
articulated_78-12axle_demo.png (8.66 KiB) Viewed 11840 times

I'll create both realistic load and game versions though. Just need to calculate a good balance between all wagons for payload, loading speed, and running costs, so upgrading to a larger one for ores will seem more like a real investment, while using lighter ones for goods or packaging for instance makes more sense profit wise.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
Eastler_Dart
Engineer
Engineer
Posts: 2
Joined: 31 May 2020 09:32

Re: "Real" time patch (TTD 1.9.3 + JGR 0.31.2)

Post by Eastler_Dart »

that sounds good :-))
I wish you good luck with it, and wait for more Info
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Intermezzo

Post by SciFurz »

A little too busy and brain fried lately to work on updating the patch, and I noticed the next point release had come out while I had some work done on 1.10.1. Now I have to begin all over again.

Still no rest for the wicked mind though. Been messing in between with a variant on the NS1700 and the NS6400 and tweaking the looks of axle variations on the prototype articulated wagons.
I remembered reading about slugs (the railroad kind) when I modified the looks of the NS6400 based locomotive, and then my mind wouldn't rest until I created such a unit matching the new loc.
First I configured it as a slug, but there didn't seem to be any real benefit from just the additional traction during a test, so I configured it as a B-unit.

New NS6700:
art-48af09d-01.png
art-48af09d-01.png (11.1 KiB) Viewed 11611 times
New NS6600 with B-unit NS6650:
NS6650-04.png
NS6650-04.png (11.17 KiB) Viewed 11611 times
Extremer variations of the articulated wagons:
articulated-01.png
articulated-01.png (10.17 KiB) Viewed 11611 times
Now that I'm thinking about B-units, how about one for the NS6700 as well?
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Re: Test vehicle GRF's

Post by SciFurz »

For those curious to see the modifications I made to trains, trucks, and ships to run with my realtime test game.

These are drop-in replacements for the original ones so you'll receive a warning about the game finding these in place of the missing GRF's if they're already used in a game (temporarily remove the originals to use these).

FISH: increased cargo size of a couple of the ships. Ships need the advantage of moving large amounts of cargo to be useful and competetive.
fish.grf
(1.17 MiB) Downloaded 157 times
.

eGRVTS: gave one range of the classic trucks the hotrod treatment by adding a second drive axle and shovelling a big engine under the hood. They're fast. Also modified the Metler Ultra range with trailers, increasing load and changing the looks.
eGRVTS2.grf
(7.43 MiB) Downloaded 154 times
.

Dutch trains: modified a few stock wagons, but mostly added a few bigger ones, split tankers between food grade and non-food, added a series of universal test locomotives, added a couple of new variations on existing ones, and added prototype articulated wagons. It's quite messy but it's experimental and design phase mostly.
This one also requires the most work to redesign the trains that I use to fit my own templates. I made these to avoid making the train look like one ugly long sausage on the diagonal track, and actually look like individual locs and wagons.
dutchtrains-2.1.0.tar
(3.13 MiB) Downloaded 154 times
.

When the game warns about load capacity changes, simply run the game and insert a temporary order for affected trucks and ships to refit in a depot, and trains only need to visit the depot without the need for an explicit refit order.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Intermezzo

Post by SciFurz »

First new wagon in the articulated series, a short, 9 axle open wagon.
This X version holds 320t. The realistic cargo load version according to axle loads and load lengths would probably be around 130 tons.

I always wanted to see a real rust bucket version of the open wagon. :-p
open_high_48a09-11.png
open_high_48a09-11.png (12.25 KiB) Viewed 11525 times
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Patch for 1.10.2 will take a while

Post by SciFurz »

After the first implementation of the latest patch to 1.10.2, the game crashes shortly after starting, but the scenario editor functions.
A new game can start, but after adding my first bus it crashed as well, and my test game for 1.9.3 complains about invalid chunk.

Looks like I'll have to apply the patch step by step from scratch to see where things go wrong, and that will take a while.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Amazon [Bot] and 7 guests