Page 3 of 4

Re: Patch: Juanjo's patches

Posted: 15 Jul 2017 22:25
by kamnet
How does it compare to default OpenTTD directions?

Re: Patch: Juanjo's patches

Posted: 15 Jul 2017 23:42
by J0anJosep
kamnet wrote:How does it compare to default OpenTTD directions?
The pathfinder itself doesn't provide anything new. But it doesn't rely on finite state machines (so we can modify airport layouts).

Maybe this video can explain the idea behind this feature:
(the graphics of runways and flying aircraft doesn't look good by now)


Re: Patch: Juanjo's patches

Posted: 16 Jul 2017 02:35
by kamnet
Oh, HELLO!!!!! :bow: Now I see where you're going with this! Good gawd, man, hurry up and bring this into being!! :)

Re: Patch: Juanjo's patches

Posted: 16 Jul 2017 08:14
by J0anJosep
Juanjo wrote:(the graphics of runways and flying aircraft doesn't look good by now)
*don't
kamnet wrote:hurry up and bring this into being!!
It won't be a bug-free playable feature anytime soon. This feature is far from being finished. :oops:
By the way, I will concentrate on aircraft movement, but I won't spend time on airport graphics right now.

Re: Patch: Juanjo's patches

Posted: 16 Jul 2017 08:27
by kamnet
Juanjo wrote:
kamnet wrote:hurry up and bring this into being!!
It won't be a bug-free playable feature anytime soon. This feature is far from being finished. :oops:
By the way, I will concentrate on aircraft movement, but I won't spend time on airport graphics right now.
I'm very excited about the work you're doing here. I hope that this is something which can get fast tracked into OpenTTD proper. But I remember how long we also had to wait for CargoDist. And I know we're going to be waiting a long time for NRT. I just get very excited about these literal game-changing additions, even after all these years.

Re: Patch: Juanjo's patches

Posted: 12 Feb 2018 13:33
by J0anJosep
These months I have improved several things and I feel like writing an update now.

First of all, the water transport improvements I added were problematic. When loading an old game, ship reservation caused problems. So I decided on adding a new setting: do not reserve water paths (old style for old saved games)/do reserve water paths (aka "avoid ship collision"). This solves those annoying crashes with old saved games.

I still have some ideas for water transport that I will work on when I can. The first one has been around for years: add more lock sprites, so locks have gates that open and close and the water level of the lock can rise and descend (only if "avoid ship collision" is enabled). The second one is about improving ship movement along narrow paths when the "avoid ship collision" is enabled. I have a simple idea about how to do it. I hope this summer I finally deal with these once and for all.

A small change: I have included a minor shortcut for deleting all pending news messages. When changing the date or when some setting was changed, sometimes a lot of news windows appeared on screen. Maybe I missed something, but I found no easy way to delete those messages instantly. So Ctrl+Del now deletes all news windows, even pending ones.

Now, fonts and GUI size. Font sizes and GUI elements are too small or too big, depending on screen resolution. I have improved the "autosizing" feature a little. This feature I included some years ago lets OpenTTD decide font sizes. I have made some changes so it works better. The size of bevels, paddings and margins are now recalculated automatically as well. You can also choose the default bitmap font or a TrueType font (with my previous versions, default bitmap symbols didn't work well, but now they should).

See attached images. Buttons and other elements can be smaller if you think they are way too big. This is about making things easier for the user, not just making everything bigger.
trunk-4k.png
With unmodified OpenTTD on a HiDPI screen.
(931.8 KiB) Not downloaded yet
autosizing-4k-bitmapfonts.png
Autosizing on a HiDPI screen and default bitmap fonts.
(2.66 MiB) Not downloaded yet
autosizing_4k-truetype.png
Autosizing and TrueType fonts.
(1.45 MiB) Not downloaded yet
As for the non-FSM tile-modifiable airports, there's still a long way to go but I am confident I will do it. At the moment, I am playing and "borrowing" airport sprites from "OpenGFX+ Airports" and I worked out how to rotate airports for the already defined layouts. This is still unfinished. Apart from this, aircraft pathfinding has improved a little bit, removing some serious bugs. There is a lot of work to do yet for helicopters and aircraft flying patterns though.

To sum up, this project is not dead and some things have been improved, but none of them is finished yet.

Re: Patch: Juanjo's patches

Posted: 16 Feb 2018 07:53
by michael blunck
Juanjo wrote: I still have some ideas for water transport that I will work on when I can. The first one has been around for years: add more lock sprites, so locks have gates that open and close and the water level of the lock can rise and descend (only if "avoid ship collision" is enabled).
I really like your ideas about "water transport". Good work so far.

Regarding your ideas about locks, I don´t know if you remember that TTDPatch had locks visually *lifting/lowering* ships, rather than the OTTD thing of letting ships "slide" up/down a slanted surface of water. Sometime ago, Peter1138 made a patch for OTTD, implementing that behaviour, but never released it.

regards
Michael

Re: Patch: Juanjo's patches

Posted: 16 Feb 2018 23:24
by J0anJosep
michael blunck wrote: Regarding your ideas about locks, I don´t know if you remember that TTDPatch had locks visually *lifting/lowering* ships, rather than the OTTD thing of letting ships "slide" up/down a slanted surface of water. Sometime ago, Peter1138 made a patch for OTTD, implementing that behaviour, but never released it.
Yes, I know about it. I already implemented lifting/lowering ships, also having in mind lock gates. I just skipped the part about drawing and coding the graphics for lock gates, which is heavy work.

Re: Patch: Juanjo's patches

Posted: 18 Feb 2018 22:22
by xarick
I had an idea a few months ago, which was aimed to make pathfinding for ships less intensive than what it is in trunk, then saw you use path reservations on your ships. It calls the pathfinder only once, which is great! However, I noticed that ships would never cross the same reserved paths.

Do you have this part of the code separate from your build? Wanted to try to apply it against trunk without every other change that you've made. Not sure if I'm making myself clear. My idea was to try to keep the same ship crossing each other behaviour of trunk, but use the path reservations as a way to reduce pathfinding calls.

Instead of storing the reservation on the map array, it would store it somewhere else, I initially though of vehicle cache.

Re: Patch: Juanjo's patches

Posted: 19 Feb 2018 01:06
by HackaLittleBit
xarick wrote: Instead of storing the reservation on the map array, it would store it somewhere else, I initially though of vehicle cache.
Nice idea.
Maybe you don't have to store the whole reservation but just 10 or 20 tiles. after that you launch the path finder to get the next 10/20 tiles and so on.
That way you could use a fixed location.
I you have collision or mishap (change of landscape) you call pathfinder again.

Re: Patch: Juanjo's patches

Posted: 19 Feb 2018 20:43
by J0anJosep
xarick wrote:Do you have this part of the code separate from your build? Wanted to try to apply it against trunk without every other change that you've made. Not sure if I'm making myself clear. My idea was to try to keep the same ship crossing each other behaviour of trunk, but use the path reservations as a way to reduce pathfinding calls.
Instead of giving you a branch, I will point you to the commits and parts of the code you are interested in. "ShipController" in ship_cmd.cpp is the function that should use the "cached" paths.
YAPF reserves a path from the origin to the last tile
NPF reserves a path from the origin to the last tile
You should adapt it to your idea.
xarick wrote:Instead of storing the reservation on the map array, it would store it somewhere else, I initially though of vehicle cache.
Yes, create a node list with {tile, trackdir, next_node} and use it. That "cache" needs to be stored in savegames. Otherwise, desyncs will happen.
HackaLittleBit wrote:Maybe you don't have to store the whole reservation but just 10 or 20 tiles. after that you launch the path finder to get the next 10/20 tiles and so on.
That way you could use a fixed location.
I you have collision or mishap (change of landscape) you call pathfinder again.
He can store the whole reservation, no matter what. Changes of landscape will be problematic, as the "cached paths" are not stored in the map array.

Re: Patch: Juanjo's patches

Posted: 27 Feb 2018 18:57
by HackaLittleBit
Juano;

Attached is zipfile that contains a perl file that generates a svg from airport_movement.h
For visualisation and point locations.
I had it laying around doing nothing.
Maybe you find it usefull.

regards.

Re: Patch: Juanjo's patches

Posted: 27 Feb 2018 22:57
by J0anJosep
HackaLittleBit wrote:Attached is zipfile that contains a perl file that generates a svg from airport_movement.h
For visualisation and point locations.
I had it laying around doing nothing.
Maybe you find it usefull.
Thank you, but I have already worked that out.

Right now I'm working on sprites for locks and airports and I hope next summer can deal with flying aircraft and fix some crashes that involve helicopters.
gravel_gui.png
(270.8 KiB) Not downloaded yet

Re: Patch: Juanjo's patches

Posted: 28 Feb 2018 02:33
by perverted monkey
That screenshot looks amazing!

Re: Patch: Juanjo's patches

Posted: 09 Aug 2018 13:12
by J0anJosep
I have added gates for water locks. Moreover, I couldn't resist and I also added longer locks (5 and 7 tiles long). These longer locks would need some additional sprites, but they work as expected.
locks.png
locks.png (614.27 KiB) Viewed 5203 times
One and two-tile wide canals were problematic when ship separation was enabled. Ships used to get stuck easily. One solution to this problem is allowing users to decide which are the preferred directions on water tiles. It improves the situation if players use it wisely.
preferred_trackdirs.png
preferred_trackdirs.png (253.7 KiB) Viewed 12567 times
Finally, I have run out of ideas for water transport...

Re: Patch: Juanjo's patches

Posted: 20 Aug 2018 14:01
by wallyweb
Juanjo wrote:One and two-tile wide canals were problematic when ship separation was enabled. Ships used to get stuck easily. One solution to this problem is allowing users to decide which are the preferred directions on water tiles. It improves the situation if players use it wisely.
Players could use my Sea Lanes, Channels and Buoys to guide their ships to the intended locks. 8)

Re: Patch: Juanjo's patches

Posted: 20 Aug 2018 16:37
by J0anJosep
wallyweb wrote:
Juanjo wrote:One and two-tile wide canals were problematic when ship separation was enabled. Ships used to get stuck easily. One solution to this problem is allowing users to decide which are the preferred directions on water tiles. It improves the situation if players use it wisely.
Players could use my Sea Lanes, Channels and Buoys to guide their ships to the intended locks. 8)
Good idea for guiding ships. My proposal does something similar: it guides the ships through some suggested directions (not forbidding, just "suggesting"), because when ship separation is enabled, narrow paths and crowded docks cause problems.

Re: Patch: Juanjo's patches

Posted: 17 Dec 2018 12:01
by nihues
Hello Juanjo,

Nice patches, some are very promissing, I'm looking/testing/trying some patches for auto group name of vehicles to compile for JGR patches (so I can actually play with more stuff, but did not find any patch separated from all the code)... and liked your way of doing, very clean, and lot of options. Is there a diff or something for it? I only need the diff for:

Code: Select all

Group window: Automatic building of groups: Rebuild groups by order lists, visited towns, transported cargo, first engine class and first engine.
Dunno if it's easy to integrate to JGR but will try :roll:

Also, I did not test more because I could not add a train depot, always show "Can't build train depot here", for smaller or bigger depots...
And, my ships stay at dock and don't move if the option for reserve is On hehe

Re: Patch: Juanjo's patches

Posted: 18 Dec 2018 16:09
by J0anJosep
nihues wrote: Is there a diff or something for it? I only need the diff for:

Code: Select all

Group window: Automatic building of groups: Rebuild groups by order lists, visited towns, transported cargo, first engine class and first engine.
Hi. You should look for the commits used for this feature and see how you can make them work with JGR patches. Some commits you can look are:
https://github.com/J0anJosep/OpenTTD/co ... 005dccaf88
https://github.com/J0anJosep/OpenTTD/co ... acb866631a
https://github.com/J0anJosep/OpenTTD/co ... f3639ee3b6
https://github.com/J0anJosep/OpenTTD/co ... 6995fc3b24
You will probably need some other previous commits.
nihues wrote: Also, I did not test more because I could not add a train depot, always show "Can't build train depot here", for smaller or bigger depots...
And, my ships stay at dock and don't move if the option for reserve is On hehe
Can you provide a savegame and how do you trigger these? Next week I have some free time, so I can fix it soon.

Re: Patch: Juanjo's patches

Posted: 18 Dec 2018 16:32
by nihues
Juanjo wrote:
nihues wrote: Is there a diff or something for it? I only need the diff for:

Code: Select all

Group window: Automatic building of groups: Rebuild groups by order lists, visited towns, transported cargo, first engine class and first engine.
Hi. You should look for the commits used for this feature and see how you can make them work with JGR patches. Some commits you can look are:
https://github.com/J0anJosep/OpenTTD/co ... 005dccaf88
https://github.com/J0anJosep/OpenTTD/co ... acb866631a
https://github.com/J0anJosep/OpenTTD/co ... f3639ee3b6
https://github.com/J0anJosep/OpenTTD/co ... 6995fc3b24
You will probably need some other previous commits.
nihues wrote: Also, I did not test more because I could not add a train depot, always show "Can't build train depot here", for smaller or bigger depots...

And, my ships stay at dock and don't move if the option for reserve is On hehe
Can you provide a savegame and how do you trigger these? Next week I have some free time, so I can fix it soon.
Thanks, I'll look at that.

I did not made a save, just started a new game without newgrf.... (but there was the standard trains/rails and ships), i'll try again and make a save, but today got a busy day, i'll see later this week.
I remember that big depot was disabled when started, then found and enabled ingame the option to enable big depot, but same error for both depot types.