News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

Overtaking. Fun patch.

Started by isidoro, September 10, 2008, 02:47:39 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DirrrtyDirk

  
***** PAK128 Dev Team - semi-retired*****

IgorEliezer

#36
WOOT! WOOT! WOOT! WOOT! WOOT! WOOT!

Simutrans rules!

wernieman

@PatrickN:
Whats your Problem with the nightly?

@All
It looks wonderfull!!!

P.S. I use for the patch-nightly the wrong compiler for windows (gcc4 and not gcc 3), so there are some error in some menüs ...

But only in the windows-Version, NOT in the Linux-Version
I hope you understand my English

isidoro

Quote from: VS on September 16, 2008, 10:09:33 PM
Call me an ungrateful bastard, but when it is finally witnessed in person, the vehicles jumping to opposite lane aren't that much of great show ;) Nevertheless it is important improvement and also another proof that Simutrans liiiiives!

That's the problem with too much expectation.  At the end, here comes crude reality   :D  In fact, there is not much
merit behind the patch.  The idea is simple: "Overtaking = temporarily drive on the left".

Quote from: vilvoh on September 17, 2008, 12:04:15 AM
Your wishes are orders for me.....video. [...]

Really nice music.   8)  Thanks, vilvoh.

DirrrtyDirk

But it's really nice that it also works for drive_left=1 !!!
  
***** PAK128 Dev Team - semi-retired*****

vilvoh

#40
No, thanks to you for this awesome patch..

P.S: The music is Highway to hell from AC/DC.... ::)


Escala Real...a blog about Simutrans in Spanish...

PatrickN

Quote from: wernieman on September 17, 2008, 07:40:37 AM
@PatrickN:
Whats your Problem with the nightly?

I didn't have some of the dlls installed.  But I have 2022 working now and a bus with a max speed of 140 refuses to pas a bus with a max speed of 30.

Painter, in and out of retirement.

wernieman

yust put the dll´s in the simutrans-Direktory ... not installing ;o)
I hope you understand my English

jatypc

My guess the patch was only in 2022-overpatch build, but not in the regular 2022.

jatypc

Otherwise, let me congratule isodoro on a great patch - finally highways on large maps can become reality!

Ashley

Out of curiosity, does this patch mean that a moving vehicle with overtake a stationary one (which has stopped at a bus stop, for example) but which has a higher top speed? E.g. Bus A with topspeed 120 is stopped at a bus stop, is it overtaken by Bus B with topspeed 60 which doesn't stop there?
Use Firefox? Interested in IPv6? Try SixOrNot the IPv6 status indicator for Firefox.
Why not try playing Simutrans online? See the Game Servers board for details.

jatypc

Although I like the patch, there is sadly a bug to report: moving the vehicle, which overtakes, to the left lane is done by moving the picture by a (fixed) offset, which does not respect the zoom of the map. That is, if I zoom out (so that I see large area and all objects look small), the overtaking vehicle rides outside of the road during the overtaking maneuver (its picture is shifted too much). Hope this helps improving it further.

vilvoh

#47
IRRC, the patch doesn't allow vehicles to overtake other ones that are stopped.

Quote from: isidoro on September 10, 2008, 02:47:39 AM
The speed of the overtaking vehicle is at least 5 kmh over the maximum speed of the overtaken vehicle
...
..
The tiles involved in the overtaking are calculated.  For all these tiles, it must happen:

  • No stops, no crossings, no signs, no change in speed limit

I guess you should consider this case, Timothy:
- bus A stopped (max speed 120)
- bus B running (max speed 60)
- we suppose that both have different acceleration, power and weight, which means that one accelerates faster than other.
- if A starts running while B is overtaking, in theory, if B has more acceleration power, it will probably overtake A. However, if B is worst than A in terms of acceleration, it would be possible that B never overtake A (failed overtake) so you may have two vehicles running by the same way, in the same direction!! The overtaker would try to finish the action, and the overtaken one do not worry about whether to stop, to let the overtaker pass (like happens in real life)

I guess that's why overtaking stopped vehicles has not been implemented...


Escala Real...a blog about Simutrans in Spanish...

isidoro

#48
Quote from: DirrrtyDirk on September 17, 2008, 09:58:32 PM
But it's really nice that it also works for drive_left=1 !!!

You're right.  In fact, the sentence should have been:  "Overtaking = temporarily drive on the other side".  It works more or less like this:  if I get stuck, I check if I may overtake and how long will overtaking take.  Once decided, that cannot be changed.  So, the vehicle has to be faster than the maximum speed of the overtaken vehicle and there has to be nothing that makes the overtaking vehicle slow down.

Similarly, if you have two vehicles of max speed, let's say, 25 kmh one after the other and behind them, one 90 kmh bus, the bus may not overtake even if there is enough room between the two slow vehicles.  The reason is that the vehicle in front may brake and reduce that distance.  In summary, when a vehicle decides to overtake, overtaking must succeed.

