A simple suggestion of Ground Vehicle Acceleration

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

Post Reply
chickenbc
Engineer
Engineer
Posts: 29
Joined: 20 Jan 2008 05:30
Location: Seoul, Korea

A simple suggestion of Ground Vehicle Acceleration

Post by chickenbc »

I have a simple suggestion of ground vehicle acceleration.(with Realistic Acceleration)

In GetAcceleration() in the ground_vehicle.cpp, the force and resistance is most imortant factor.

Code: Select all

	if (mode == AS_ACCEL) {
		return (force - resistance) / (mass * 2);
	} else {
		return min(-force - resistance, -10000) / mass;
	}
The problem is, although force is grater than resistance, it may returns 0. (if force-resistance/(mass*2) < 1, then decimical part are throw away)

But I think it doesn`t make sence, since "Force is grater than resistance" so acceleration must be grater than 0. It is more like the "Natural Behavior".

So my suggestion is

Code: Select all

	if (mode == AS_ACCEL) {
		return (force>resistance) ? max((force - resistance) / (mass * 2),1) : (force - resistance) / (mass * 2);
	} else {
		return min(-force - resistance, -10000) / mass;
	}
which means if force is grater than resistance, then acceleration returns at least 1. Thanks for reading!
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: A simple suggestion of Ground Vehicle Acceleration

Post by Terkhen »

I don't see the point of this modification. What would we achieve with it?
chickenbc
Engineer
Engineer
Posts: 29
Joined: 20 Jan 2008 05:30
Location: Seoul, Korea

Re: A simple suggestion of Ground Vehicle Acceleration

Post by chickenbc »

Terkhen wrote:I don't see the point of this modification. What would we achieve with it?
Example.

SH125 + 14 (empty) passenger coaches.
Length : 16
Weight : 490t
Power : 4500hp

Speed : 195km-ish/h (194km/h)
=> force : 61975, resistance : 61189, so force > resistance

but, (force-resistance) / (mass*2) = (61975-61189) / (490 * 2) = 0.802 ...

so it returns 0. which means, maximum speed is 195km-ish/h.

In my opinion, in this case, acceleration should be grater than 0, since force> resistance. In my code, it returs 1, which means this train can accelerate further :D
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: A simple suggestion of Ground Vehicle Acceleration

Post by michael blunck »

chickenbc wrote: In my code, it returs 1, which means this train can accelerate further :D
Should it?

regards
Michael
Image
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: A simple suggestion of Ground Vehicle Acceleration

Post by Terkhen »

See r21189 and r19345.
chickenbc
Engineer
Engineer
Posts: 29
Joined: 20 Jan 2008 05:30
Location: Seoul, Korea

Re: A simple suggestion of Ground Vehicle Acceleration

Post by chickenbc »

Terkhen wrote:See r21189 and r19345.
Nono.. I don`t deal with the minimum speed, but the maximum speed.
chickenbc
Engineer
Engineer
Posts: 29
Joined: 20 Jan 2008 05:30
Location: Seoul, Korea

Re: A simple suggestion of Ground Vehicle Acceleration

Post by chickenbc »

michael blunck wrote:
chickenbc wrote: In my code, it returs 1, which means this train can accelerate further :D
Should it?
Yes, since it will make more "realistic" behavior. Or, maybe we'd better take rounding function instead of just cutting off 0.8 to 0.
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: A simple suggestion of Ground Vehicle Acceleration

Post by Terkhen »

"More realism" is not a valid gameplay reason. I still don't understand why do you think that this change needed. I recommend that you check this thread.
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: A simple suggestion of Ground Vehicle Acceleration

Post by michael blunck »

[SH125]
chickenbc wrote:
michael blunck wrote:
chickenbc wrote: In my code, it returs 1, which means this train can accelerate further :D
Should it?
Yes, since it will make more "realistic" behavior. Or, maybe we'd better take rounding function instead of just cutting off 0.8 to 0.
I don´t think that any original trains would work well together with "realistic acceleration" (or whatever it is called) because of technical constraints (no proper TE, no air drag coefficient, ...).

Simply confine original trains to original kinematics.

regards
Michael
Image
ZxBiohazardZx
Tycoon
Tycoon
Posts: 1534
Joined: 14 Mar 2006 12:46
Location: Netherlands

Re: A simple suggestion of Ground Vehicle Acceleration

Post by ZxBiohazardZx »

the suggested code isnt that bad, just define another IF-case for no-data-present?

plain physics agree that if force > resistance then accelleration > 0

also ingame i think this is still valid, only if resistance =< force you get 0 or negative accelleration
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: A simple suggestion of Ground Vehicle Acceleration

Post by SirkoZ »

I agree with chickenbc on this one. If force > resistance and the setting is called "realistic" acceleration then let the train accelerate when appropriate, not only when it's convenient.

And Michael - default trains,industries, etc. seem to be a thorn in side, eh? I'll confine you to quarters.
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 40 guests