Patch: Improved acceleration for road vehicles [In trunk]
Moderator: OpenTTD Developers
Re: Patch: Realistic acceleration for road vehicles [v6-r17251]
I think the best approach to this "articulated vehicle stats for each part" thing would be to have a new option for newgrfs to use to enable it, and stick to the old "only the first part" behaviour normally for compatibility. What do you think?
Melt with the Shadows,
Embrace your destiny...
Embrace your destiny...
Re: Patch: Realistic acceleration for road vehicles [v6-r17251]
I had the feeling that I messed up somewhere again, and I finally found it 
To convert from units of 0.5 km/h I was multiplicating by 2 when I should be dividing by 2... You can start laughing now 
Obviously I was getting too much resistance from rolling friction and air drag, that's why I left it unchanged... But the speed-based resistance factors were still too powerful. Expect Improved acceleration for road vehicles v7 as soon as I correct this problem and rename a few strings.
Thief^: Sorry, I'll answer you later.

Code: Select all
/* Speed is stored in 0.5 km/h, but it is not converted to km/h get a reasonable amount of force. If converted with 20/16,
* vehicles spend too much time to reach their maximum speed, (70 tiles with resistance commented out).
*/
int speed = this->cur_speed * 10 / 16;

Obviously I was getting too much resistance from rolling friction and air drag, that's why I left it unchanged... But the speed-based resistance factors were still too powerful. Expect Improved acceleration for road vehicles v7 as soon as I correct this problem and rename a few strings.
Thief^: Sorry, I'll answer you later.
Spanish translation of OpenTTD
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: Patch: Realistic acceleration for road vehicles [v6-r17251]
Also, you might want to look at the weight being reported in the purchase window and the vehicle info window? I can't check right now, but I think when I was testing earlier there were differences between the two.Terkhen wrote:I had the feeling that I messed up somewhere again, and I finally found it
Sorry, not a very well structured bug report

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: Patch: Realistic acceleration for road vehicles [v6-r17251]
Say, could it be that if I save a running game with a newgrf, exit, change that newgrf, load the game (getting the message that a compatible grf was loaded), the vehicle in question doesn't get the updated stats? Is this normal?
I wanted to try different values of TE for my hover bus this way, but it didn't work because of what I wrote...
Anyway, I had too slow acceleration regardless of the values I chose (never made it to max speed too), glad to read it was a bug and will be fixed in the next release of your patch...
I wanted to try different values of TE for my hover bus this way, but it didn't work because of what I wrote...
Anyway, I had too slow acceleration regardless of the values I chose (never made it to max speed too), glad to read it was a bug and will be fixed in the next release of your patch...
Re: Patch: Realistic acceleration for road vehicles [v6-r17251]
The weight bus is Yet Another Stupid Mistake: I used the weight to show the vehicle's air drag and I forgot to change it back.
The speed bug was the problem for the hover bus: it seems to get to max speed faster now (even with an air drag of 24). Which value is not getting updated correctly?. It is possible that tractive effort or air drag have some kind of strange behaviour, but power and weight should work as intended (since they are already completely implemented in trunk).
The speed bug was the problem for the hover bus: it seems to get to max speed faster now (even with an air drag of 24). Which value is not getting updated correctly?. It is possible that tractive effort or air drag have some kind of strange behaviour, but power and weight should work as intended (since they are already completely implemented in trunk).
Spanish translation of OpenTTD
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Re: Patch: Realistic acceleration for road vehicles [v6-r17251]
It was TE which I noticed not getting updated by loading a compatible grf. But is it really a bug? I mean, isn't it somehow like changing newgrf ingame, which is not officially supported and thus may have such things happening?
Or is "loading a compatible grf" officially supported and should thus show no such quirks?
Or is "loading a compatible grf" officially supported and should thus show no such quirks?
Re: Patch: Realistic acceleration for road vehicles [v6-r17251]
I think that the official support of loading compatible NewGRF include changes of properties in existing vehicles. Or maybe it just uses sprites and lefts everything else as it was... Do you mind changing the advanced setting of road vehicle acceleration to original and back to realistic and see if the correct TE is now shown?.
Spanish translation of OpenTTD
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Re: Patch: Realistic acceleration for road vehicles [v6-r17251]
Shucks.. it turns out to be my mistake and not a bug at all
I had another version of the hoverbus lying around within reach of OpenTTD (content download one) and it chose to select that one as compatible grf. After having removed that one, it updates properly.
Sorry for wasting your time with this.

