Currently Online

Latest Posts

Topic: Ferries

kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2433
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2018-07-25, 18:22

We shouldn't make it too complicated...

  • A new building "Ferry maker" produces a boat.
  • A boat is a ware like any other ware
  • Boats are stored in a warehouse
  • If a ferry route is established, a carrier grabs a boat from the warehouse and walks with it to the established ferry route
  • If the ferry route get destroyed, the carrier grabs his boat and walks to the nearest warehouse (or walks around until he may die)

GunChleoc wrote:

  1. Place a flag-sized ferry stop, go into "ferry route building mode" similar to road building mode, then have a radius where the second stop can be placed, or an existing stop be linked. A route will be created.

The normal flag action window can get an addtional button "Build ferry route" if the flag is on the border of water. Clicking it shows then the radius as you mentioned.

  1. Do we want to have a UI associated with the ferry stop, to choose which wares will be transported?

From my understanding a ferry acts just like a carrier. It is just like creating a road over water. So it should be part of the normal transportation system and shouldn't need any extras, imho.


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
Nordfriese
Avatar
Topic Opener
Joined: 2017-01-17, 18:07
Posts: 1929
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2018-07-25, 19:47

Started to implement this earlier. The compiler is running now, and hopefully I´ll have screenshots and a branch to show soon face-smile.png

I pulled most code from Road into a new class RoadBase and made Road and Waterway children of RoadBase. Only road-specific code (like road promotion stuff) is left to the subclass.

Waterways can be built exactly like roads (I mostly copy-pasted here), except that the option to build one appears only on flags with MOVECAPS_SWIM. Flags cannot be built in places where there is a waterway. I didn´t do the length restriction yet.

The pathfinder for workers ignores waterways, so walkers can´t walk over water. The current implementation might cause a bug if two flags are connected by a waterway and a long, unsplit road; but I guess no player will build a road like that, so it shouldn´t matter, right?

The ferry´s special pathfinding settings are not implemented yet.
It is implemented as a subclass of Carrier. I didn´t get around to scripting the producing buildings and writing the related code yet.
Ferries can only move over water, never over land or into buildings (much like ships). When delivering a ware to a building, they drop it on the flag and the worker has to come out and fetch it. Any suggestions how to store idle ferries without letting them enter unswimmable land are welcome…


Top Quote
Nordfriese
Avatar
Topic Opener
Joined: 2017-01-17, 18:07
Posts: 1929
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2018-07-25, 20:45

Quick question to someone who knows logic/roadtype.h:

enum RoadType {
    kNone = 0,
    kNormal = 1,
    kBusy = 2,
    kWaterway = ???,
    kWater = 3,
    kMask = 3,

    kEast = 0,  //  shift values
    kSouthEast = 2,
    kSouthWest = 4,
};

What value should I assign to the new constant kWaterway which I add here? Do I need to change kMask?


Top Quote
fuchur

Joined: 2009-10-07, 14:01
Posts: 186
Ranking
Widelands-Forum-Junkie
Location: Germany
Posted at: 2018-07-25, 20:54

GunChleoc wrote:

  1. Do we want to have a UI associated with the ferry stop, to choose which wares will be transported?

I don't think that's necessary. I unterstand ferries more similiar to a normal carrier. The only difference is that the transport goes by waterways.

We could also make ferry stops small buildings, which employ a ferryman who will first build a ferry and then start shipping?

That would restrict ferry stops to places where you could build a building at the coast.

Nordfriese wrote:

Any suggestions how to store idle ferries without letting them enter unswimmable land are welcome…

How about letting it swim in distance 1 away from one end of the waterway? Or just in the middle of it? When a ware arrives at one flag then the ferry rows there and takes the ware.


Top Quote
Nordfriese
Avatar
Topic Opener
Joined: 2017-01-17, 18:07
Posts: 1929
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2018-07-25, 21:11

fuchur wrote:

Nordfriese wrote:

Any suggestions how to store idle ferries without letting them enter unswimmable land are welcome…

How about letting it swim in distance 1 away from one end of the waterway? Or just in the middle of it? When a ware arrives at one flag then the ferry rows there and takes the ware.

Sorry, I phrased the question wrong. A ferry that is assigned to a waterway but not shipping anything will wait in the middle of the waterway, just as an idle carrier stands in the middle of his road. What I meant is: When the waterway is destroyed, where should its ferry go until it is reassigned to another waterway?


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2646
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2018-07-25, 22:24

Nordfriese wrote:

fuchur wrote:

Nordfriese wrote:

