Patch: Visual and Sound Effects for NewGRF Narrow Gauge

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
mart3p
Tycoon
Tycoon
Posts: 1030
Joined: 31 Oct 2005 21:00
Location: UK

Patch: Visual and Sound Effects for NewGRF Narrow Gauge

Post by mart3p »

Visual Effects and Sound Effects for Narrow Gauge Trainsets

Some NewGRF trainsets, that replace the maglev track with narrow gauge rail, have problems with their visual effects and sound effects. With both the Serbian Narrow Gauge set and the narrow gauge trains in the Canadian set, the steam trains and diesels show no visual effects and all narrow gauge trains have maglev sound effects.

This patch fixes these problems. Visual effects are now based entirely on Action 0 property 0x22 (visual effect type) for NewGRF rail vehicles. Default values are given to original vehicles. Sound effects are now based on Action 0 property 0x19 (traction type) rather than the rail type.

Hopefully I haven’t messed up anything but, as usual, I make no guarantees. ;) One thing I know will need doing is the correct selection engine types for 2 company colours. As far as I know, there are no narrow gauge sets that support 2cc at present, so this is not an issue.

With my update to the Narrow Gauge rails grf it makes both the Canadian and the Serbian Narrow Gauge sets more playable in OpenTTD.

Edit: patch updated to r8832. 21/02/07
Edit: patch updated to r8907. 26/02/07
Edit: patch updated to r8984. Some problems with Serbian set Pendolino fixed. 02/03/07
Edit: patch updated to r9072. Tilting effect for Serbian set Pendolino added (action 2 var 45) 08/03/07
Attachments
Serbian Narrow Gauge.png
Serbian Narrow Gauge.png (67.76 KiB) Viewed 6942 times
Canadian Narrow Gauge.png
Canadian Narrow Gauge.png (82.09 KiB) Viewed 6943 times
Vis_Effects_r9072.patch
(25.43 KiB) Downloaded 265 times
Last edited by mart3p on 08 Mar 2007 23:15, edited 4 times in total.
Image
User avatar
Toni Babelony
Tycoon
Tycoon
Posts: 1389
Joined: 07 Jul 2006 09:34
Skype: toni_babelony
Location: Sagamihara-shi, Japan
Contact:

Post by Toni Babelony »

I was kind of expecting this to come! Nice work! I hope it gets implemented in one of the nightlies or in the MiniIN soon. *doesn't know anything about compiling*
Retired JapanSet developer and creator of TIAS.
User avatar
mart3p
Tycoon
Tycoon
Posts: 1030
Joined: 31 Oct 2005 21:00
Location: UK

Post by mart3p »

Thanks Toni. :)

I have attached a win32 exe if you want to try it. This was built from 0.5.0-RC5 with my changes added. It uses the data and language files from 0.5.0-RC5 so these aren't included. You can simply replace the exe in an RC5 installation with this one.

Edit: exe updated to 0.5.0-RC5. 22/02/07
Attachments
OTTD-0.5.0-RC5-M3P-win32.zip
win32 exe - use data and language files from 0.5.0-RC5
(707.24 KiB) Downloaded 223 times
Image
User avatar
mart3p
Tycoon
Tycoon
Posts: 1030
Joined: 31 Oct 2005 21:00
Location: UK

Post by mart3p »

I have posted an update of the NewGRF Effects patch in the first post. It has one new feature; the Pendolino in the Serbian set now tilts on corners - see screenshot.

To support this I have implemented action 2 variable 45 (curvature info), does anyone know of other sets that use this variable?


Edit: win32 exe added. This exe also contains some new changes that correct problems in the Serbian set with cargos and refits. I will be posting a new patch soon...

This exe (hopefully ;) ) gives almost full support for both the Serbian Standard Gauge and Narrow Gauge sets in OpenTTD. The one thing still missing is support for callback 18; purchase selection of vehicles for the AI.

