Emulated PlanetSide 1 world and login server by the PSForever project.
Find a file
FateJH 4bcef8ce98 new stuff for player server classes; this update is not yet complete
adjusted sample Reload code and added insertion and removal functions for inventory

more work on player classes; moving PacketResolution to another branch

decoupling GUIDs from objects; introduced Ammo enum; minor adjustments to inventory system; different object/class hierarchy

transferring basic files from another branch

converted from get/set to accessor/mutator; resolved conflict from name changes

refactored basic components such as GUID and location/orientation

utilities kludge; more fields are given accessor and mutators; create package for vehicle-specific classes

GUID assurance, now with less object creation

test files; changes to how AmmoBox initializes

sorry, a little bit of everything, so much I forgot to write it all down

switched to a unified fire mode object internal to a Tool

importing a heavily modified version of my GUID manager objects from the laternate branch; not finished or tested yet

created a Trait to make Key private, sources and selectors to allow NumberPools to exist independent of a NumberSource; placed Ascending into a misc folder

swapped the Return methods for selectors so that the more primitive logic is the one that needs to be overriden; renamed a selector to be more common; had to update some copyright messages

fixed major logic issue with NumberPool; added comments to NumberSource files

NumberSource tests

simplified and made more consistent the method naming convention of NumberSources

comments for NumberSelectors

starting on NumberSelector tests

modifications that should better support number pools; added a pool hub that acts on a predefined source

adjustment to how Tools and FireModeDefintion keep track of ammunition and ammunition slots; I don't think this is sufficient

small additions to Tools; filled out simple tests for other three Selectors

added object lookup notation for the pool hub

added more NumberSelector tests; removed the word 'Number' from subclass names

re-named classes, re-packaged classes, re-named packages; created new Selector, split pools to create a fallback for the NumberPoolHub

changes to NumberPool classes; tests on NumberPool classes

changes to NumberPool classes; tests on NumberPool classes2

some robust testing for NumberPoolHub, plus necessary modifications to other files

register and unregister functions now use Success and Failure conditions, save for one true thrown Exception

reduced the flow of certain algorithm chains, mainly by adding match statements and removing Exceptions

error message text

the same thing as the last commit, but with NumberPools rather than NumberPoolHub

various types of freeform registration

added sorting functions to Selectors to allow for hotswapping for number pools, especially to and from SpecificSelector; tests for NumberPoolHub

get numbers from an Array of indices, not the list of Numbers, in SimplePool

added a class to represent the four types of recovery kits

comments on Kit files

created package for supporting equipment classes; renamed /definition/ package

adding class for items that construct deployables, the router telepad included

added SimpleItem, classes for game Equipment that do not have internal state; re-organized ObjectDefinition files and the game objects they create to more naturally move around EquipmentSize and InventoryTile (size)

added SimpleItem tests (what they are...); removed example code that has hogging an import from AmmoBox

auto-sort for loading and fitting former inventory content back into the inventory

method of finding first available position to fit an certain size block in the inventory

