autonav: Remove the feature

The autonavigation feature has issues:

* Autonavigation orders are executed at the update.  Crafty players
  can use them to get around the update window.

* Usability is poor:

  - The order command is overly complex, not least because it can do
    five different things: clear, suspend, resume, declare route, set
    cargo levels.

  - Unlike every other command involving movement, order does not let
    you specify routes, only destination sectors.

  - Setting cargo levels can silently swap start and end point of a
    circular route, because "this keeps the load_it() procedure
    happy".  Maybe it does, but it surely keeps players confused.

  - Setting "start" cargo levels actually sets the "end" levels, and
    vice versa.  Has always been broken that way.

  - Predicting what exactly autonavigation will do at the update isn't
    easy.

* The info pages documenting it amount to almost 400 non-blank lines
  formatted.  They claim only merchant ships can be given orders.
  This is wrong.  Unlikely to be the only error.

* Few players use it, and its workings at the update a fairly opaque.
  Makes it a nice hidey-hole for bugs.  Here are two:

  - Unlike the scuttle command, autonavigation happily scuttles trade
    ships while they're on the trading block.

  - Unlike the load command, autonavigation can load in friendly and
    allied sectors.

* It's more than 700 lines of rather crufty code nobody wants to
  touch.  Thanks to a big effort in Empire 2, it shares code with the
  navigation command.  It still duplicates load code.  The sharing
  complicates fixing the bugs demonstrated by navi-march-test.

Reviewing, fixing and testing this mess isn't worth the opportunity
cost.  Remove it instead.  Drop commands order, qorder and sorder.
Drop ship selectors xstart, xend, ystart, yend, cargostart, cargoend,
amtstart, amtend, autonav.

xdump ship sheds almost half its columns.  struct shpstr shrinks, on
my system from 200 to 160 bytes.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2014-12-24 16:33:51 +01:00
parent a4e519c377
commit 48e656c057
37 changed files with 306 additions and 1764 deletions

View file

@ -1,87 +0,0 @@
.TH Concept Autofish
.NA Autofish "How to exploit resources at sea automatically"
.LV Expert
Fishing boats and oil derricks let you exploit sea resources.
Navigating them back and forth between harbor and fishery / offshore
oil field is rather tedious. Autonavigation lets you automate this.
.s1
It is more commonly used for fishing boats than for oil derricks,
because oil fields are commonly configured to deplete quickly, and are
often too far from harbors for the slow oil derricks to make
autonavigation effective.
.s1
This is an example of how to set up a fleet of fishing boats
so they will take their food produced each update and drop it off
at the harbor of your choice. Oil derricks work exactly the same.
.s1
See info \*Qorder\*U for a complete description and example of
syntax for the \*Qorder\*U command.
.s1
.NF
map #1
00000000001111111
01234567890123456
-4. . . . . . . . .
-3 ? ? . . . . . .
-2? . . . . . . ) .
-1 ? . . . . . f . .
0. . . . . g m . .
1 . . . . f * w h .
2. . . . . c + + .
.s1
You have ships 0,12 and 88 in the harbor at 15,1.
Sector 16,0 has a very good fert of 93 so you want to use that
as your fishing grounds.
.s1
1) move your ships to sector 16,0
"nav 0/12/88 16,0"
2a) set up autonav using the 'order' command.
"order 0 des 15,1 16,0"
This will establish a circular trade route.
2b) set up food levels for the ship
"order 0 level 1 start food 30"
"order 0 level 1 end food 30"
You can also use a global '*' or a fleet letter here.
"order * level 1 start food 30"
"order * level 1 end food 30"
"order F level 1 start food 30"
"order F level 1 end food 30"
NOTE: You should set BOTH start and end fields to insure
autofish will work correctly and set them at the
same levels!
NOTE: Fishing boats and oil derricks are a special case
to the autonav code. This setup will only work
correctly with them. If you want to use autonav
with cargo ships please use the examples found in
the \*Qorder\*U command.
repeat 2a,2b for other ships in the area.
.FI
.s1
During the update your fishing boats will now move to the harbor at
15,1 unload food until it reaches 30, then move back to 15,1 and STOP.
So unless the ship gets sunk, or something happens to it, like the
civs starve on board if you don't leave enough food on it,
the ships will continue to feed your country and you won't even need
to think about them.
.s1
For oil derricks, step 2b becomes:
.nf
"order 0 level 1 start food 30"
"order 1 level 2 end oil 1"
Note: If food is not required, food cargo levels can be zeroed.
Note: In this configuration, the end oil level is not important
as it is not used.
.fi
.s1
If your ship can't be unloaded because the the harbor is overcrowded,
it will continue along its route.
.SA "Autonav, order, navigate, Ships, Populace, Updates"

