-
Notifications
You must be signed in to change notification settings - Fork 100
Description
Requirements for each unit type to reach feature completeness. Each check box can be seen as a single task. Some tasks are compounds of a more comprehensive logic and may depend on each other. The descriptions contain pseudo code to give an idea on possibly relevant data to be implemented code-wise.
If a task involves interaction with another unit, the kind or subset of units is explicitly specified in there. In case it is not obvious, see the definition part below.
Balancing aspects like explicit values for ranges etc. are deliberately omitted to keep focus on the actual mechanics.
Definition:
- Unit: Any moveable unit
- Land unit: Any unit on land
- Land troop: Military land unit
- Ship: Any amphibic unit
Feel free to share your thoughts and add suggestions or point out edge cases to be taken into account.
Unit behavior to be implemented
General behavior for all units
- Move in a route within an A* grid.
- Mark/Unmark
occupied_tiles
= prevent units overlapping with each other. - Push forcefully idling units away if path blocking (especially relevant when trying to reach a warehouse in a tight spot).
- Always push own and non-hostile units.
- Never push hostile units.
Player-controlled land units
Land merchant
- Destroy itself if
health == 0
.
User actions
- Moving as a single unit: Just move to the destination point.
- Trade/Exchange: Trade or exchange cargo with a non-hostile
warehouse_in_range
. - Trade route: to be determined
Melee unit
- work in progress, to be determined
Ranged unit
- work in progress, to be determined
Player-controlled ships
Huker (transport ship)
- Moving as a single unit: Just move to the destination point.
- Moving as a group of units: Take an appropriate group formation.
- Switch the group formation accordingly to the user choice.
- Have a stance of
defensive
|offensive
. Defensive = Hold position when attacked. Offensive = Chase opponent to a certain extent and return to original position. - Destroy itself if
health == 0
.
User actions
- Trade/Exchange: Trade or exchange cargo with a non-hostile
warehouse_in_range
. - Trade route: to be determined
- Attack action: Stand and shoot after each
cooldown
timeout whenhostile_target.is_in_range()
, make the target (Ship
|LandUnit
|Building
) take damage. - Escort/Follow action: Protect the selected unit, attack anyone who attacks it. If several units are escorting, make it take a reasonable group formation around it.
- Move by waypoints: Avoid dangers by going a specifically defined route.
- Patrol action: Put two or more waypoints to visit repeatedly.
- Sell ship: Sell ship for a fixed price.
- Self-destruction: Destroy unit.
Frigate (military ship)
Currently identical to Huker. The main differences lie in the values for storage_slots
/ storage_capacity
and amount_of_cannons
, which are not discussed here.
- Moving as a single unit: Just move to the destination point.
- Moving as a group of units: Take an appropriate group formation.
- Switch the group formation accordingly to the user choice.
- Have a stance of
defensive
|offensive
. Defensive = Hold position when attacked. Offensive = Chase opponent to a certain extent and return to original position. - Destroy itself if
health == 0
.
User actions
- Trade/Exchange: Trade or exchange cargo with a non-hostile
warehouse_in_range
. - Trade route: to be determined
- Attack action: Stand and shoot after each
cooldown
timeout whenhostile_target.is_in_range()
, make the target (Ship
|LandUnit
|Building
) take damage. - Escort/Follow action: Protect the selected unit, attack anyone who attacks it. If several units are escorting, make it take a reasonable group formation around it.
- Move by waypoints: Avoid dangers by going a specifically defined route.
- Patrol action: Put two or more waypoints to visit repeatedly.
- Sell ship: Sell ship for a fixed price.
- Self-destruction: Destroy unit.
Player NPC ships
Fisher
- Move within a certain circular area to a random water tile after
required_steps
and start fishing, increase resource +1 perinterval
timeout until max ofstorage_capacity
has reached. - Don't sail off if
hostile_unit.is_in_range()
. - If being in sea already, cancel fishing and return home with
current_storage
so far. - Send feedback to its
owner
(fisher building) regarding the reason of return (storage_full
,in_danger
, ...). - If the
owner
(fisher building) gets destroyed, destroy itself as well.
Neutral NPC ships
Free Trader
- Appear for the first time at a random edge of the map border once a warehouse exists.
- Create a linked list of available
trade_posts
from the closest to farthest warehouse and start a new trading journey to sail for those harbours until everyone has been visited and the journey ends. New warehouses built in the midst of a running session will be added in the next run. - Navigate to the next warehouse in
trade_posts
. - Process trade transactions.
- If
trade_posts
contains another element, rinse and repeat. - Leave the map at the closest map edge.
- After an
interval
of "being abroad", return to the map at a random edge tile and create a new trading journey as described above.
Hostile NPC ships
Pirate
- Has a relationship of
hostile
|neutral
, ranging from0.0
-2.0
.- 0 - 1 hostile - attack if
hostile_unit.is_in_range()
- 1 - 2 neutral - don't initiate attack
- 0 - 1 hostile - attack if
- Can be bribed to reduce relationship to rivalising faction, with a random chance for the affected faction to find out about the briber and damage their mutual relationship.
- Regularly patrol over
waypoints
, randomly created within a subset of the entire GridMap. The subset consists of all GridMap tiles with an appropriate distance to civilized area (settled islands and player territory in general). That said, the more the player expands, the farther the pirate has to retreat to stay in "calm waters". - Irregularly patrol over specific
hotspots
. Those spots are determined based on where general ship movement has been most frequent recently. Each tile on the map has aweight_of_interest
which becomes "hotter" the more often it is passed by a ship and "cools down" the longer any activity is absent. - If
hostile_unit.is_in_range()
, attack. - If falls below
minimum_health_threshold
, retreat. - Destroy itself if
health == 0
.