Any suggestions how to store idle ferries without letting them enter unswimmable land are welcome…

How about letting it swim in distance 1 away from one end of the waterway? Or just in the middle of it? When a ware arrives at one flag then the ferry rows there and takes the ware.

Sorry, I phrased the question wrong. A ferry that is assigned to a waterway but not shipping anything will wait in the middle of the waterway, just as an idle carrier stands in the middle of his road. What I meant is: When the waterway is destroyed, where should its ferry go until it is reassigned to another waterway?

Depends on the cost.
Just had an idea.
What if the ferries would be more like rafts? so let's say they cost 2 or 3 logs to build for each tribe. So if a waterway is build we could send a carrier to the starting flag and the amount of logs should be routed to this flag as well. after all logs have arrived at the flag the carrier turns into a ferryman and assembles the raft. So we won't need a special building to produce the ferries. If the watwerway is destroyed the raft is either dismanteled and the logs put on the one of the end flags of the waterway (if at least one of them still exists) or abandoned if no flag is existent anymore.
Just don't know whether this is feasible in the current design.


Top Quote
ypopezios
Avatar
Joined: 2018-04-20, 00:22
Posts: 220
Ranking
Widelands-Forum-Junkie
Posted at: 2018-07-26, 11:25

-1 for assembling rafts on the spot, because it breaks the game's consistency. I prefer kaputtnik's approach.

Also the length restriction seems wrong to me. A clearer solution would be to limit ferries to shallow waters and ships to deep waters. That design is well-tested in many strategy games.

Later we could even get rid of the special port-space concept, by allowing ports on any big building-space with deep-enough water nearby. Map-designers will have fine control of a map's possibilities by simply adjusting the depths. And also players will have an easier time guessing potential port spaces.


Top Quote
Nordfriese
Avatar
Topic Opener
Joined: 2017-01-17, 18:07
Posts: 1929
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2018-07-26, 12:49

First tests will be delayed a bit, I´m still chasing Road dependencies through the entire codebase. They seem to be used everywhere, except where I look for them face-upset.png

Rafts would be difficult to implement, and as ypopezios said, the concept doesn´t quite fit to Widelands. Also, the logs would clutter up the flag for some time, and having a Carrier assemble something on a flag and then turn into a Ferry could also be tricky.

Also the length restriction seems wrong to me. A clearer solution would be to limit ferries to shallow waters and ships to deep waters. That design is well-tested in many strategy games.

Widelands doesn´t have shallow and deep water yet, and this isn´t a trivial change. So this is something that can be considered in the future, but for now, I´ll stick with a tribe-specific length limit.


Top Quote
einstein13
Avatar
Joined: 2013-07-29, 00:01
Posts: 1118
Ranking
One Elder of Players
Location: Poland
Posted at: 2018-07-26, 15:47

I don't like limit of 4 for Empire. It is enough for 2 out of 3 cases (from my experience).

Also I don't like limiting flag to have only one ferry-route. That will directly say that you can't build bypasses near coast for a heavy traffic.

I remember that my first The Nile map contained tiny islands near starting positions #1 and #2. Those islands were designed to be used as "ferry bridge" (from one shore to the another). In old Settlers II I used that trick many times. Limiting the distance for ferries are ok, but from my point of view, it should be greater than 4 units. Even 5 will be better than nothing face-smile.png .

And about my idea of moving builder - as it was told, it can damage some map designs. So I am against this idea now. That means you have to use a ship to build a port somewhere, even if you have this place in range of military building.


einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/
backup website files: http://kartezjusz.ddns.net/upload/widelands/

Top Quote
Nordfriese
Avatar
Topic Opener
Joined: 2017-01-17, 18:07
Posts: 1929
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2018-07-26, 16:36

The reason why I want a restriction of one waterway per flag is that it´ll damage some maps less. If the map intends there to be a bottleneck somewhere, ferries break the design. That´s why I want to give them an additional disadvantage for such cases, and that is by forcing players to build at least one road between waterways, so they either have to use very long waterways (slow) or many short waterways (with roads between, which is diffcult in such situations).

Length restrictions can be easily changed, the values 8/6/4 were only a first suggestion. Perhaps something like emp-6, bar-7, atl+fri-8 ?

The branch is almost ready for first tests with waterways face-smile.png I´m still waiting to see if my latest change (compiling now) fixes a problem with road/waterway texture rendering; if not, I´ll likely have to do some complicated changes to the whole road-rendering code...
When that´s done, I´ll finally start with the actual ferries face-smile.png


Top Quote