[OTTD] Feature request - Ship 'type' action 0 property
Moderator: Graphics Moderators
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
[OTTD] Feature request - Ship 'type' action 0 property
It would be useful if ships had a 'type' property similar to train prop 19
Types would be sail / steam / diesel.
This would be used primarily so players could set the company colours. It would extend the current 'passenger ferry / freight ship' choices in the company colour menu. Steam ships tend to be dark colours, sailing ships vary, and modern ships tend to be brightly painted, and it would be nice for players to be able to set this. More ship sets are appearing, so this would be a nice useful feature.
If type was defined, other features could be added in future - for instance if ships had smoke effects available in game, this could be used to choose which smoke to use (steam / diesel).
cheers,
Andy
Types would be sail / steam / diesel.
This would be used primarily so players could set the company colours. It would extend the current 'passenger ferry / freight ship' choices in the company colour menu. Steam ships tend to be dark colours, sailing ships vary, and modern ships tend to be brightly painted, and it would be nice for players to be able to set this. More ship sets are appearing, so this would be a nice useful feature.
If type was defined, other features could be added in future - for instance if ships had smoke effects available in game, this could be used to choose which smoke to use (steam / diesel).
cheers,
Andy
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
-
- Tycoon
- Posts: 5954
- Joined: 27 Apr 2005 07:09
- Contact:
Re: [OTTD] Feature request - Ship 'type' action 0 property
You may already use the motion counter to add smoke effects to ships.andythenorth wrote: [...] if ships had smoke effects available in game, this could be used to choose which smoke to use (steam / diesel).
regards
Michael
Re: [OTTD] Feature request - Ship 'type' action 0 property
Problem with the approach to include the smoke in the ship drawing is that if the ship turns, the smoke moves as well. with rail engines, the smoke stays where it was emitted, regardless of vehicle movement.
Re: [OTTD] Feature request - Ship 'type' action 0 property
Since I felt like patching today, here is a patch that adds some new livery types for ships.
The patch is in two parts. The first adds a new action0 property 0x1C for ships. This is a byte-sized property with three possible values
0: steam ship
1: diesel ship
2: sailing ship
Existing ships are all set to class 1 (diesel). Ships that are not based on an existing ship (nfo IDs 0x00 - 0x0A) will have 0, i.e. steam, as their setting. I thought this would not be a problem, since there are (to my knowledge) no major ship sets that make use of the newgrf engine pool, except FISH.
The second part uses this new property to add some additional liveries. The existing 'passenger ferry' and 'freight ship' have been split into three settings each.
The functionality could be extended for visual effects. For flexibility (multiple ship generations in one ID, etc.), I suggest enhancing CB 10, though action0 could be used as well. CB 33 support (sound effects) would be nice as well. This requires some restructuring of the visual effect code to make it work without code duplication, so I've left it out for now.
Attached are diff files for the individual parts and the total patch. Enjoy

The patch is in two parts. The first adds a new action0 property 0x1C for ships. This is a byte-sized property with three possible values
0: steam ship
1: diesel ship
2: sailing ship
Existing ships are all set to class 1 (diesel). Ships that are not based on an existing ship (nfo IDs 0x00 - 0x0A) will have 0, i.e. steam, as their setting. I thought this would not be a problem, since there are (to my knowledge) no major ship sets that make use of the newgrf engine pool, except FISH.
The second part uses this new property to add some additional liveries. The existing 'passenger ferry' and 'freight ship' have been split into three settings each.
The functionality could be extended for visual effects. For flexibility (multiple ship generations in one ID, etc.), I suggest enhancing CB 10, though action0 could be used as well. CB 33 support (sound effects) would be nice as well. This requires some restructuring of the visual effect code to make it work without code duplication, so I've left it out for now.
Attached are diff files for the individual parts and the total patch. Enjoy

- Attachments
-
- 0_prop.diff
- (4.05 KiB) Downloaded 143 times
-
- 1_livery.diff
- (5.77 KiB) Downloaded 146 times
-
- total.diff
- (9.82 KiB) Downloaded 147 times
Create your own NewGRF? Check out this tutorial!
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: [OTTD] Feature request - Ship 'type' action 0 property
Nice thing