Sorry for wasting your time with this.

Re: Patch: Improved acceleration for road vehicles [v7-r17269]
Roujin: No problem: thank you for testing and reporting 
Thief^: Articulated vehicle behaviour will be kept as simple as possible for this patch. The time for improving it will come when (and if) this patch hits trunk. It is more complicated than it seems, as there would be some problems with tractive effort.
Here is the promised version. The "realistic" name has been dropped along with two really stupid bugs.
v7-r17269: Patch renamed to "Improved acceleration for road vehicles". Corrected a bug while calculating speed at the acceleration function. Corrected rolling friction and air drag coefficients. Road vehicle weight was shown incorrectly in the vehicle details window.
With the binary I included a little scenario I have been using for testing. Thanks everyone for the feedback, keep it coming!

Thief^: Articulated vehicle behaviour will be kept as simple as possible for this patch. The time for improving it will come when (and if) this patch hits trunk. It is more complicated than it seems, as there would be some problems with tractive effort.
Here is the promised version. The "realistic" name has been dropped along with two really stupid bugs.
v7-r17269: Patch renamed to "Improved acceleration for road vehicles". Corrected a bug while calculating speed at the acceleration function. Corrected rolling friction and air drag coefficients. Road vehicle weight was shown incorrectly in the vehicle details window.
With the binary I included a little scenario I have been using for testing. Thanks everyone for the feedback, keep it coming!

Spanish translation of OpenTTD
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Re: Patch: Improved acceleration for road vehicles [v8-r17408]
New version!. Version v8 now supports callbacks for all improved acceleration related variables besides speed (that's more complicated as there are two speed values, and not directly related to the new features introduced by this patch anyways).
v8-r17408: Added callback 36 support for power (Action 0 property 0x13) and air drag (Action 0 property 0x19). These callbacks are checked whenever the vehicle is bought, serviced, visits a station or after loading a savegame. Added callback 36 support for weight (Action 0 property 0x14) and tractive effort (Action 0 property 0x18). In addition to the above conditions, these callbacks are also checked when the cargo changes. These new variables for callback 36 are currently untested.
I swear that I have been trying to understand callbacks: I have a lot of examples and tutorials, but I just can't make a single one. Once I finish other pending projects, I'll create a test GRF for these callbacks.
v8-r17408: Added callback 36 support for power (Action 0 property 0x13) and air drag (Action 0 property 0x19). These callbacks are checked whenever the vehicle is bought, serviced, visits a station or after loading a savegame. Added callback 36 support for weight (Action 0 property 0x14) and tractive effort (Action 0 property 0x18). In addition to the above conditions, these callbacks are also checked when the cargo changes. These new variables for callback 36 are currently untested.
I swear that I have been trying to understand callbacks: I have a lot of examples and tutorials, but I just can't make a single one. Once I finish other pending projects, I'll create a test GRF for these callbacks.
Spanish translation of OpenTTD
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: Patch: Improved acceleration for road vehicles [v8-r17408]
Thanks Terkhen, I'll give this a go soon as I can and report back.Terkhen wrote:New version!. Version v8 now supports callbacks for all improved acceleration related variables besides speed (that's more complicated as there are two speed values, and not directly related to the new features introduced by this patch anyways).
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: Patch: Improved acceleration for road vehicles [v8-r17408]
andythenorth: Great 
Just now I realized that it is possible that I forgot to add a function call. If this is the case then the power and air drag callbacks will only get called when creating a vehicle or loading a game.