Of course, the additional NewGRF support also benefits other sets as well. I would also be interested to hear of any problems found when using other GRFs with this exe.
Attachments
Tilting Pendolinos.png
Tilting Pendolinos.png (38.39 KiB) Viewed 6876 times
OTTD-win32-r9073-M3P.zip
(1.84 MiB) Downloaded 253 times
Image
hertogjan
Director
Director
Posts: 560
Joined: 03 Jan 2006 20:45
Location: Netherlands

Post by hertogjan »

You write that the narrow gauge replaces the maglev tracks. Does it only replace track graphics, so that the trains still have the railtype set to RAILTYPE_MAGLEV? This is important for the acceleration properties. If the trains would technically be of maglev type, they would also behave as maglevs (which is different from the other railtypes), which is -I assume- not intended. If not, then what railtype are they set to?
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

If the maglev menus/graphics disappear and narrow gauge appears in their place, then I'd strongly suspect that the trains are marked as traveling on "maglev" track.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

OpenTTD's railtypes are designed such that new types are easy[1] to add, without having to replace an existing type. The generic case was solved when electric rails were added.

[1]for a given value of easy
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
User avatar
mart3p
Tycoon
Tycoon
Posts: 1030
Joined: 31 Oct 2005 21:00
Location: UK

Post by mart3p »

hertogjan wrote:You write that the narrow gauge replaces the maglev tracks. Does it only replace track graphics, so that the trains still have the railtype set to RAILTYPE_MAGLEV?
hertogjan: As DaleStan suspects, the railtype for narrow gauge trains will be set to RAILTYPE_MAGLEV. The actual engine characteristics are controlled by the vehicle 'engclass', which is set by action 0 property 19 (traction class). This property selects the engines sound effects and visual effects (if none are set by property 22). You should probably use 'engclass’ to control the acceleration properties.

The problem will be, that without my patch, the 'engclass' is set to 'electric' for electric trains, monorail and maglev. My patch adds seperate values for monorail and maglev.
Brianetta wrote:OpenTTD's railtypes are designed such that new types are easy[1] to add, without having to replace an existing type.
Brianetta: I have not attempted to add a new railtype. Current GRFs that use narrow guage rail replace the maglev track. My patch just implements this in compliance with the NewGRF spec.
Image
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Brianetta wrote:OpenTTD's railtypes are designed such that new types are easy to add, without having to replace an existing type.
Yabbut there's no way (yet) to add a track type in pure NFO.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Johnny B Goode
Director
Director
Posts: 534
Joined: 17 Mar 2007 16:36

Post by Johnny B Goode »

How do you add a railtype?
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Post by Rubidium »

If I'm not mistaken, I've committed everything of this patch to trunk this night.
User avatar
mart3p
Tycoon
Tycoon
Posts: 1030
Joined: 31 Oct 2005 21:00
Location: UK

Post by mart3p »

Hi Rubidium

That's great news, thank you. :)

I'll check your changes and let you know if everything is working as intended.
Image
doghousedean
Traffic Manager
Traffic Manager
Posts: 141
Joined: 30 Apr 2007 10:26

Post by doghousedean »

does this add pendolino effect to all pendos or just the narrow guage ones.

I have compiled r10041 and the pendos dont tilt, will this fix it?

edit: also added physics patch, with the option of tilting trains get speed boost, but they dont actually tilt like in your screen hot
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Do they tilt in TTDPatch? If not, they're not going to in Open either.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Wile E. Coyote
Tycoon
Tycoon
Posts: 8515
Joined: 08 Jul 2004 22:14
Skype: wile.e.coyote2
Location: Belgrade, Serbia
Contact:

Post by Wile E. Coyote »

There is only one tilting Pendolino in Serbian set, and it's standard gauge. :wink:
Serbian rail set with Serbian scenario (ECS, PBI, FIRS and Tourist set compatible) Website | Topic and download | Latest version: 03.06.2015.
Serbian tram set Tracking table | TTD Patch tram set Latest version: 17.06.2015. | Open TTD Remix Latest version: 11.07.2015.
WIN-DOS GRF Converter Topic and download | Version 0.2.1: 09.01.2005.


Runner-up in "Best avatar Forums award" for years 2006 and 2010!
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 34 guests