Sorry for bumping this old thread, but I want to make a proposal and hear your opinions.
I will make a few points. Most importantly I want to state, that diagonal roads are - in some sense - already there, the only problem is drawing a correct NewGRF and doing some minor changes to the source code (for the basic solution). What do I mean?
The fundamental assumption of the above is that the roads will look like and work like the roads in Simutrans - if you're not familiar with this, here are some links to posts that roughly display this:
viewtopic.php?p=980809#p980809
viewtopic.php?p=149090#p149090
So what, in detail is the solution?
The first part is that - for the visuals to be correct at least four sprites - for every curved road - would have to be redrawn, what I mean is explained on the folowing image:
And analogously for the 3 other curve sprites.
With the most basic implementation the existing roads NewGRFs would become obsolete, because, you guess it, the vehicles would not go aligned on the track.
And here comes the second part: the code. The basic solution will need to change one thing: the way that RV's pass through curved roads (and curved roads only). Now the path they go through looks like following:
And needs to look like following:
I guess this is not much of a work to do, since this is hardcoded somewhere in the source. Technically speaking the implementation would be even easier because we're speaking of 1 line segment for each direction instead of 3.
This is the most basic implementation of course. If we would like to go serious and keep the existing NewGRFs intact - the roadtypes NewGRF's would have to indicate what kind of roads in terms of diagonality they contain and the code should take appropriate actions when a vehicle enters a "curved" road.
I won't cover cons and pros of such an approach to diagonal roads, as this has been discussed all over the forums and is perhaps to some degree a matter of taste.
My actual proposal is to implement this by myself (perhaps with some help from other devs), but I would like to hear what you want. I don't know if this would go into trunk, but I might fork OTTD and implement this alone for now, so you could get a taste.
You can take a poll and vote for or against my proposal: https://poll-maker.com/poll5190243xFe0668FB-156
I'm not putting this in the development section of the forum, because this is not an in-depth technical discussion.
Have a nice day.
Diagonal roads!
Moderator: OpenTTD Developers
- lukasz1985
- Route Supervisor
- Posts: 435
- Joined: 27 Mar 2013 08:58
- Location: Strumien
- Contact:
Re: Diagonal roads!
You guessed wrong. Even if somehow make your segments longer than they should be to not disconnect articulated vehicles (current implementation needs at least 8 steps per segment). You'll still have to deal with them when converting old savegames. Also, you'll likely need some compatibility solution for vehicle newgrfs that rely on subtile coordinaties. And let me to not even start on vehicle overtaking...lukasz1985 wrote: ↑13 May 2024 08:24 I guess this is not much of a work to do, since this is hardcoded somewhere in the source. Technically speaking the implementation would be even easier because we're speaking of 1 line segment for each direction instead of 3.
Re: Diagonal roads!
Don't forget the changes that must be made in the acceleration model. A visual change in the vehicle's trajectory is not enough!
While travelling through a sequence of curved road pieces, the vehicle takes a 90 degree turn on every tile, which incurs a large speed penalty. If we replace curved tiles with diagonal tiles, the vehicle will be travelling in a perfectly straight path, and the speed penalty should not be incurred. Also, when the vehicle passes from a straight tile onto a diagonal tile, it will take a slight turn (45 degrees); in this case there should be a reduced speed penalty.
This is just for the most basic implementation which won't allow any diagonal movement on crossroads, sharp diagonal-to-diagonal turns, or closely spaced parallel roads. If you want to have any of that, you need to implement massive changes to the pathfinder, and also some changes to the map format.
While travelling through a sequence of curved road pieces, the vehicle takes a 90 degree turn on every tile, which incurs a large speed penalty. If we replace curved tiles with diagonal tiles, the vehicle will be travelling in a perfectly straight path, and the speed penalty should not be incurred. Also, when the vehicle passes from a straight tile onto a diagonal tile, it will take a slight turn (45 degrees); in this case there should be a reduced speed penalty.
This is just for the most basic implementation which won't allow any diagonal movement on crossroads, sharp diagonal-to-diagonal turns, or closely spaced parallel roads. If you want to have any of that, you need to implement massive changes to the pathfinder, and also some changes to the map format.
My add-ons: • AdmiralAI fix • Persistence for vehicle evolution lines
My pictures: • The animation thread
My pictures: • The animation thread
- lukasz1985
- Route Supervisor
- Posts: 435
- Joined: 27 Mar 2013 08:58
- Location: Strumien
- Contact:
Re: Diagonal roads!
This solution would draw old savegames non compatible (in the basic variant, because if there was a way to choose vehicles behaviour for curves somehow - old savegames, would of course still work). I guess at least 8 steps per segment would still be intact.
Who is online
Users browsing this forum: No registered users and 2 guests