zunath / SWLOR_NWN

Star Wars: Legends of the Old Republic server code, a persistent world for Neverwinter Nights
40 stars 98 forks source link

GAME: Space system #21

Closed zunath closed 5 years ago

zunath commented 6 years ago

Add a space system whereby players can purchase or craft a starship, customize its loadout, and enter space.

There should be enemies to fight, activities like mining to perform, and several different places to go.

Combat should involve clicking a creature to set your target. The target should be highlighted on the player's screen. Then, combat proceeds via the use of feats granted on entry into space.

At least one skill should be introduced with this system, along with several different perks.

Mithreas commented 5 years ago

Outline design.

  1. Spaceships. Two new base structure items - Spaceship Dock and Spaceship [technically there will be multiple designs of Spaceship with different recipes, but they will behave the same way except as noted].
    • Spaceship Dock takes 5 CPU and 30 Power. It can dock a spaceship. Ordinary Fabrication recipe.
    • Spaceship takes 0 CPU and 0 Power, but has to be docked on a Dock when it is first placed. Complex recipe involving Fabrication, Engineering and Armorsmithing parts. New base permission (public and individual): Dock Spaceship. Applies to bases only (not buildings or apartments). Allows PCs to dock their spaceship on any open docks. New base permission (individual): Navigate. Applies to starship bases only. Allows the PC to use the navigational computer to fly the ship. Spaceships cannot be picked up once placed. (Docks can).

Spaceships act as area bases, like apartments (but a new base class). They have fuel, strondium and resource bays just like other bases - fuel is used for travel, strondium for attack and defense and resource bays for transport. Different designs of ships have different sizes of bays (and cost different resources to make).

Future enhancement: PCs can put custom items in the resource bay that grant other bonuses (e.g. weapons). This reduces the transport size but increases other capabilities of the ship. Different enhancements take different amounts of space.

Ships have a new Location field in the database. This can be one of a base structure ID (starship dock), in orbit around a planet, or docked at a public dock. If docked at a public dock, rent applies, and the starship will be impounded if the rent runs out. Public spaceports do not have limited capacity.

Starships behave like apartments (with fixture capacity based on the design). They can be a primary residence, but cannot be used for crafting. Note: some starship designs may instead work as workshops not residences.

  1. In your ship All spaceships have a Navigational Computer, which is used for travel. Proficiency at flying is determined by the new Navigation skill (primary: Int, secondary: Wis). Destinations are controlled by star charts; the star charts known to a particular computer are recorded as a bitwise flag in a new database field in the pcBase entry.

Navigational computer options include:

If the PC logs out while the ship is in space, the ship remains in space, and they will log back in to the ship.

  1. Transport jobs.

NPCs on planets can give transport jobs, or can sell goods that will be bought at other planets. These can be legal or illegal. The PC has to own a ship with sufficient resource bay capacity to accept the job. If a job is accepted, the PC pays for the cargo and it's added to the ship they select.
[Note - this means only the owner of a ship can accept a job. Of course, they could share the payout or cost with others].

On docking at a public dock, a customs inspection will happen, and the ship will have anything illegal confiscated and pay a % on any legal goods. The PC landing the ship makes a Navigational skill check against the customs DC of the starport (% based on PC navi/(PC navi + customs DC)). If they succeed, they successfully evade the customs check. Landing at a private dock (i.e. a PC base where you have permission) always evades the customs check.

Speaking to the receiver NPC will empty the ship's resource bay and pay the PC for the goods.

  1. Space events.

Entering orbit, and remaining in orbit each hour, triggers a random encounter check. (If no PCs are on board because they all logged out, no events will happen). Events are implemented using a new ISpaceEvent interface to define the event behaviour. Events include:

A new database table gives the frequency of events happening in the orbit of each planet (so e.g. Viscara may have lots of customs checks thanks to Czerka, but very few asteroids) and the difficulty of the event (used to determine the DCs) - so e.g. Czerka might have frequent low difficulty customs encounters, rare medium difficulty customs encounters and frequent easy salvage encounters.

  1. Ship to ship combat (probably a future enhancement). Each six seconds, both ships make an attack against the other. Feedback is given to all crew on board the ship via ship's computer announcements.

If there is a pilot at the navi computer, then the pilot's navigation score is used as a combat bonus. The navi score from both ships are compared, and the difference applied as a % penalty to attack. For example, if one ship has a navigator with 50 skill and the other has no pilot (0 skill) then the second ship's weapons are resolved as being at 50% strength.

Each attack costs (weapon strength) Strondium to the attacker and (shield strength) Strondium to the defender defender. If the ship does not have enough strondium, its strength is capped by the amount it has (e.g. a 2 str ship with 1 strondium attacks at 1 strength, and loses its last strondium). The attacker's weapon strength (modified by any navigational penalty) is compared to the defender's shield strength. If it is higher, then the defender takes that much hull damage.

If a ship has no shields left, or if it is at <20% hull strength, it can be boarded at will.

Attempting to use the navigational computer to escape combat required a skill check. The pilot skill of both navigators is compared and used to generate a % chance of success based on (skill A/(skill A + skill B)). If the % check is passed, the navigator gets to travel. One check is made each round as part of the combat bonus calculation above, and used for all attempts to travel during those six seconds. The navigator gets feedback on whether they are able to escape that round or not.

If a ship reaches 0 hull strength, it is destroyed, the contents of its resource bay are moved to the attacker's resource bay, all PCs on board are killed, and any other items or furniture on the ship are destroyed.

If a PC logs out before a space battle ends their ship will fight on on autopilot (navigation 0). If their ship is destroyed, they go through death processing when they next log in (with an explanatory message).

  1. Ship stats. Each ship design has the following basic stats, used as described above. Enhancements in the resource bay can modify these stats.
    • Fuel capacity
    • Resource capacity
    • Strondium capacity
    • Hull durability
    • Shield strength
    • Weapon strength
    • Stealth
    • Scanning

Ship hull durability is tracked using the ShieldHP database field in the base. A new Spaceship Repair Kit under Fabrication can be used to repair hull damage (without reducing max hull durability of the ship, since that is inherited from the design).

  1. PC stats. One new skill is introduced - Navigation - with a primary of Int and a secondary of Wis.

Navigation checks are made as % based rolls. The % of success is calculated as (pc Navigation skill)/( (pc Navigation skill) + (DC) ).

Navigation skill XP is gained in each of the following cases.

  1. Implementation notes

For initial implementation, most of the features marked Future Enhancement will not be included. It's expected that we need to create:

Mithreas commented 5 years ago

Space_system_files.zip

Integration required: