Commit graph

10 commits

Author SHA1 Message Date
Jakob Gillich 407429ee21 Networking
The game uses a UDP-based protocol. Unlike TCP, UDP does not guarantee that
packets arrive, or that they arrive in the correct order. For this reason,
the game protocol implements those features using the following:

* All packets have a sequence number that is utilized for reordering
* Important packets are wrapped in a SlottedMetaPacket with a subslot number
* RelatedA packets ae used to request lost packets using the subslot number
* RelatedB packets are used to confirm received SlottedMetaPackets

All of these go both ways, server <-> client. We used to only partially
implement these features: Outgoing packet bundles used SMPs and could be
resent, but not all packets were bundled and there was no logic for requesting
lost packets from the client and there was no packet reordering, which resulted
in dire consequences in the case of packet loss (zoning failures, crashes and many
other odd bugs). This patch addresses all of these issues.

* Packet bundling: Packets are now automatically bundled and sent as
  SlottedMetaPackets using a recurring timer. All manual bundling functionality
  was removed.

* Packet reordering: Incoming packets, if received out of order, are stashed and
  reordered. The maximum wait time for reordering is 20ms.

* Packet requesting: Missing SlottedMetaPackets are requested from the client.

* PacketCoding refactor: Dropped confusing packet container types. Fixes #5.

* Crypto rewrite: PSCrypto is based on a ancient buggy version of cryptopp.
  Updating to a current version was not possible because it removed the
  MD5-MAC algorithm. For more details, see Md5Mac.scala.
  This patch replaces PSCrypto with native Scala code.

* Added two new actors:
  * SocketActor: A simple typed UDP socket actor
  * MiddlewareActor: The old session pipeline greatly simplified into a
    typed actor that does most of the things mentioned above.

* Begun work on a headless client

* Fixed anniversary gun breaking stamina regen

* Resolved a few sentry errors
2020-09-26 23:58:09 +02:00
Jakob Gillich f4fd78fc5d Restructure repository
* Move /common/src to /src
* Move services to net.psforever package
* Move /pslogin to /server
2020-08-26 06:19:00 +02:00
Fate-JH 7901f66324
Damages (#225)
* refactored WSA code handling HitMessage, handling SplashMessage, and handling LashMessage; modified projectiles for future functionality

* players can die from being shot now; the damage model is simplistic since main goal was to write around the potential for negative damage ('healed from getting shot'); HitHint works correctly; dedicated AvatarService channel for each avatar helps reduce message spam

* vehicle destruction, and replacement with lightweight wreckage objects upon continent join; made flushing vehicle terminal more accessible

* simple work on vehicle shield charging (amp station benefit) (that's my commit story and I'm sticking with it)

* a flexible calculation workflow that can be applied, grabbing damage information, resistance information, and then combining it with a resolution function; players and vehicles have resistance values; removed redundant damage calculations from WSA

* broke up DamageCalculations, ResistanceCalculations, and ResolutionCalculations into packages under vital; fixed an error with exo-suit calculation resistances; events for dealing with synchronized player and vehicle damage calculations and building the papertrail of those damages; updating codecov.yml file for ignore classes

* added tests for various components (damage model, destroyed vehicle converter, vitality, etc..) and some functionality improvements

* added a field to keep track of how projectiles will be attributed at the time of target death
2018-07-30 09:28:45 -04:00
Fate-JH b81ff2bbf4
Facility Turrets (#223)
* object class, actor class, and definitions for base turrets; untested

* wired base turrets into existence, with hoop jumping; created interface for objects with mounted weapons (vehicles and turrets); working example phalanx_sgl_hevgatcan in Anguta, Ceryshen

* re-wiring manned turrets so that the turreted weapon itself never changes externally but merely identifies different and changes internally; workflow for upgrading wall turrets in place (30s); clarifications and documentation for HackMessage and UseItemMessage; getting rid of orphaned packages from previous location of services

* added a simple task that reverts upgraded manned turrets to their None state after a certain amount of time has passed; it works but need improvement

* turret weapon upgrades now last for a duration of 30 minutes before reverting; created a service support actor base actor that underlies all current support actors; nano-dispenser now properly loads 1 unit of upgrade canister, rather than 100 units; all canister types have appropriate 2x3 inventory size

* forgot to hurry; moved over the Services tests from main/test folder into the common/test folder and needed to change the location of ActorTest to accommodate it; test and documentation for MannedTurret; codecov ignore update

* wired facility turrets in Anguta, Ceryshen; Akna tower, Ceryshen; and S.Villa tower, home3 (Anguta tower is a watchtower); attempted workaround for Travis CI issues with receiveN; re-introduced RemoveActorTest, at least the first test; expanded how ZoneActor performs tests on MannedTurret setup

* getting rid of useless commented-out code; making common operations for mounting and dismounting

* removed outdated comment; added ResourceSilo tests; added extra test for Zone
2018-07-14 21:25:44 -04:00
FateJH 0fe46311ad Deployment:
Class and Actor mixins for Deployment state.  The logic is surprisingly self-contained, mostly.

DriveState:

This is not the former DriveState Enumeration of /packet/game/objectcreate/.  This is now a /types/ Enumeration shared across /common/ objects and serves the functionality of both, at least to the extent that it is understood.  Functions are includes that define the logic order or state changes and divides states into (two) groups.

VehicleService:

The directory /pslogin/src/test has been created and tests have been migrated there.  Originally, the tests were located in the wrong place and were being skipped when not executed manually.  They should now appear in coverage reports and be run as a part of continuous integration.
2018-02-17 17:37:53 -05:00
Fate-JH abbd5c35ed
Merge pull request #180 from Fate-JH/all-zones
All Zones
2017-12-28 19:04:52 -05:00
FateJH 17a8b8bf38 Zones:
Added continent stubs to InterstellarCluster init list.  All Maps and Zones are defined in temporary objects that may be subdivided further as they grow.

Builder:

Replaced trait ServerObjectBuilder[A] with class ServerObjectBuilder[A] that allows for much greater power.  In ZoneMap.Init override, LocalObject invocations that were previously 'LocalBuilder(FooObjectBuilder(ObjectDefintion, Int))` have been transformed into `LocalObject(ServerObjectBuilder(Int, (Int=>Foo))` where `Foo` is the type of object to be created by the curried function `(Int)=>Foo`.  The examples with Terminals and the VehicleSpawnPad should demonstrate what kind of power this syntax possesses in isolating constant (or at least initial) configuration settings.  At least five files, and some files not yet written, have been rendered obsolete and have been eliminated from the sim pertaining to these created objects.
2017-12-25 17:01:53 -05:00
FateJH 8fbbd31967 modified how subscriptions can subscribe and unsubscribe from specific channels (works now); vehicles now come with default loadouts at time of spawn; MoveItem is now a much more generic process that handles all Container objects; alternate fire modes now have correct ammunition values, but still do not change ammunition type properly; terminals are now distinctively split a bit more; LootItemMessage packet 2017-12-23 01:29:48 -05:00
FateJH 3aee0ab4e8 added and expanded tests in hopes of increasing code coverage score
added tests for AvatarService and PacketCodingActor; especially PCA tests
2017-12-06 19:51:43 -05:00
Chord 9a05bf7f75 Make CCov be quiet 2017-03-01 20:09:55 -05:00