Quote from: Timothy on September 18, 2008, 10:11:01 AM
Out of curiosity, does this patch mean that a moving vehicle with overtake a stationary one (which has stopped at a bus stop, for example) but which has a higher top speed? E.g. Bus A with topspeed 120 is stopped at a bus stop, is it overtaken by Bus B with topspeed 60 which doesn't stop there?

No.  For two reasons:

  • Different acceleration, as vilvoh correctly points out.  Bus A may start after Bus B has decided to overtake and accelerates quickly and prevents Bus B to successfully complete overtaking.  There is no way in the patch to abort an started overtaking process.
  • Overtaking will never take place on a stop, even if neither vehicle is going to stop there.  I didn't like the way it looked and is more complicated to program.

Quote from: jatypc on September 18, 2008, 10:00:39 AM
Otherwise, let me congratule isodoro on a great patch - finally highways on large maps can become reality!

Thanks.  If the patch is finally decided to be put into trunk, some game strategy may change:

  • One-way roads makes overtaking easier and can make sense in some additional circumstances.
  • Slower vehicles can have longer life-spans.  For instance, the horse-carriage 25kmh mail vehicle of pak64 can now be used for locations with little mail without interrupting buses.

Quote from: jatypc on September 18, 2008, 10:22:57 AM
Although I like the patch, there is sadly a bug to report: moving the vehicle, which overtakes, to the left lane is done by moving the picture by a (fixed) offset, which does not respect the zoom of the map. [...]

Correct.  When copying the offsets used for driving on the left, I noticed that those offsets depended on the zoom factor.  I first used the offsets without correction and postponed the correction, but when I checked, it seemed to work!

In fact, as you say, it doesn't work when you zoom out, but works when you zoom-in   ???  It shouldn't be difficult to correct that.  I'll try and see.

EDIT:  v8 should correct the zoom error.  However, I had to touch simgraph16.cc and my instinct tells me that that is not correct perhaps.  Let's wait for prissi to see what he thinks.

wernieman

Should I make a spezial nightly?

Ore it is better to wait?
I hope you understand my English

Ashley

Fair enough then, I was just curious :) Best still to put stops on such routes into their own little "lay-by" to keep stopping vehicles out of the way of non-stopping ones.
Use Firefox? Interested in IPv6? Try SixOrNot the IPv6 status indicator for Firefox.
Why not try playing Simutrans online? See the Game Servers board for details.

IgorEliezer

Quote from: isidoro on September 18, 2008, 09:31:14 PM

  • Overtaking will never take place on a stop, even if neither vehicle is going to stop there.  I didn't like the way it looked and is more complicated to program.

You have my support.

For me, overtaking in bus stops is very dangerous in real life (think of pedestrians), and I suspect in my country overtaking in bus stops is against law too.

jatypc

Just a curious question: is overtaking supposed to work in tunnels? Thanks.

prissi

One comment on stops: One can calculate the acceleration: If a stopped vehicle (only convoi_t can do this) and kW<=mykW  &&  weight>=myWeight  then overpassing can happen.

But I will need this weekend to look at it in depth.

wernieman

@isidoro

Do you work on the patch?

When yes, I would like to make a new nightly-patch-Version ...
I hope you understand my English

prissi

