Skip to content

LEGACY: Solution Structure

Tyler edited this page Feb 6, 2021 · 1 revision

Overview

The following tables should give you some details on the structure of the SWLOR solution. It's not intended to be all-inclusive nor should you expect it to be up-to-date at all times. Things constantly change and documentation sometimes lags behind. You should use this as a guide, but always verify things in the code itself. If you DO find an issue with this documentation please get in touch with a contributor and let them know.

The Projects

Project Name Description
SWLOR.Tools.Hak.Builder This is the application used to build our hakpaks. You can find a deployed copy in the SWLOR_Haks repository. (Link: https://github.com/zunath/SWLOR_Haks/ )
SWLOR.Tools.LanguageGenerator This is the application used to generate code for new languages. The output of this program should be added to the Language folder in SWLOR.Game.Server
SWLOR.Tools.Module.Packer This is the application used to pack or unpack module assets. You can find a deployed copy in the Module folder of SWLOR.Game.Server
SWLOR.Game.Server This is the primary source of all engine related functionality. If you're looking for a core system like Perks, Skills, or Languages you should look here first.
SWLOR.Game.Server.Scripts These are C# scripts which get compiled when the server boots up. These can be loaded and unloaded while the server is still running, which makes for quicker testing during the development process. These scripts are copied as part of a post-build script. Examine the project's properties in Visual Studio and go to Build Events to learn more about this.
SWLOR.Game.Server.Tests These contain unit tests for the SWLOR.Game.Server project.

SWLOR.Game.Server Folders

The following table describes a little about the types of files you'll find in each folder of the SWLOR.Game.Server project.

Folder Name Description
AI Contains logic used for the creature AI system. Includes various behaviour scripts.
Bioware Contains functions originally built by Bioware, converted to C# for use in SWLOR.
Caching Contains in-memory cache objects which are efficiently organized to cut down on read times. The entire database is loaded into these caches at boot time.
ChatCommand Contains chat command classes. Each class represents one "slash command". For example, /bow would correspond to the Bow.cs file.
Conversation Contains code-based conversation files. These are generally used for menus but can easily be used for other purposes, such as NPC dialogue, if needed.
CustomEffect Contains the logic used for Custom Effects.
Data Contains the database migration runner which handles upgrading databases and also has extensions used for mapping SQL tables to entity objects.
Data/Entity Contains C# database mapping objects. These all correspond to a table in the database.
Data/Migrations Contains SQL migration scripts used for upgrading the database. Refer to "Creating a Database Migration Script" for more information. (Link: https://github.com/zunath/SWLOR_NWN/wiki/Creating-a-Database-Migration-Script )
Data/Scripts Contains one-off scripts that may be useful for development. These aren't called anywhere in the code base. They're simply convenience scripts for developers to use.
DoorRule Used in the base service. These are pieces of logic used when spawning doors to buildings. Each placeable is a little bit different and so these are necessary to run to ensure positioning lines up as expected.
Enumeration Custom enumerations which map to NWN, NWNX, or SWLOR types. You can think of these as constants.
Event Contains folders for entry points into the C# code base. It also includes proper event objects which get published by the entry points. Refer to "Codebase Basics" for more information on entry points. (Link: https://github.com/zunath/SWLOR_NWN/wiki/Codebase-Basics )
Extension Contains extension "helper" methods.
GameObject Contains wrappers around NWN objects to make them feel a little more object-oriented.
Item Contains implementations for specific "action items".
Language Contains language translations for various languages. These are generated with the SWLOR.Tools.LanguageGenerator application.
Messaging Contains objects related to event messaging which is used for publishing and subscribing to various SWLOR, NWN, and NWNX events.
Mod Contains logic for specific item mods.
Module Contains all of the module assets (creatures, areas, items, etc) in packed (.mod) and unpacked (.json) format. These are packed and unpacked with the SWLOR.Tools.Module.Packer application.
NWNX Contains NWNX plugin logic used for interfacing with the various plugins in use. These correspond to the NWScript files contained in that repository. Refer to their repository for more information on those plugins. (Link: https://github.com/nwnxee/unified/tree/master/Plugins )
NWScript Contains code provided by the NWNX_Mono plugin. It's used for interfacing between the game and the C# code base. The only times this should be touched is if new functions are added to the base game or if the NWNX_Mono plugin has updated.
Perk Contains individual perk logic for purchasing, removing, and using perks.
Processor Contains processors used by the server. These generally hook to the OnObjectProcessorRan event which fires once a second.
Quest Contains engine-level quest logic. New quests should NOT be added to this folder. They should go in the SWLOR.Game.Server.Scripts project instead.
Scripting Contains engine-level scripting logic. It handles the process of finding, compiling, registering, and unregistering scripts as the folder changes.
ServerFiles Contains reference files and example scripts for hosting the SWLOR server. Options for running with Docker and running natively on Linux are available.
Service Contains the majority of system-related logic used in SWLOR. If you're looking for a specific piece of functionality, this should usually be your first stop.
SpawnRule Contains logic for specific spawns to run at the time of spawning in. Generally used for resources like ore veins and trees but isn't limited to just that.
Threading Contains processing code for database writes and any other actions which do not require the NWN context. If you're working on anything in here, you need to be very careful not to access the NWN context from another thread. You will crash the server if you do that. Please get in touch with the admin if you need to do work on anything in here.
ValueObject Simple objects which hold data temporarily.