View file

@ -1,51 +0,0 @@
.TH Concept Autonavigation
.NA Autonav "Giving ships automatic sailing orders"
.LV Expert
In a very short while after acquiring ships the effort of moving ships after
every update gets very boring. And the more ships you have, the more work
it is. Hence the concept of autonavigation. Like any self-respecting
dictator, you don't personally drive your ships around (except when you want
to), instead you command you ship captains to take their vessels to a
specified destination. This is done via the \*Qorder\*U command.
.s1
Each ship can be ordered to proceed to a destination. During each update,
the ship will try and use ALL the mobility it has and use the shortest
possible path. It will also avoid any known mines (sectors marked
with an 'X' or 'x' on your bmap). Note that this movement is all
done before mobility is accumulated, so that after the update is
complete the ship will have a full updates worth of mobility
in case you need to move it by hand. Should a ship be fired upon
by forts or strike a mine they will stop moving! This will prevent
your ship from foolishly getting sunk in enemy waters. The
\*Qorder\*U command covers many special cases.
.s1
The autonavigation capability is dependent upon the per country map database
accessed via the \*Qbmap\*U command. If you order a vessel to a destination
that causes it to cross a previously unexplored area, the ship will attempt
to cross that area as if it were water. One of the features of the bmap
functionality is that when a ship is navigated, it automatically uses its
radar to see the local sectors (much like real life). This sector information
is added to the per country map database. Thus upon running into a previously
unknown obstruction, that information is added to the map database and on the
next update, a new path to the destination will be calculated which avoids
the obstruction. This process applied iteratively means that a ships will
eventually find its way around any obstruction, provided that a path exists.
In reality, this is a limit to this process. In order to limit the processing
that is done to find a path to the destination, the internal path string is
limited to 28 characters.
.s1
Autonavigation also supports autotrading.
By specifying two destinations and two commodities,
the ship will move back and forth between the two destination loading and
unloading the appropriate commodities.
Specific examples can be found in info \*Qorder\*U.
.s1
Autonavigation also supports automatic resource production at sea.
See info \*QAutofish\*U for details.
.s1
The same rules for navigating, loading, and unloading apply for
Autonavigation as they do when you do these things by hand, namely
that you may only use harbours owned by nations which consider you to
be a friendly trading partner (see info \*Qrelations\*U).
.s1
.SA "navigate, order, Ships, Updates, Autofish"

View file

@ -125,7 +125,6 @@ number of planes the ship is carrying
number of xlight planes the ship is carrying
.L nchoppers
number of helicopters the ship is carrying
.L autonav
.in
.s1
Plane:

View file

@ -72,21 +72,4 @@ get some bad publicity in the news) Payoff is still based on the distance from
the harbor where the trade ship was built, not the sector in which it was
captured.
.s1
You can also use the "order" command to set up automated trading routes with
trade ships and have them navigate and automatically scuttle themselves when
they reach their destination. See "info order" for more information on this,
but basically you can do things like this:
.NF
Step 1) Make a harbor
Step 2) Get cms distributed/delivered to your harbor each update.
Step 3) Find a destination harbor to sail to
Step 4) build tradeships in the harbor each update
Step 5) load civs and food on the trade ships each update.
Step 6) order the trade ships to sail and autoscuttle in the dest harbor.
.FI
.s1
You can then just repeat steps 4, 5, and 6 each update, and never worry
about your trade ships again. Unless someone starts intercepting them,
that is...
.s1
.SA "payoff, order, Ship-types, scuttle, Ships"
.SA "payoff, Ship-types, scuttle, Ships"

View file

@ -39,7 +39,6 @@ This document gives a rough order of events during the update.
g) then make things
f) ship building
stopped ships are started, but not built (see info stop)
ships execute their orders right after building
finally, if option SAIL is enabled, follow sail paths
g) plane building
stopped planes are started, but not built (see info stop)

View file

@ -31,8 +31,7 @@ That's the price you pay for having automatic defenses.
.s1
.L "IMPORTANT NOTES"
.s1
Missions can occur during updates. (Interdicting ships using "sail"
or "order").
Missions can occur during updates. (Interdicting ships using "sail").
.s1
Artillery units less than 40% efficient will not fire.
.s1

View file

@ -148,4 +148,4 @@ all the ships in the fleet which are in the same sector.
While navigating, you cannot enter a sector that belongs to another
country unless they have FRIENDLY relations with you. This includes bridges, and harbors.
.s1
.SA "mine, Ship-types, mission, order, sail, Ships, Transportation, Moving"
.SA "mine, Ship-types, mission, sail, Ships, Transportation, Moving"

