Latest Posts

Changes in SeafaringImplementation

Revision Differences of Revision 19

### 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. ¶

## Graphics Development ¶

Each tribe requires graphics/animation for a: Ship, Shipyard, Shipwright, Ship Construction and Port. ¶

### Ship ¶

This is the completed ship in the water and ready to sail to parts unknown (or known). ;) At this time, only one large ship style is needed for each tribe. ¶

* Graphic Size = ~222x150 (WxH) ¶
* Animation: __idle__, __sail__ (up to 40 frames each for realistic movement in water) ¶

### Shipyard ¶

This is the building that houses the shipwright and his supplies. ¶

* Size = medium ¶
* Graphic Size = ~100x88 ¶
* Animation: __build__, __idle__, __work__ (and/or __worker away__) ¶

### Shipwright ¶

This, of course, is the worker who builds the ships. ¶

* Graphic Size = ~26x35 ¶
* Animation: __idle__(work), __walk__, __walkload__ ¶

### Ship Construction ¶

This is the site where the ships will be constructed. It will be located near to the Shipyard and shows the ship on land as it is being built in stages. ¶

* Size = small ¶
* Graphic Size = ~222x150 ¶
* Animation: __build__ (up to 8 frames) ¶

### Port ¶

This is the building from and to which the ship(s) will travel. It accommodates the wares that will be transported. ¶

* Size = port ¶
* Graphic Size = ~100x88 ¶
* Animation: __idle__, __work__ (optional) ¶

## Implementation Status ¶

The following parts are already implemented in trunk: ¶

* Shipyard and port buildings are implemented ¶
* Shipyards build ships if they are sufficiently close to water and if the map is a seafaring map (at least 2 port buildspaces) ¶
* Ships transport wares and workers between existing ports ¶
* Map makers can designate locations where ports can be built ¶
* Seafaring maps of Settlers 2 can be loaded. ¶
* Atlantean tribe graphics are complete with the exception of the Port and some tweaking of the ship's animation loops ¶
* Development of the Barbarian tribe ship is in progress ¶

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

1. Implement the overlay that makes port locations outside the player's territory visible ¶
2. Implement expeditions (discovery of islands in fog of war) ¶
3. Implement colonization ¶
4. Implement ship-based attacks (to be discussed) ¶
5. Allow configuration of the shipyard to produce ships or rowboats; possibly partly automatic (shipyards already do not produce rowboats if no water is nearby or if the map is not a seafaring map) ¶
6. Implement water ways ¶
7. Graphics are needed for the remaining Barbarian and Empire objects which currently have place-holders ¶

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 "MP Scenarios / Together we're strong" as scenario in **multiplayer** mode. ¶

## 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? ¶

* None of the workers regard territory boundaries (hunter, fisher, lumberjack, etc. all venture outside the borders of your territory), so this is consistent. ¶
* However, no thought went into this. In conjunction with the point below about reclaiming ship construction sites, it may make sense to change that behavior. ¶

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? ¶

* This was added intentionally. Ship construction sites are immovables and they block the space they occupy, and you cannot build over them. Like farm fields, if you conquer enemy territory that contains a ship construction site, you should be able to reclaim the space somehow. ¶
* There may be a better way to allow victorious players to reclaim the space occupied by ship construction sites, but it must be possible to reclaim the space somehow. ¶

Q: Should players be able to influence whether transportation for wares is done by ship or by carrier? ¶
The game logic often decides to do both, which can easily block trtaffic on the roads. ¶
Seen with an attempt to relocate wares for building construction to a new port by means of "store preferred".