Patch: Improved acceleration for road vehicles [In trunk]

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

User avatar
Thief^
Route Supervisor
Route Supervisor
Posts: 469
Joined: 10 Oct 2004 00:11

Re: Patch: Realistic acceleration for road vehicles [v6-r17251]

Post by Thief^ »

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...
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Realistic acceleration for road vehicles [v6-r17251]

Post by Terkhen »

I had the feeling that I messed up somewhere again, and I finally found it :D

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;
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 :oops:

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.
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5705
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Patch: Realistic acceleration for road vehicles [v6-r17251]

Post by andythenorth »

Terkhen wrote:I had the feeling that I messed up somewhere again, and I finally found it :D
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.

Sorry, not a very well structured bug report :shock:
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Realistic acceleration for road vehicles [v6-r17251]

Post by Roujin »

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...
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Realistic acceleration for road vehicles [v6-r17251]

Post by Terkhen »

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).
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Realistic acceleration for road vehicles [v6-r17251]

Post by Roujin »

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?
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Realistic acceleration for road vehicles [v6-r17251]

Post by Terkhen »

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?.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Realistic acceleration for road vehicles [v6-r17251]

Post by Roujin »

Shucks.. it turns out to be my mistake and not a bug at all :oops: 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. :|
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Improved acceleration for road vehicles [v7-r17269]

Post by Terkhen »

Roujin: No problem: thank you for testing and reporting :D

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! :D
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Improved acceleration for road vehicles [v8-r17408]

Post by Terkhen »

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.
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5705
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Patch: Improved acceleration for road vehicles [v8-r17408]

Post by andythenorth »

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).
Thanks Terkhen, I'll give this a go soon as I can and report back.
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Improved acceleration for road vehicles [v8-r17408]

Post by Terkhen »

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.
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch: Improved acceleration for road vehicles [v8-17453]

Post by 2007Alain2007 »

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
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/
Hirundo
Transport Coordinator
Transport Coordinator
Posts: 298
Joined: 27 Jan 2008 13:02

Re: Patch: Improved acceleration for road vehicles [v8-17453]

Post by Hirundo »

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
Please fix your sense of physics and, while you're at it, your spelling and punctuation.

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!
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Improved acceleration for road vehicles [v8-17453]

Post by Terkhen »

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.
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch: Improved acceleration for road vehicles [v8-17535]

Post by 2007Alain2007 »

Hi Terkhen sorry about the update

Hi Hirundo

Yes thats what i am going on about but look at this picture
Fondingstone Transport, 7th Feb 1960.png
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/
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Improved acceleration for road vehicles [v8-17535]

Post by Terkhen »

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.
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch: Improved acceleration for road vehicles [v8-17535]

Post by 2007Alain2007 »

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/
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch: Improved acceleration for road vehicles [v8-17535]

Post by 2007Alain2007 »

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
For Community Integrated Version http://code.google.com/p/civopenttd/
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Baidu [Spider] and 9 guests