View file

@ -1,160 +0,0 @@
.TH Command ORDER
.NA order "Order a ship to auto-navigate"
.LV Expert
.SY "order <SHIP/FLEET> [c|r|s|d|l]
You use the \*Qorder\*U command to give sailing orders to ships.
At each update, ships sailing under orders \*Qautonavigate\*U toward a
specific destination sector. Telegrams notify you of arrivals.
.s1
ONLY merchant ship may be given orders, but in order to move during the
update a ship must have at least one crew (which may be civilian or military,
but not an uncompensated worker). Merchant ships are those that
have 0 for their firing range and gun limit values.
.s1
Note that your ships sailing on orders will be interdicted just as if
you were navigating them by hand.
.s1
.EX order <SHIP/FLEET> c Clear Orders
.s1
Use the clear option to wipe out any orders the ship
currently has. This will remove all starting and ending
points and clear all the cargo levels for the ship.
.s1
.EX order <SHIP/FLEET> s Suspend Orders
.s1
If you want to keep orders but don't want the ship
to move during the update use the suspend option.
A quick look at \*Qsorder\*U
will display the eta time as suspended.
As long as a ship is suspended it will be unable to move
during the update.
.s1
.EX order <SHIP/FLEET> r Resume Orders
Resume will allow ships that have a suspended order to move
again.
.s1
.EX order <SHIP/FLEET> d <dest1> [dest2|scuttle|-] Declare Orders
.s1
To declare an order you have 3 options.
.NF
1) Order a ship to any sector on the map.
When it arrives it will clear its orders.
2) Order a ship to any sector, load goods,
move to a second sector and unload goods.
Continue to loop between the 2 points.
3) Order a ship to any sector on the map.
When it arrives, it will scuttle itself if it is in a harbor that
is at least 2% efficient. This is useful for tradeships.
Example: You have a cargo ship (#6) in your harbor at sector 6,0
You want to move good between that harbor and another harbor at
sector 14,0.
order 6 d 6,0 14,0
This reads:
Cargo Ship #6, move to sector 6,0 load goods, sail to sector 14,0
unload cargo then load again and sail back to 6,0.
Example: You have a tradeship (#666) at sea in sector -10,0 and you
want to move it to a friendly harbor at 20,4.
order 666 d 20,4 -
The ship will now move to sector 20,4 with the most efficient path.
Example: You have a tradeship (#666) at sea in sector -10,0 and you
want to move it to a friendly harbor at 20,4, and then scuttle itself.
order 666 d 20,4 scuttle
The ship will now move to sector 20,4 with the most efficient path,
and scuttle itself when done.
Note that only trade ships can be given auto-scuttle orders, and won't
scuttle themselves at sea.
.FI
.s1
.EX order <SHIP/FLEET> l <hold> <start/end> <COMM> <amount>
.s1
Set cargo Levels.
.NF
Example: Cargo ship #109 is at your harbor in sector 10,0.
You have agreed to trade 200 lcm and 100 hcm to your friend and
he will give you 100 shells each update. His harbor is at -10,2.
Using 'order declare' you set up your start point 10,0 and end point -10,2
order 109 l 1 start lcm 200
order 109 l 2 start hcm 100
order 109 l 1 end shell 100
When your finished the output would look like this.
sorder 109
shp # type x,y start end len eta
109 cargo ship 2 10,0 10,0 -10,2 11 1
qorder 109
shp # type [Starting] (Ending)
109 cargo ship 2 [1-l:200 2-h:100 ] , (1-s:100 )
.FI
.s1
AutoNav Features.
.s1
Whenever a ship is autoloading cargo, it will always wait until it loads
to capacity. If a ship does not load fully it will not move!!!
Remember 'ships need food!!' unless the NOFOOD option is enabled.
Set one of your cargo holds to load food or your ship will starve at sea.
When unloading cargo, the ship will unload all goods
listed in the cargo holds ONLY! It will not unload any extra good
manually placed on the ship.
.s1
If you are dealing with civilians 1 will be left in either the
sector or the harbor depending if your loading or unloading.
In either case when you arrive at the other harbor all but 1 civ
will be dumped into the harbor. Be careful if you set civilians
as one of your cargo levels.
.s1
You can set any commodity in the game to be loaded on the ship.
However if you tell a ship to load a commodity it can not hold it
will be ignored. Example: If you tell a battleship to load
Lcm, and of course it does not have that capability, see 'show ship
capability' that level will be ignored at the update.
Planes and Units are not commodities so they can not be loaded this way.
.s1
At update time, the most direct path from the ship to destination
is calculated. Each ship is then autonavigated along that path to
the best of its mobility. The path is calculated from what the player
knows of the world (what you can see using the \*Qbmap\*U command).
Open sea, bridges, harbors, and unexplored regions of the world
are considered to be navigable. Your friend's harbors and bridges
may be uses as long as the harbor >= 2% and the bridge >= 60%.
Your ships will also try to avoid any mines you have declared on your
bmap. 'x' or 'X' characters. Should your ship hit a mine the ship
will stop moving and its orders suspended. You bmap will also be updated
with a 'x' marking the sector for you.
.s1
If a ship sails in range of enemy forts they will be fired upon.
Setting your ship to autonavigate into an area with good fort
cover could result in many ships getting sunk fast.
However you could put an invasion fleet off someone's coast in a hurry.
.s1
If the ship has a 'sweep' flag
ships will try and sweep any mines if any are present as they move.
.s1
Radar operates continuously as the ship moves along the path, constantly
adding sector information to the known world map.
.s1
The autonav code will try and use as much mobility as possible and this
is all done before mobility is gained from the update.
After an update has completed
your ship will have mobility so it can be moved by hand if needed.
.s1
Ships with capability fish or oil can be setup to \*Qload\*U
from the sea sector.
See info \*QAutofish\*U for details.
.s1
.SA "sorder, qorder, bmap, navigate, ship, Autofish, Autonav, Ships"

View file

@ -1,27 +0,0 @@
.TH Command QORDER
.NA qorder "Query the auto-navigation orders of a ship"
.LV Expert
.SY "qorder <SHIP/FLEET>"
.s1
\*Qqorder\*U shows current commodity levels on a ship.
Ships with no orders are not listed.
The report indicates:
.NF
shp# ship number
ship type type of ship (cargo ship, destroyer, etc)
Starting The first sector to move and cargo hold levels.
Ending The destination sector to and cargo hold levels.
shp# ship type [Starting] , (Ending)
6 cargo ship 1 [1-s:50 2-l:500] , ( 1-g:50 )
54 cargo ship 1 [ ] , (1-h:1000)
1003 destroyer 2 [1-s:40] , ( )
.FI
This report reads.
Cargo Ship #6 will sail to its starting sector, displayed
in the sorder, and load cargo hold 1 with 50 shells and cargo hold 2 with 500
light construction materials. Then sail to the ending sector, again
displayed in the sorder command, unload the cargo and load cargo hold
1 with 50 guns.
.s1
.SA "order, sorder, bmap, navigate, ship, Ships, Autonav, Autofish"

View file

@ -46,7 +46,7 @@ for the ships specified to be removed.
.s1
The PATH is a normal empire path specification. You may *not* give a
destination sector on the command line, or at any time while giving
the route. Use the \*Qorder\*U command if you wish this functionality.
the route.
.s1
When getting a path interactively, empire will show you the information
you have (from your bmap) concerning the current area, to help you plot

View file

@ -1,35 +0,0 @@
.TH Command SORDER
.NA sorder "Show ship order statistical information"
.LV Expert
.SY "sorder <SHIP/FLEET>"
.s1
\*Qsorder\*U shows some statistical information on ships that
have been given orders.
The report indicates:
.NF
shp# ship number.
ship type type of ship (cargo ship, destroyer, etc)
x,y ships current position
start The first destination for the ship.
end The second destination for the ship.
len The number of sector required to get from its
current position to the start sector.
eta The estimated number of updates required to
reach the start sector.
shp # ship type x,y start end len eta
#6 cargo ship 1 6,0 2,0 20,0 2 1
#10 destroyer 1 -10,0 20,2 17 2
.FI
This report reads:
Cargo ship #6 is currently at sector 6,0 and has orders to sail to
sector 2,0. It will arrive and load any cargo set for that ship,
see qorder, and then sail to sector 20,0. It currently needs to
sail 2 sectors and will arrive in 1 update at sector 2,0.
Destroyer 1 is at sector -10,0 and only has orders to sail to sector
20,2. It needs to move 17 sectors and will arrive at 20,2 in 2 updates.
When it arrives order will be cleared since only one destination
order was given to it.
.s1
.SA "order, qorder, bmap, navigate, ship, Ships, Autonav, Autofish"

View file

@ -54,7 +54,6 @@ Max interdiction range 8 8 -- 8
The maximum amount of mobility used for land unit combat is 5.00.
Ships on autonavigation may use 6 cargo holds per ship.
Fire ranges are scaled by 1.00.
Flak damage is scaled by 1.75.
Torpedo damage is 2d40+38.