Just now I realized that it is possible that I forgot to add a function call. If this is the case then the power and air drag callbacks will only get called when creating a vehicle or loading a game.
Spanish translation of OpenTTD
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
-
- Chief Executive
- Posts: 658
- Joined: 11 Nov 2007 12:06
- Contact:
Re: Patch: Improved acceleration for road vehicles [v8-17453]
MTE should it be lower when theres a load on
I fort it would be better to have that set to a number higher
so when a lorry has no load it will accelerat to a top speed faster
when the lorry has a load it will accelerat slower maybe not evern get to its top speed
what do you think
but the freight multiplier should do that
also update
I fort it would be better to have that set to a number higher
so when a lorry has no load it will accelerat to a top speed faster
when the lorry has a load it will accelerat slower maybe not evern get to its top speed
what do you think
but the freight multiplier should do that
also update
Last edited by 2007Alain2007 on 14 Sep 2009 21:49, edited 1 time in total.
For Community Integrated Version http://code.google.com/p/civopenttd/
Re: Patch: Improved acceleration for road vehicles [v8-17453]
Please fix your sense of physics and, while you're at it, your spelling and punctuation.2007Alain2007 wrote:MTE should it be lower when theres a load on
I fort it would be better to have that set to a number higher
so when a lorry has no load it will accelerat to a top speed faster
when the lorry has a load it will accelerat slower maybe not evern get to its top speed
MTE is IRL actually higher when loaded, since it is (approximately) a fixed percentage of the gravity.
However, since acceleration is force / mass, a higher mass means lower acceleration. Furthermore, a higher mass will increase resistance.
Create your own NewGRF? Check out this tutorial!
Re: Patch: Improved acceleration for road vehicles [v8-17453]
Adding to what Hirundo have said: your "update" has a lot of unneeded code (it seems like some parts of trunk code added since 17453). I would prefer if you posted suggestions instead of code, as searching your changes into a huge patch is not helpful. Also, since I am active at the forums an update is not needed.
Edit: diff file updated to r17535.
Edit: diff file updated to r17535.
Spanish translation of OpenTTD
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
-
- Chief Executive
- Posts: 658
- Joined: 11 Nov 2007 12:06
- Contact:
Re: Patch: Improved acceleration for road vehicles [v8-17535]
Hi Terkhen sorry about the update
Hi Hirundo
Yes thats what i am going on about but look at this picture
To me this is wrong in the game
You get a lorry with MAX.T.E. at 26kN say its like a 1.2 litter
When you load this lorry with coal your MAX.T.E. gos up to 265kN what to me is saying it got a pit stop and got a new 2 litter in
The more HP i have the less MAX.T.E. should that mean i could not pull as much and go slower
when the lower HP i have the more MAX.T.E. means i should pull more and go faster
Hi Hirundo
Yes thats what i am going on about but look at this picture
To me this is wrong in the game
You get a lorry with MAX.T.E. at 26kN say its like a 1.2 litter
When you load this lorry with coal your MAX.T.E. gos up to 265kN what to me is saying it got a pit stop and got a new 2 litter in
The more HP i have the less MAX.T.E. should that mean i could not pull as much and go slower
when the lower HP i have the more MAX.T.E. means i should pull more and go faster
For Community Integrated Version http://code.google.com/p/civopenttd/
Re: Patch: Improved acceleration for road vehicles [v8-17535]
I'm sorry but it is really difficult for me to understand your posts, 2007Alain2007... I don't understand your problem with the TE increase when the vehicle is loaded, but having a different TE shown in both windows when the vehicle is empty is a bug. I have added it at the top of the ToDo list.
Spanish translation of OpenTTD
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
-
- Chief Executive
- Posts: 658
- Joined: 11 Nov 2007 12:06
- Contact:
Re: Patch: Improved acceleration for road vehicles [v8-17535]
Could you please post the maths you did to work this out so i can get how it works
For Community Integrated Version http://code.google.com/p/civopenttd/
Re: Patch: Improved acceleration for road vehicles [v8-17535]
http://wiki.ttdpatch.net/tiki-index.php ... celeration
http://wiki.ttdpatch.net/tiki-index.php ... _effort_1F_
http://wiki.ttdpatch.net/tiki-index.php ... _effort_1F_
Spanish translation of OpenTTD
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
-
- Chief Executive
- Posts: 658
- Joined: 11 Nov 2007 12:06
- Contact:
Re: Patch: Improved acceleration for road vehicles [v8-17535]
I just looked at a train in the game and the MAX.T.E. did not change for loaded or unloaded train
As with your patch for lorrys and busses it seems to change in game
As with your patch for lorrys and busses it seems to change in game
For Community Integrated Version http://code.google.com/p/civopenttd/
Who is online
Users browsing this forum: No registered users and 13 guests