NewGRF Questions
Moderator: OpenTTD Developers
- DigitalSoma
- Engineer
- Posts: 7
- Joined: 23 Mar 2019 01:16
- Contact:
NewGRF Questions
I had an idea for a newGRF to simulate a train yard (see image), but never having made a newGRF before, I have a few questions on what things are possible in newGRF coding.
1.) Would you be able to have a newGRF reorder the wagons of a train while loading in a station? If in depot, it's [engine, grain, grain, livestock, livestock], would you be able to have it reorder itself to [engine, livestock, grain, grain, livestock] based on what cargo was loaded first to last?
2.) If an empty wagon is set to an invisible sprite, will it be empty in the depot, or are the sprites in the depot separate from trains on the rails?
Thanks for any advice you could give.
1.) Would you be able to have a newGRF reorder the wagons of a train while loading in a station? If in depot, it's [engine, grain, grain, livestock, livestock], would you be able to have it reorder itself to [engine, livestock, grain, grain, livestock] based on what cargo was loaded first to last?
2.) If an empty wagon is set to an invisible sprite, will it be empty in the depot, or are the sprites in the depot separate from trains on the rails?
Thanks for any advice you could give.
- Attachments
-
- newGRF_idea.jpg
- (106.57 KiB) Not downloaded yet
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: NewGRF Questions
You cannot re-order the wagons of a train via NewGRF. That's a player action. You can choose to show different sprites depending on many different factors... not sure what you describe is possible... it might with some quite complicated shenengians on sprite control.DigitalSoma wrote:I had an idea for a newGRF to simulate a train yard (see image), but never having made a newGRF before, I have a few questions on what things are possible in newGRF coding.
1.) Would you be able to have a newGRF reorder the wagons of a train while loading in a station? If in depot, it's [engine, grain, grain, livestock, livestock], would you be able to have it reorder itself to [engine, livestock, grain, grain, livestock] based on what cargo was loaded first to last?
2.) If an empty wagon is set to an invisible sprite, will it be empty in the depot, or are the sprites in the depot separate from trains on the rails?
Thanks for any advice you could give.
Sprites in depots can be different ones than used on the track (and often are for various reasons, e.g. offsets / placement). Yet: why would an empty wagon become invisible? I'd consider that highly confusing.
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
- DigitalSoma
- Engineer
- Posts: 7
- Joined: 23 Mar 2019 01:16
- Contact:
Re: NewGRF Questions
To simulate coupling and decoupling through a combination of a station and train set newGRF, basically. I was thinking empty wagons could have a weight of zero and be invisible as if the wagons were left at the station. The train then goes to a loading station or a depot to refit and as it loads the wagons become visible to simulate wagons being coupled to the locomotive or the rest of the train.planetmaker wrote:
You cannot re-order the wagons of a train via NewGRF. That's a player action. You can choose to show different sprites depending on many different factors... not sure what you describe is possible... it might with some quite complicated shenengians on sprite control.
Sprites in depots can be different ones than used on the track (and often are for various reasons, e.g. offsets / placement). Yet: why would an empty wagon become invisible? I'd consider that highly confusing.
Of course, going through this thread and seeing new development on reversing and decoupling patches, this may not be necessary in the first place, but from what I remember reading in the past people were having trouble getting this functionality to work properly.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: NewGRF Questions
My personal opinion: A decent shunting via NewGRF will prove more challanging than tidying up some of the patches (I had a go at the NewGRF way implementing proper reversing so that trains don't flip at terminal stations... it's interesting and works only somewhat... so not better but worse than a direct patch to OpenTTD. But it teaches you a lot of what you can do with (vehicle) NewGRFs)DigitalSoma wrote:To simulate coupling and decoupling through a combination of a station and train set newGRF, basically. I was thinking empty wagons could have a weight of zero and be invisible as if the wagons were left at the station. The train then goes to a loading station or a depot to refit and as it loads the wagons become visible to simulate wagons being coupled to the locomotive or the rest of the train.planetmaker wrote:
You cannot re-order the wagons of a train via NewGRF. That's a player action. You can choose to show different sprites depending on many different factors... not sure what you describe is possible... it might with some quite complicated shenengians on sprite control.
Sprites in depots can be different ones than used on the track (and often are for various reasons, e.g. offsets / placement). Yet: why would an empty wagon become invisible? I'd consider that highly confusing.
Of course, going through this thread and seeing new development on reversing and decoupling patches, this may not be necessary in the first place, but from what I remember reading in the past people were having trouble getting this functionality to work properly.
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
- DigitalSoma
- Engineer
- Posts: 7
- Joined: 23 Mar 2019 01:16
- Contact:
Re: NewGRF Questions
Thanks for the advice! I thought it would be difficult to do, but just wanted to check with people with more experience.planetmaker wrote:
My personal opinion: A decent shunting via NewGRF will prove more challanging than tidying up some of the patches (I had a go at the NewGRF way implementing proper reversing so that trains don't flip at terminal stations... it's interesting and works only somewhat... so not better but worse than a direct patch to OpenTTD. But it teaches you a lot of what you can do with (vehicle) NewGRFs)
-
- Tycoon
- Posts: 5948
- Joined: 27 Apr 2005 07:09
- Contact:
Re: NewGRF Questions
To get helpful answers, you might talk to "Snail" about train reversing (newgrf) and to "karn" about realistic shunting (patch).DigitalSoma wrote: [train reversing / shunting]
[...] just wanted to check with people with more experience.
regards
Michael
- DigitalSoma
- Engineer
- Posts: 7
- Joined: 23 Mar 2019 01:16
- Contact:
Re: NewGRF Questions
I'll check them out, thanks!michael blunck wrote:To get helpful answers, you might talk to "Snail" about train reversing (newgrf) and to "karn" about realistic shunting (patch).DigitalSoma wrote: [train reversing / shunting]
[...] just wanted to check with people with more experience.
regards
Michael
Who is online
Users browsing this forum: No registered users and 14 guests