That sounds IMHO like a bad choice. Make it consistant. If that means that diesel=0 and steam=1 it's not bad; but the defaults being the same for all ships is much easier to work with, resulting in WAY less confusion.Hirundo wrote: Existing ships are all set to class 1 (diesel). Ships that are not based on an existing ship (nfo IDs 0x00 - 0x0A) will have 0, i.e. steam, as their setting.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: [OTTD] Feature request - Ship 'type' action 0 property
It's the same for other vehicles/properties. E.g. if I use the ID of a train engine that happens to be electric, the engine itself will be electric unless I set set the property myself in action0. If I use an ID outside of the normal range, I don't know what I'll get (I'd expect steam, though).
The default ships are all diesels, therefore if you override them you will get diesel ships only by default.
Perhaps I should not have mentioned that the 'default' is steam for IDs > 0x0A, rather it should be considered undefined. There is a reason that newgrfs should specify each and every property for such vehicles. IDs that do not match a TTD vehicle do not actually have any default values (except for RV tractive effort), they are initialized as zeroes. In this case, zero happens to be equal to 'Steam', but that might as well be anything else. It should not documented in the official specification and certainly not relied on.
The reason that steam == 0 and diesel == 1 is because that matches the values used for trains (internally), therefore visual effects will be slightly easier to code.
The default ships are all diesels, therefore if you override them you will get diesel ships only by default.
Perhaps I should not have mentioned that the 'default' is steam for IDs > 0x0A, rather it should be considered undefined. There is a reason that newgrfs should specify each and every property for such vehicles. IDs that do not match a TTD vehicle do not actually have any default values (except for RV tractive effort), they are initialized as zeroes. In this case, zero happens to be equal to 'Steam', but that might as well be anything else. It should not documented in the official specification and certainly not relied on.
The reason that steam == 0 and diesel == 1 is because that matches the values used for trains (internally), therefore visual effects will be slightly easier to code.
Create your own NewGRF? Check out this tutorial!
Re: [OTTD] Feature request - Ship 'type' action 0 property
All new properties after enginepool got defaults. (though I would not mind if they had sane defaults for all properties, if someone manages to define "sane")
See Engine constructor (base_life for wagons and tractive effort for road vehicles).
If you do not supply defaults you break existing grfs. And in this case "diesel" looks like a sane default. OTOH a default visual effect would be "no effect", which might not be "diesel".
See Engine constructor (base_life for wagons and tractive effort for road vehicles).
If you do not supply defaults you break existing grfs. And in this case "diesel" looks like a sane default. OTOH a default visual effect would be "no effect", which might not be "diesel".
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Re: [OTTD] Feature request - Ship 'type' action 0 property
Update:
- Colouring actually works correctly now, it used to fail because of a missing 'break' statement.
- Diesel is now the default for all vehicles.
- Colouring actually works correctly now, it used to fail because of a missing 'break' statement.
- Diesel is now the default for all vehicles.
- Attachments
-
- 0_shipclass.diff
- (4.55 KiB) Downloaded 140 times
-
- 1_livery.diff
- (5.81 KiB) Downloaded 138 times
-
- total.diff
- (10.38 KiB) Downloaded 138 times
Create your own NewGRF? Check out this tutorial!
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: [OTTD] Feature request - Ship 'type' action 0 property
Patch works with default ships as advertised, and FISH defaults to diesel.
I'll add some test code to FISH to test steam / sail
Request: 'Passenger Ship' instead of 'Passenger Ferry'.
I'll add some test code to FISH to test steam / sail

Request: 'Passenger Ship' instead of 'Passenger Ferry'.
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Re: [OTTD] Feature request - Ship 'type' action 0 property
New patch version attached. Changes:
- Applies to r20806
- Removal of some useless code, shaving around 2kb off the diff.
- Applies to r20806
- Removal of some useless code, shaving around 2kb off the diff.
- Attachments
-
- 0_shipclass.diff
- (2.48 KiB) Downloaded 156 times
-
- 1_livery.diff
- (5.81 KiB) Downloaded 151 times
-
- total.diff
- (8.32 KiB) Downloaded 140 times
Create your own NewGRF? Check out this tutorial!
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: [OTTD] Feature request - Ship 'type' action 0 property
Tested and works with r20806 (and a modified version of FISH making use of prop 1C)
- Attachments
-
- fish-nightly.tar
- (900 KiB) Downloaded 152 times
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Re: [OTTD] Feature request - Ship 'type' action 0 property
How curious. I was just thinking about this, playing a game with the "sailing ships" newgrf.andythenorth wrote:It would be useful if ships had a 'type' property similar to train prop 19
Types would be sail / steam / diesel.
I definitely agree that there should be a "no effect" type - this would also be useful for horse-drawn canal boats.
But "sail" ships might have more radical effects; suppose the prevailing wind on OTTD maps is Northerly. The patch might be extended so that they travel at different fractions of their rated speeds depending on the direction of travel. This would give a real flavour to sailing ships to make them distinct from other ships.
You don't want to get into changing wind directions. This way, newgrf authors could draw ships close-hauled when travelling NE and NW and reaching or running when travelling in other directions, but wouldn't have to draw any additional graphics; and on the scale of an OTTD game, the prevailing wind is the appropriate concern.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: [OTTD] Feature request - Ship 'type' action 0 property
You might try something with vehicle variable 80+1F for this endeavor: http://marcin.ttdpatch.net/sv1codec/TTD ... hicleArray and http://wiki.ttdpatch.net/tiki-index.php ... n2Vehicles and callback 0x36 for speed.damerell wrote: But "sail" ships might have more radical effects; suppose the prevailing wind on OTTD maps is Northerly. The patch might be extended so that they travel at different fractions of their rated speeds depending on the direction of travel. This would give a real flavour to sailing ships to make them distinct from other ships.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Who is online
Users browsing this forum: No registered users and 5 guests