Could a GRF or Script provide Locomotive style Speed Records?

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

Post Reply
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Could a GRF or Script provide Locomotive style Speed Records?

Post by NekoMaster »

I was just wondering today, would it be possible for a GRF or script to show a news message telling the player when something has reached a need speed record like top speed or average speed between stops?

If its not possible to generate new Newspaper messages, perhaps a GRF or script could put signs or messages in the console to let you know
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Could a GRF or Script provide Locomotive style Speed Records?

Post by planetmaker »

I'm pretty confident that you could create such thing via a game script.
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Could a GRF or Script provide Locomotive style Speed Records?

Post by NekoMaster »

planetmaker wrote:I'm pretty confident that you could create such thing via a game script.
Though as I mentioned, would a script be able to create a news paper event like in Locomotion to tell the player(s) of your new speed record?
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: Could a GRF or Script provide Locomotive style Speed Records?

Post by agentw4b »

NekoMaster wrote:
planetmaker wrote:I'm pretty confident that you could create such thing via a game script.
Though as I mentioned, would a script be able to create a news paper event like in Locomotion to tell the player(s) of your new speed record?
https://nogo.openttd.org/api/trunk/classGSNews.html
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Could a GRF or Script provide Locomotive style Speed Records?

Post by NekoMaster »

Ok, so if a Game Script can do news, I wonder how it might figure out the speed records from all your vehicles running if thats possible at all.
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: Could a GRF or Script provide Locomotive style Speed Records?

Post by agentw4b »

NekoMaster wrote:Ok, so if a Game Script can do news, I wonder how it might figure out the speed records from all your vehicles running if thats possible at all.
https://nogo.openttd.org/api/trunk/classGSVehicle.html

GSVehicle.GetCurrentSpeed (vehicle_id);


https://nogo.openttd.org/api/trunk/classGSEngine.html

GSEngine.GetMaxSpeed (engine_id);
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
Eddi
Tycoon
Tycoon
Posts: 8267
Joined: 17 Jan 2007 00:14

Re: Could a GRF or Script provide Locomotive style Speed Records?

Post by Eddi »

just note that you'll probably run into performance issues if you try to read the speed of every vehicle every tick...
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Could a GRF or Script provide Locomotive style Speed Records?

Post by NekoMaster »

Eddi wrote:just note that you'll probably run into performance issues if you try to read the speed of every vehicle every tick...
I imagine then one would have to have a script run through the engines running and query their max speeds or try to calculate their average speed between stops but do it every now and then so as not to bog down the computer too much.

If anything though this idea would probably be better done as a patch where one can set up the code to record whats running, the max/average speeds of stuff and save that over time so it can compare the speeds of current vehicles to the last records and alert the player when something has broken the previous records "World Speed Record! Train Achieves Average Speed of 115 km/h between stops!"
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 31 guests