changed CheckCollision return type to provide Try[List[Int]; fixed all existing references and tests

wrote comments for GridInventory methods; changed insertion param to be of form 'key -> element'

adding features to Player; created definitions for Player class; re-grouped ConstructionItem enumerations

initial work on implants; shuffled classes to better accommodate the new implant system, I think

wrote some tests for Implants; fixing Implant logic

wrote tests for Player class and made adjustments where necessary

basic initialization during Player creation based on exo-suit type

three wrapper Actors for the normal classes

comments on code

modified tests to improve accountability; added Resolver class to deal with multiple tasks that contribute to a larger task

changed Tools to an internal AmmoBox; don't have to def -= symbol if I def _= symbol

LivePlayerList -> MasterPlayerList, and added a Fit def for Player that checks holsters as well as inventory

example of packet conversion can be found with AmmoBoxDefinition

added conversion for ToolDefinition

added all Equipment packet conversion functionality; started working on Avatar-related conversions

continued effort towards a working Player packet conversion test

subclasses of Equipment apparently do not need to overide the type of the PacketConverter for generics

the logical conclusion: it doesn't matter what generics Packet returns so long as it returns an ObjectCreateConverter[] type

separated converters from definitions into files

changed some configuration information to final; added a bunch of converters, not fully tested though

changed function names in converters

replaced WSA packet-driven OCDM with Player object OCDM; upgrade to Float angular data

added partial support for LockerContainer; changed Equipment defaults to a common value

changes to AvatarConverter to include 5th slot; changes to VehicleConverter to make work; implementation of Fury in Vehicle->packet example in WSA

added a seat definition and renovated how the weapon controlled from a seat can be found

comments to files mainly; non-essential functionality to some classes, mostly access determination

moved converter tests to their own test file

write more of this test

added ServiceManager, as it is useful

pool range changes

added AvatarService, as it is useful

straightened out the GUID actors; added the static method for adding AmmoBoxes (to be converted later)

chnages to task resolution operation

complicated Task and TaskResolver logic is now possible; for example, you can schedule giving an AmmoBox a GUID, before giving a Tool a GUID, before placing the Tool in a player's hand; see Suppressor example in WSA

separated the Task trait and the TaskResolver actor into their own classes, moving the former RegistrationTaskResolver class into the /misc/ folder; deleted old backup copy of HubActor; modifications for PoC and supported tests

added better support and protection against putting things in the wrong hand when using inventories and the Player.Slot(n) function

GlobalDefinitions file; added laze pointer as an SItem, and gave it the command detonater management code; additionally fixed spelling of 'detonat[o]r' in Codec; early Terminal class work

updated tests to GlobalDefinitions entries; Terminal works but I don't like it

played with GUID pooling workflow, though to little avail; modifications to Terminal purchasing workflow, but still very volatile

modified NumberPoolActor and NumberPoolAccessor to make them more straightforward and not use akka ask as a go-between

fixed recovery options so that they do not cause more messages

trailing newline

InventoryItem (packet data) renamed InventoryItemData to remove ambiguity; Terminal functionality improved, allowing for swapping of exo-suits and the restoration of equipment positions

remove yet-unsupported Terminal messaging

made Terminal message more specific; can now put equipment into empty slot on exo-suit change; should report changes better

re-organized function calls to preserved items removed from holster slots on exo-suit change

moved predicate to the end of the list of params for recoverInventory so that repetition can be eliminated and a default value can be assigned

issues with making Tool; committing changes before revert of NumberPoolActor and NumberPoolAccessorActor to see if those broke it

a necessary evil, the reverting of these two Actors; subtask resolution does not work unless I do so, for now

restored the registration portion of tasking back to where it previously was (and better?)

NumberPoolActor and the ...AccessorActor are back to a comfortable place (and better?)

re-draw object in hand when switching exo-suits; build AmmoBoxes for Tool during Terminal-controlled creation, not Tool-controlled creation

order of task cleanup reversed to avoid index mismatch; added itsm to TerminalDefinition

common 5x5 AmmoBox size; added vehicle weapon ammo boxes to terminal

added error catching messages; stopped odd double-registering issue early

resolved issue where multiple subtasks started their main task multiple times; added checks that an object does not register a new GUID when it already has one

wrote unregistration code for Selling items back through the Terminal, repairing logic along the way; also, wrote a top-level GUID find for the Player for use of MoveItem

added framework for starting on Loadouts; managed issue with parent tasks starting before being summoned by child subtasks, often resulting in the complete skip of the execution phase of the parent; refactored registration tasks in WSA

modified Tool structure, exposing the AmmoSlot list a bit more

stuff stuff Tool ammo slot changes to default and comments

basic loadout framework for Infantry; need to integrate

initial work on FavoritesRequest packet

tests for FavoritesRequest packet

increased size of number pool for testing; wrote an algorithm that translates to and from the simplified version of objects stored in loadouts

refactored the tasking for adding Equipment and removing Equipment

updated the inventory so the Map of items does not have to rely on the GUID of an item being set before the item is inserted

untested routine for registering a player character; pushing all changes before making significant changes to the client init code structure

added to comments of BeginZoningMessage; transitioned player through and initial step of a more proper login GUID association

the current avatar is properly registered and there is something of a workflow with the messages and packets

corrected another bit of logic where inventories used to be indexed by object GUID in AvatarConverter; reversed unregister-remove task sequence such that GUID-less object is not allowed to exist in a stable object hierarchy

working Loadout loading

added identification functions to GlobalDefinitions; echo ObjectDelete back to client

accidentally got rid of something in WSA, but now restored; adding extra details to Terminal operations

separated Terminal into separate files and moved files into their own package under \objects\ for now; can delete loadouts now in WSA

better handling of ReloadMessage and MoveItemMessage

framework for better support involving dropping and picking up items

code comments and small modifications, such as the location and structure of the Terminal Equipment definitions

wrote comments in GlobalDefinitions; modified code so that a primitive form of player synchronization now occurs for future testing

added code to display already-dropped Equipment on the ground; limitations are explained; moved TaskResolver to more a global location, though I don't know if that helps

modified avatar unregister logic to ensure vacating player is deleted from other clients 'properly'

more comments; improved checks for MoveItemMessage; squared distances as necessary

subtle changes to login scripting so that test character is always offered

re-organizing the functions in WSA so that only the local objects separate the two message processing blocks
2017-08-15 23:10:59 -04:00
common/src new stuff for player server classes; this update is not yet complete 2017-08-15 23:10:59 -04:00
config Increase logback scan interval 2016-08-19 03:16:45 -04:00
notes Added document notes 2016-02-16 00:31:33 -05:00
project Travis: enable code coverage 2016-07-26 22:31:54 -04:00
pslogin/src/main/scala new stuff for player server classes; this update is not yet complete 2017-08-15 23:10:59 -04:00
scripts Old script lying around for formating scala opcodes 2017-03-19 18:44:44 -04:00
.codecov.yml Make CCov be quiet 2017-03-01 20:09:55 -05:00
.gitattributes Update copyrights for 2017 (#109) 2017-03-06 19:30:45 -05:00
.gitignore Increase client keep alive interval, add dynamic log files 2016-08-05 18:12:51 -04:00
.travis.yml Update .travis.yml 2016-07-30 16:52:59 -04:00
build.sbt added compiler flag '-language:postFixOps' to stop warnings about time post-fix notation ('100 milliseconds') 2017-05-05 08:22:17 -04:00
Dockerfile Add Docker file (#89) 2017-03-19 17:58:53 -04:00
LICENSE.md Add GPLv3 licensing information 2016-05-02 00:08:33 -04:00
README.md Initial support for server REPL (#68) 2016-08-26 23:46:57 -04:00
THANKS.md Create THANKS.md 2017-03-10 22:28:34 -05:00

PlanetSide Login Server Build Status Code coverage

This project contains the code to run and manage the login and world server roles for PlanetSide 1. The login server and world server are currently combined for ease of contributing.

PSForever Login Server banner

The login and world servers are built to work with PlanetSide version 3.15.84.0. Anything older is not guaranteed to work. Currently there are no releases of the server. You will need to have a development environment set up in order to get it running. Or you can jump right in and join the public test server!

Build Requirements

  • SBT 0.13.x
  • Scala 2.11.8
  • PSCrypto v1.1 - binary DLL (Windows) or Shared Library (Linux) placed in the root directory of the project. See Downloading PSCrypto to get it set up.

Setting up a Build Environment

PSF-LoginServer is built using Simple Build Tool (SBT), which allows it to be built on any platform. SBT is the Scala version of Make, but is more powerful as build definitions are written in Scala. SBT is distributed as a Java JAR and the only dependency it has is a JDK.

Getting the Java Development Kit

This project is tested with the official JDK 8 from Oracle. Download and install it for your system in order to start compiling Scala. If you are new to Scala, this may seem strange to be installing Java for Scala. Scala runs on top of the Java Virtual Machine, meaning it generates .class and .jar files and uses the java executable. Essentially, Scala is just a compiler that targets the JVM, which is its runtime.

Downloading the Scala Development Kit

In order to use scala, you need the compiler scalac. This is equivalent to Java's javac, but for the Scala language. Grab the 2.11.8 version from Scala-Lang.org. Install this on to your system and the compiler and Scala REPL will be added to your PATH.

Downloading PSCrypto

The server requires PSCrypto in order to run. Download the latest release and extract the ZIP in to the top level of your source directory. SBT, IDEA, and Java will automatically find the required libraries when running the server. If you are not comfortable with compiled binaries, you can build the libraries yourself.

Using an IDE

Scala code can be fairly complex and a good IDE helps you understand the code and what methods are available for certain types. IntelliJ IDEA has some of the most mature support for Scala of any IDE today. It has advanced type introspection and excellent code completion. It's recommended for those who are new to Scala in order to get familiar with the syntax.

Download the community edition of IDEA directly from IntelliJ's website. Then follow this tutorial to get the required Scala plugin for IDEA. Stop at step 2a (project creation) as we will be importing the LoginServer project ourselves.

Next, you need to get a copy of the LoginServer code. It's recommended that you perform a git clone https://github.com/psforever/PSF-LoginServer.git using your favorite git tool. You can also work from a ZIP ball, but you cannot develop from it.

Once you have the code downloaded, you will need to import the project into the IDE. Follow these instructions from IntelliJ to import an SBT project. Once you have successfully imported the project, navigate to the pslogin/src/main/scala/PsLogin.scala file, right click and 'Run PsLogin'. This will boot up the login server.

Using SBT and a Text Editor

If you are not a fan of big clunky IDEs (IDEA is definitely one of them), you can opt to use your favorite text editor (Sublime, ViM, Notepad++, Atom, etc.) and use SBT to build the project. The only dependency you will need is SBT itself. Download SBT for your platform, install or extract, and open up a command line (cmd.exe, bash, CYGWIN, Git Bash) that has the Java Development Kit in its path.

At the command line run the following commands

git clone https://github.com/psforever/PSF-LoginServer.git
cd PSF-LoginServer
sbt pslogin/run

This will clone the repository and SBT will compile and run the login server. Note: SBT is quite slow at starting up. It's recommended you have an open SBT console in order to avoid this startup time.

Running the Server

To run a headless, non-interactive server, run

sbt pslogin/run

PlanetSide can now connect to your server.

To run your custom server with an interactive scala> REPL, run

sbt pslogin/console

image

To start the server and begin listening for connections, enter the following expression into the REPL:

PsLogin.run

image

This process is identical to running the headless, non-interactive server: PlanetSide clients can connect, logging output will be printed to the screen, etc. The advantage is that you now have an interactive REPL that will evaluate any Scala expression you type into it.

image

The REPL supports various useful commands. For example, to see the type of an arbitrary expression foo, run :type foo. To print all members of a type, run :javap -p some-type. You can run :help to see a full list of commands.

image

Connecting to the Server through the Client

To get PlanetSide to connect to your custom server, you will have to navigate to the client.ini file (located within the PlanetSide game directory) and modify the IP addresses.

Check to see what IP the server is listening on (look for the login-udp-endpoint line) and copy that IP, followed by port 51000 to the the second line of the client.ini, which should initially say login0=64.37.158.81:45000. Your new line should say login0=YourIP:51000. Delete all of the other lines in the file except [network] at the top of the file. Save and enjoy!

The file should now look like this

[network]
login0=your.local.ip:your-port

If you want to connect to the public test server, this is what your file would look like

[network]
login0=play.psforever.net:51000

You must restart PlanetSide when changing the client.ini file!

Creating a Release

If you want to test the project without an IDE or deploy it to a server for run, you can use sbt-pack to create a release (included with the repository). First make sure you have the SBT tool on your command line (or create a new task in IntelliJ IDEA). Then get a copy of the source directory (either in ZIP or cloned form). Then do the below

cd PSF-LoginServer
sbt packArchiveZip # creates a single zip with resources

This will use the sbt-pack plugin to create a JAR file and some helper scripts to run the server. The output for this will be in the PSF-LoginServer\target directory. Now you can copy the ZIP file to a server you want to run it on. You will need the Java 8 runtime (JRE only) on the target to run this. In the ZIP file, there is a bin/ directory with some helper scripts. Run the correct file for your platform (.BAT for Windows and shell script for Unix).

Troublshooting

Unable to initialize pscrypto

If you get an error like below

12:17:28.037 [main] ERROR PsLogin - Unable to initialize pscrypto
java.lang.UnsatisfiedLinkError: Unable to load library 'pscrypto': Native library (win32-x86-64/pscrypto.dll) not found in resource path 

Then you are missing the native library required to provide cryptographic functions to the login server. To fix this, you need a binary build of PSCrypto.

Contributing

Please fork the project and provide a pull request to contribute code. Coding guidelines and contribution checklists coming soon.

Get in touch

Chord is the lead developer and you can contact him on Discord as Chord or by email chord@tuta.io. Discord is preferred.

License

GNU GPLv3. See LICENSE.md for the full copy.