Latest Posts

Changes in SeafaringImplementation

Editor Comment

asked a couple of questions


Revision Differences of Revision 10

### Related links ¶

* Forum discussion: <http://wl.widelands.org/forum/topic/503/> ¶
* Launchpad blueprint: <https://blueprints.launchpad.net/widelands/+spec/ships> ¶

## Overview ¶

Seafaring consists of two separate transportation features that are almost entirely separate: ¶

* Rowing boats that are used on "water roads" to transport wares across small rivers ¶
* Ships that can be used to discover, settle, and attack islands (or other parts of a large continent) across the ocean ¶

This blueprint is meant to document design decisions and provide a step by step implementation guideline for these features. ¶

## Stories ¶

Here are some typical use case stories for seafaring. ¶

### Rowboats ¶

* Player notices that her territory is cut by long river-like pieces of water. ¶
* Player builds a shipyard and sets it up to produce rowboats (How?) ¶
* Player builds a flag on the shore of one of the rivers. ¶
* Player clicks on the flag and chooses the "Build water way" button to build a "water road" across the river, just like building a regular road. ¶
* A carrier with a row boat occupies the water way and thereby provides a short-cut across the river ¶

### Sending expeditions ¶

* Player notices that she can build a port near to her headquarters (this is indicated by a buildhelp icon) ¶
* Player builds a port there and a shipyard next to it which is set up to produce ships (How?) ¶
* Player clicks on the port building and then on the "Send Expedition" button ¶
* Some wares and workers (Scout and Food?) get ready inside the port and wait for the ship to be built and arrive ¶
* The expedition starts automatically and sets sail into undiscovered territory ¶
* The expedition ship choose a direction automatically and follows it along a straight line unless a previously undiscovered shoreline is detected; shorelines are followed automatically ¶
* The player can click on the ship to change its direction of exploration to one of the six major directions ¶
* The player receives a notification when the expedition starts and whenever the expedition discovers a port ¶
* The expedition does not stop when a port is discovered; however, ports are clearly marked using an overlay (e.g. an anchor) ¶
* The player stops the expedition by clicking on the ship and pressing the appropriate button; the ship will return any worker (e.g. Scout), but other resources (e.g. Food) may be consumed ¶

### Colonizing an island ¶

* After discovering a place where a port may be built, that spot is clearly marked by an overlay, even when the spot is under Fog of War ¶
* The player decides to attempt to colonize an island by clicking on that overlay and selecting the colonization button in the resulting field action window ¶
* Building materials for a port and a builder are automatically collected in one of the player's ports, and a ship will come to bring them to the anchoring location ¶
* If the spot is occupied by another player when the colonization ship arrives, the attempt is aborted and the ship returns to one of the player's ports ¶
* Otherwise, some area around the port becomes occupied by the player and a construction site for a new port begins ¶
* Meanwhile, the colonization ship is free to do anything else, such as start a new expedition/colonization, or transport wares between existing ports ¶
* Once the new port is built, transportation between it and other existing ports begins automatically as needed ¶

### Attacking another player by sea ¶

This needs to be discussed. A military expedition can be started by clicking on a port location on enemy territory (even when there is no port there), and a ship with soldiers will start moving. It should turn into a military-site-like object once it arrives, able to attack any enemy military sites that lay claim to any of the port fields, but of course the expedition ship can also be attacked by the enemy. ¶

## Implementation Status ¶

The following are already implemented in trunk: ¶

* Shipyard and port buildings (atlanteans only) are implemented but disallowed by default ¶
* Shipyards build ships if they are sufficiently close to water ¶
* Ships transport wares and workers between existing ports ¶

What remains to be done for seafaring (in rough order): ¶

1. Allow map makers to designate locations where ports can be built ¶
2. Add shipyard, port buildings and ships themselves to all tribes ¶
3. (depends on 1) Automatically enable the building of ports (and shipyards that are able to build ships) on maps that allow ports to be built ¶
4. (depends on 1) Implement the overlay that makes port locations outside the player's territory visible ¶
5. Implement expeditions (discovery of islands in fog of war) ¶
6. (depends on 1) Implement colonization ¶
7. (depends on 1) Implement ship-based attacks (to be discussed) ¶
8. Allow configuration of the shipyard to produce ships or rowboats; possibly partly automatic (produce only rowboats when no water is nearby) ¶
9. Implement water ways ¶

Possible additional gimmicks: ¶

1. Allow player to give names to ship ¶
2. Some type of "inventory of ships", where all ships can be shown ¶

## Testing ¶

Play Atlanteans on an appropriate map (e.g. island hopping). You will have to cheat to enable building of port and shipyard. In a debug build, press F6 to bring up the developer console, and use: ¶

> wl.Game().players[1]:allow_buildings{"shipyard", "port"} ¶

> wl.Game().players[1]:place_building("port", wl.Game().map:get_field(123, 78), false, true) ¶

to enable building, and to place a port on an inaccessible island, respectively. ¶

## Questions ¶

Q: Should rowboats be able to transport workers? ¶

* Would be neat ¶
* Might provide quite significant short-cuts in territory expansion - problematic for some maps ¶
* This is counter-intuitive but true: It is actually easier to implement rowboats that can transport workers; having rowboats that can only transport wares creates problems for consistency of the Economy code, because connectivity for wares may be different from connectivity for workers ¶

Q: Should there be different ship types? ¶

* It was suggested that there might be two ship types, medium ships (for expedition, colonizations, and transport of wares, but with low capacity) and big ships (which can be used for any purpose, and which have higher carrying capacity for regular transport) ¶
* This may complicate things needlessly (IMHO -- nha) ¶

Q: I was testing with r6101 and had set up a shipyard close to my border. Then I had some road along the coastline and a small military building. I noticed the shipwright would walk out of my territory and construct the ship outside my borders! Is this intentional or should we have some check to ensure shipwrights don't start building ships outside "their" territory / on enemy land? ¶

Q: I noticed when building ships that if the process went slow, the ship would "decay" or in other words drop back to the previous step of construction (at least the visuals, I am not sure whether the percentage was affected). To some extent it makes sense that it will rot if it is left alone for too long, but is this intentional? ¶