Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Sat May 25, 2019 12:04 pm

All times are UTC




Post new topic  Reply to topic  [ 7 posts ] 
Author Message
 Post subject: NewGRF Questions
PostPosted: Wed Apr 03, 2019 8:45 pm 
Offline
Engineer
Engineer
User avatar

Joined: Sat Mar 23, 2019 1:16 am
Posts: 7
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.


Attachments:
newGRF_idea.jpg [106.57 KiB]
Not downloaded yet
Top
   
 Post subject: Re: NewGRF Questions
PostPosted: Wed Apr 03, 2019 8:59 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Wed Nov 07, 2007 10:44 pm
Posts: 9266
Location: Sol d
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.


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.

_________________
Image
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


Top
   
 Post subject: Re: NewGRF Questions
PostPosted: Wed Apr 03, 2019 9:10 pm 
Offline
Engineer
Engineer
User avatar

Joined: Sat Mar 23, 2019 1:16 am
Posts: 7
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.


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.

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.


Top
   
 Post subject: Re: NewGRF Questions
PostPosted: Wed Apr 03, 2019 9:34 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Wed Nov 07, 2007 10:44 pm
Posts: 9266
Location: Sol d
DigitalSoma wrote:
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.


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.

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.


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)

_________________
Image
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


Top
   
 Post subject: Re: NewGRF Questions
PostPosted: Wed Apr 03, 2019 9:47 pm 
Offline
Engineer
Engineer
User avatar

Joined: Sat Mar 23, 2019 1:16 am
Posts: 7
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)


Thanks for the advice! I thought it would be difficult to do, but just wanted to check with people with more experience.


Top
   
 Post subject: Re: NewGRF Questions
PostPosted: Fri Apr 05, 2019 8:58 am 
Offline
Tycoon
Tycoon

Joined: Wed Apr 27, 2005 7:09 am
Posts: 5267
DigitalSoma wrote:
[train reversing / shunting]
[...] just wanted to check with people with more experience.

To get helpful answers, you might talk to "Snail" about train reversing (newgrf) and to "karn" about realistic shunting (patch).

regards
Michael

_________________
Image


Top
   
 Post subject: Re: NewGRF Questions
PostPosted: Tue Apr 09, 2019 5:45 pm 
Offline
Engineer
Engineer
User avatar

Joined: Sat Mar 23, 2019 1:16 am
Posts: 7
michael blunck wrote:
DigitalSoma wrote:
[train reversing / shunting]
[...] just wanted to check with people with more experience.

To get helpful answers, you might talk to "Snail" about train reversing (newgrf) and to "karn" about realistic shunting (patch).

regards
Michael


I'll check them out, thanks!


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: Saibot and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2019 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2019.
Hosted by Zernebok Hosting.