I am currently working. However, my computer tends to freeze periodically without proper reason :( Therefore integration into trunk will take a little longer.

isidoro

Quote from: wernieman on September 22, 2008, 07:18:11 PM
Do you work on the patch?

When yes, I would like to make a new nightly-patch-Version ...

Unfortunately, now I lack time.  It is in good hands (prissi's).  Last version of the patch was v8.


Quote from: prissi on September 22, 2008, 07:24:23 PM
I am currently working. However, my computer tends to freeze periodically without proper reason :( Therefore integration into trunk will take a little longer.

If I can be of any help, just tell.

prissi

Well, I found out that plugging the hard disk into another esata plug solved this. However, it was around 1am, thus this has to be on the backburner for a little longer.

Brunel

Great add-on guys.

Watching vilvoh's video it comes out to me the idea of having oneway highways (made up with signs that already exits on the game) that would have a fast lane (left one) and a slow lane (right one) useful and used just in case of traffic jams or a convoy of slow vehicles. What do you think.

Ashley

This is something I'm working on at the moment, all it needs are road graphics, appropriate signs and this patch. :)
Use Firefox? Interested in IPv6? Try SixOrNot the IPv6 status indicator for Firefox.
Why not try playing Simutrans online? See the Game Servers board for details.

jatypc

One question regarding the calculating max. speeds for overtaking:

I have noticed that for a given power and weight of a vehicle, the maximum speed if can achieve is either its maximum speed from its definition or something lower = max. achievable speed (the higher the weight, the lower the achievable speed). For instance, truck with 251 kw power, weight 18t, and load 35t does not go faster than 76 km/h (if you give it an (almost) infinitely long flat road).

Could the routine for overtaking work with the maximum achievable speed instead of the nominal ones when comparing vehicles and computing the space needed for overtaking? Please?  :P

At the moment, if I have a highway with the same kind of trucks going in all directions, then all empty ones (which could go 110 km/h for instance) are slowed down by the full ones (which go 80 km/h for instance and never more). But the overtaking does not take place, because all of them have the same nominal speed (e.g., 110 km/h).

IgorEliezer

#61
Quote from: Timothy on September 24, 2008, 03:21:52 PM
This is something I'm working on at the moment, all it needs are road graphics, appropriate signs and this patch. :)

If I see just citycars using opposite lane as an oneway highways, be sure, I will get absurdly proudly very happy (I hope I continue alive after I see that).

I don't ask so much: Seeing citycars using opposite lane would be enough for my happiness as urban planner EVEN... and vehicles (player's ones) may continue using normal lane as always it has been until now (well, almost until now).

Timothy, what would this feature be based in? I would have to place signs to make an oneway or there will be a special lane that forces citycars to use opposite lane?

It's just my curiosity...

Ashley

It'll be based on one-way signs, make a road one-way by controlling entry to and exit from it, that way there won't be any opposition to overtaking.

Nothing you couldn't do already, just the overtaking patch makes it worthwhile, it's entirely a graphics issue.
Use Firefox? Interested in IPv6? Try SixOrNot the IPv6 status indicator for Firefox.
Why not try playing Simutrans online? See the Game Servers board for details.

Brunel

#63
And what about attaching 'virtual/hidden' oneway signs to roads tiles, i mean that the game do it automatically in case the road is two lanes, I think it could have the advantage of opening the way not only for highways and freeways but for avenues with same level crossings and possibly maybe roundabouts.

Of course all these should have dedicated graphics. In case of highways and avenues a road of 1 tile long and 2 tiles wide, and in case of highways with hidden oneway signs on three out of four sides (one on the side in-between the two tiles just to forbidden same level crossing to the opposite way) and in case of avenues with hidden oneway signs on two out of four sides (to allow same level crossing to the opposite way). In case of roundabouts should be a minimum number of tiles of 3 long and 3 wide circle to allow same level crossing of four two-ways roads.

prissi

The oneway signs actually do exactly this.

Colin

It's possible to make dual lane highways already, one going for example, North, the other going South. It's the overtaking that is really needed.
I may not agree with what you say, but I will defend to the death your right to say it

Thought for the day

When you are up to your backside in alligators, it is difficult to remind yourself that your initial objective was to drain the swamp.

Fabio

wow, this looks to be a giant leap forward in roads!!!!

in any meaning, ihihihihih

:o

isidoro

I've just seen that overtaking is in trunk (r2037).  Thanks, Prissi.  I've quickly seen some of the improvements and to devise them would have taken me ages for sure.  When I look at them closely, I will ask what I don't understand if you don't mind.  One minor detail: gcc says that variable gr_last in vehicle/simverkehr.cc:893 is defined but not used.  Probably used for a test?

Quote from: jatypc on September 19, 2008, 05:07:45 PM
Just a curious question: is overtaking supposed to work in tunnels? Thanks.

To be honest, I haven't answered that before because I didn't know...   ;)  So, I went empirical and tried the new version with the attached savegame and overtaking works with bridges and tunnels, even at the entrance/exit.

Quote from: jatypc on September 24, 2008, 03:50:39 PM
[...]
Could the routine for overtaking work with the maximum achievable speed instead of the nominal ones when comparing vehicles and computing the space needed for overtaking? Please?  :P
[...]

Again, my ignorance is certainly unlimited.   :)  Although if that speed could be efficiently calculated, it would only mean a substitution in one line of the overtaking code.  Question apart is if that is desired/realistic.

When I started the patch, I named it a "fun patch", meaning it was nothing serious.  Now, I can say it has really been *FUN* to develop it.   Thanks, guys.

prissi

Well, the routine can be surely improved for convois. Citycars take already nearly their maximum speed.

Saveing/loading will not work yet ... and some other stuff is not fully finished. But I felt like I had to release it (actually spend most of the week debugging citycars on bridges and using as less CPU as possible.)

jatypc

#69
Quote from: isidoro on September 28, 2008, 01:49:59 AM
Although if that speed could be efficiently calculated, it would only mean a substitution in one line of the overtaking code.  Question apart is if that is desired/realistic.

From what I see on many central-european highways, it is very realistic to work with the maximum achievable speed given the load of a convoy. That of course does not say anything about feasibility - is it possible to quickly and easily compute the maximum achievable speed - I have no idea, unfortunately.

One more remark for improvement: it seems to me that the overtaking does not take place if all conditions are satisfied, but the first (slower) car is turning to the right (whereas the overtaking car continues straight on). In such a case, the overtaking should take place (if it is not difficult to code) because the overtaken car will actually be overtaken sooner...