Skip to content

Commit

Permalink
Merge branch 'main' into wiki/docs/faq-explain-northstar
Browse files Browse the repository at this point in the history
  • Loading branch information
GeckoEidechse authored Oct 14, 2024
2 parents 72adaee + d3e1ffa commit c1ebd8e
Show file tree
Hide file tree
Showing 86 changed files with 9,008 additions and 145 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
Titanfall 2 + Northstar Modding Docs
====================================
# NorthstarDocs

This repo contains documentation and guides on most things you need to know about creating mods for Northstar.
This repo contains documentation and guides on most things you need to know about using and creating mods for Northstar.

It is partitioned into:
- the **Wiki** section which contains a variety of information on how to install and use Northstar as well as troubleshooting tips.
- the **Modding** section which contains all the information necessary to create mods for Northstar as well as further technical details for developing for Northstar.

Especially the technical documentation is not done yet and might be incorrect or outdated in some places.

If you have some knowledge to share, but don't want to write a PR, you can make an issue explaining what you know and we can try to integrate that into the docs.

Contributing
------------
## Contributing

The only prerequisites are python and pip. On Linux simply run `run.sh` in the root dir and in windows execute `run.ps1` with powershell in the root dir. You may need to change the Powershell execution policies in order to run the script.

Running the script will install all dependencies required and build the docs locally. The local version is available at [port 8000](http://127.0.0.1:8000/). The server will get opened in your browser when the script finishes.
When you change a file the server will automatically rebuild it and refresh your browser window.

If you get an error message while running the script on Windows, check the following GitHub issue: https://github.com/R2Northstar/NorthstarDocs/issues/106
3 changes: 1 addition & 2 deletions docs/Modding/guides/gettingstarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ SetUIVar( level, "gameStartTime", Time() + GetConVarFloat( "ns_private_match_cou

!!! note

All `Northstar.CustomServers` ConVars are listed here:
https://r2northstar.gitbook.io/r2northstar-wiki/hosting-a-server-with-northstar/basic-listen-server
All `Northstar.CustomServers` ConVars are listed [on this page](../../Wiki/hosting-a-server-with-northstar/basic-listen-server.md)

#### Flags

Expand Down
61 changes: 57 additions & 4 deletions docs/Modding/guides/keyvalue/crosshairmodding.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ WeaponData
{
Crosshair_1
{
"ui" "ui/crosshair_sniper_amped" //This means NO crosshair
"ui" "ui/crosshair_sniper_amped" //This means NO crosshair, unless your weapon is amped
}
}
}
Expand All @@ -102,12 +102,65 @@ WeaponData
These are the available crosshairs in-game, along with their in-game
reference:

![Crosshair examples](https://github.com/Riccorbypro/Custom.Crosshairs/raw/main/assets/crosshairs.png)
### Titan Crosshairs:

| Picture | Value | Special Properties |
| ------- | ----- | ------- ---------- |
| ![](../../../_static/crosshairmodding/crosshair_40mm.png)| `ui/crosshair_40mm` | `NOADS` |
| ![](../../../_static/crosshairmodding/crosshair_40mm_burst.png)| `ui/crosshair_40mm_burst` | `NOADS`, `TRACKER` |
| ![](../../../_static/crosshairmodding/crosshair_flight_core.png)| `ui/crosshair_flight_core` | `NOADS`, `NOSPREAD` |
| ![](../../../_static/crosshairmodding/crosshair_heat_shield.png)| `ui/crosshair_heat_shield` / `ui/crosshair_vortex` | `NOADS`, `NOSPREAD`, `TRACKER` |
| ![](../../../_static/crosshairmodding/crosshair_ion.png)| `ui/crosshair_ion` | `NOADS` |
| ![](../../../_static/crosshairmodding/crosshair_leadwall.png)| `ui/crosshair_leadwall` | `NOADS`,` NOSPREAD` |
| ![](../../../_static/crosshairmodding/crosshair_quad_rocket.png)| `ui/crosshair_quad_rocket` | `NOADS`,` NOSPREAD` |
| ![](../../../_static/crosshairmodding/crosshair_scorch.png)| `ui/crosshair_scorch` ||
| ![](../../../_static/crosshairmodding/crosshair_shotgun.png)| `ui/crosshair_titan_predator_close_range`/ `ui/crosshair_titan_predator_power_shot_close` | `NOADS` |
| ![](../../../_static/crosshairmodding/crosshair_titan_predator_power_shot_long.png)| `ui/crosshair_titan_predator_power_shot_long` | `NOADS` |
| ![](../../../_static/crosshairmodding/crosshair_titan_sniper.png)| `ui/crosshair_titan_sniper` | `NOADS`, `NOSPREAD`, `TRACKER` |
| ![](../../../_static/crosshairmodding/crosshair_tracker_rockets.png)| `ui/crosshair_tracker_rockets` | `NOADS`, `NOSPREAD` |

### Pilot Crosshairs:
| Picture | Value | Special Properties |
| ------- | ----- | ------- ---------- |
| ![](../../../_static/crosshairmodding/crosshair_alternator.png)| `ui/crosshair_alternator` ||
| ![](../../../_static/crosshairmodding/crosshair_arc.png)| `ui/crosshair_arc` | `NOADS`, `NOSPREAD` |
| ![](../../../_static/crosshairmodding/crosshair_circle2.png)| `ui/crosshair_circle` / `ui/crosshair_circle2` / `ui/crosshair_circle2_small` | `NOADS`, `NOSPREAD` |
| ![](../../../_static/crosshairmodding/crosshair_charge_rifle.png)| `ui/crosshair_charge_rifle` | `NOADS`, `NOSPREAD, TRACKER` |
| ![](../../../_static/crosshairmodding/crosshair_wingman_n.png)| `ui/crosshair_dot` / `ui/crosshair_wingman_n` ||
| ![](../../../_static/crosshairmodding/crosshair_esmoke.png)| `ui/crosshair_esmoke` | `NOADS`, `NOSPREAD` |
| ![](../../../_static/crosshairmodding/crosshair_firestar.png)| `ui/crosshair_firestar` | `NOADS`, `NOSPREAD` |
| ![](../../../_static/crosshairmodding/crosshair_frag.png)| `ui/crosshair_frag` / `ui/crosshair_frag2` | `NOADS`, `NOSPREAD` |
| ![](../../../_static/crosshairmodding/crosshair_grapple.png)| `ui/crosshair_grapple` | `NOADS`, `NOSPREAD`, `TRACKER` |
| ![](../../../_static/crosshairmodding/crosshair_grapple_charge.png)| `ui/crosshair_grapple_charge` / `ui/crosshair_phase_charge` | `NOADS`, `NOSPREAD`, `TRACKER` |
| ![](../../../_static/crosshairmodding/crosshair_gravstar.png)| `ui/crosshair_gravstar` | `NOADS`, `NOSPREAD` |
| ![](../../../_static/crosshairmodding/crosshair_grenade_launcher.png)| `ui/crosshair_grenade_launcher` / `ui/crosshair_grenade_launcher2` | `NOADS` |
| ![](../../../_static/crosshairmodding/crosshair_ladder.png)| `ui/crosshair_ladder` | `NOADS`, `NOSPREAD` |
| ![](../../../_static/crosshairmodding/crosshair_shotgun.png)| `ui/crosshair_lstar` / `ui/crosshair_shotgun` ||
| ![](../../../_static/crosshairmodding/crosshair_mastiff.png)| `ui/crosshair_mastiff` | `NOSPREAD` |
| ![](../../../_static/crosshairmodding/crosshair_mine.png)| `ui/crosshair_mine` | `NOADS`, `NOSPREAD` |
| ![](../../../_static/crosshairmodding/crosshair_mozambique.png)| `ui/crosshair_mozambique` | `NOSPREAD` |
| ![](../../../_static/crosshairmodding/crosshair_plus.png)| `ui/crosshair_plus` ||
| ![](../../../_static/crosshairmodding/crosshair_pulse_blade.png)| `ui/crosshair_pulse_blade` | `NOADS`, `NOSPREAD` |
| ![](../../../_static/crosshairmodding/crosshair_satchel.png)| `ui/crosshair_satchel` | `NOADS`, `NOSPREAD` |
| ![](../../../_static/crosshairmodding/crosshair_smart_pistol.png)| `ui/crosshair_smart_pistol` | `NOADS`, `NOSPREAD`, `TRACKER` |
| ![](../../../_static/crosshairmodding/crosshair_smr.png)| `ui/crosshair_smr` | `NOADS`, `NOSPREAD` |
| ![](../../../_static/crosshairmodding/crosshair_sniper_amped.png)| `ui/crosshair_sniper_amped` | `AMPED`, `NOSPREAD` |
| ![](../../../_static/crosshairmodding/crosshair_square.png)| `ui/crosshair_square` ||
| ![](../../../_static/crosshairmodding/crosshair_test.png)| `ui/crosshair_test` ||
| ![](../../../_static/crosshairmodding/crosshair_tri.png)| `ui/crosshair_tri` ||
| ![](../../../_static/crosshairmodding/crosshair_turret.png)| `ui/crosshair_turret` | `NOADS`, `TRACKER` |
| ![](../../../_static/crosshairmodding/crosshair_wingman.png)| `ui/crosshair_wingman` ||

Crosshair images are taken from the modding guide on the [NoSkill Wiki](https://noskill.gitbook.io/titanfall2).
!!! note
``ui/crosshair_test`` has a rapidly flashing dot in its center.

!!! note
Some crosshairs completely ignore the `"base_spread"` setting, and will always use a specific spread. <br> Some crosshairs don't disappear when aiming down sights.
Some of the crosshairs shown above were recreated from scratch, and may not be entirely accurate to their in-game look.

* `AMPED` means the crosshair is invisible, unless your weapon is amped.
* `NOADS` means the crosshair doesn't fully disappear when aiming down sights.
* `NOSPREAD` means the crosshair completely ignores the `"base_spread"` setting, and will always use a specific spread.
* `TRACKER` means the crosshair can track a specific value of your weapon (charge amount, clip size...).

## Examples

Expand Down
34 changes: 16 additions & 18 deletions docs/Modding/guides/tools/rpakmodding.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

## What Are RPaks/Starpaks?

.rpak files are a file format created by Respawn as the main way to store and load in-game assets,
such as textures, materials, datatables, animation recordings, etc. The assets in the .rpak file are kept stored in memory
as long as the .rpak file is loaded.
`.rpak` files are a file format created by Respawn as the main way to store and load in-game assets, such as textures, materials, datatables, animation recordings, etc.
The assets in the `.rpak` file are kept stored in memory as long as the `.rpak` file is loaded.

.starpak files are another file format created by Respawn to complement the .rpak file format.
`.starpak` files are another file format created by Respawn to complement the `.rpak` file format.
They contain streamed asset data, saving hardware resources by only loading the data when needed.
The most common example of streamed asset data is high resolution textures. The low resolution versions are kept permanently loaded
in a .rpak file, whilst the higher resolution versions are loaded as needed.
The most common example of streamed asset data is high resolution textures. The low resolution versions are kept permanently loaded in a `.rpak` file, whilst the higher resolution versions are loaded as needed.

### What can RPak mods do?

Expand Down Expand Up @@ -40,7 +38,7 @@ RePak

- `RePak`: the base folder where your RePak/RPak related files go
- `RePak.exe`: the `unzipped` file you downloaded from GitHub
- `pack_all.bat`: a .bat file that will pack all of your RPaks when opened (outlined below)
- `pack_all.bat`: a `.bat` file that will pack all of your RPaks when opened (outlined below)
- `rpaks`: the folder where RePak.exe will put your RPaks when they have been created
- `maps`: the folder where you will write your "map" files, these define the contents of your RPaks
- `assets`: the folder where you will put your various different images and folders, used to create your RPaks
Expand Down Expand Up @@ -88,15 +86,15 @@ Make a note of the Name of the asset, in this example it's `models\camo_skins\ca
Find the extracted file that LegionPlus created, and open it in some image editing software

!!! warning
The image editing software you choose must be able to export images as .dds files
The image editing software you choose must be able to export images as `.dds` files

Examples of image editing software that supports .dds files:
Examples of image editing software that supports `.dds` files:

- [GIMP](https://www.gimp.org/) (No SRGB support)
- [paint.net](https://www.getpaint.net/)
- [Adobe Photoshop](https://www.adobe.com/uk/products/photoshop.html)

After you have made the desired changes to the image, export it as a .dds file with DXT1 (BC1) compression and the same name as it had originally.
After you have made the desired changes to the image, export it as a `.dds` file with DXT1 (BC1) compression and the same name as it had originally.

![ExportDDS](https://user-images.githubusercontent.com/66967891/181824740-c8a6d1d7-234f-405d-a348-1287aa9bb168.png)

Expand All @@ -107,15 +105,15 @@ After you have made the desired changes to the image, export it as a .dds file w
![MipMaps](https://upload.wikimedia.org/wikipedia/commons/thumb/5/59/Mipmap_Aliasing_Comparison.png/1280px-Mipmap_Aliasing_Comparison.png)


Place your newly created .dds file in the `assets\texture` folder, following the path in the Name you noted down above.
In this example the .dds file would go in `RePak\assets\texture\models\camo_skins`, with the path of the image being `..\RePak\assets\texture\models\camo_skins\camo_skin04_col.dds`
Place your newly created `.dds` file in the `assets\texture` folder, following the path in the Name you noted down above.
In this example the `.dds` file would go in `RePak\assets\texture\models\camo_skins`, with the path of the image being `..\RePak\assets\texture\models\camo_skins\camo_skin04_col.dds`


### Making a map file

Once you have edited your texture image and placed it in the right folder, you are ready to make your map file.

Map files are what RePak uses to create the .rpak file (and .starpak files if needed) and are in the .json file format.
Map files are what RePak uses to create the `.rpak` file (and `.starpak` files if needed) and are in the `.json` file format.
They can be named anything you want, but should be put in the `RePak\maps` folder.

Below is an example of a map file that creates an RPak called `example.rpak` which contains 1 texture asset.
Expand Down Expand Up @@ -160,18 +158,18 @@ To create your RPak file, simply open `pack_all.bat`.
Alternatively, click and drag your map file over `RePak.exe`. (I don't recommend this, it's a pain)

**Look at the console for any errors.**
If there are no errors, a .rpak file should have been created in the `rpaks` folder.
If there are no errors, a `.rpak` file should have been created in the `rpaks` folder.


### Using the RPak in a mod

Create the basis of the mod using the `gettingstarted` guide.
Create the basis of the mod using the [Getting Started](../gettingstarted.md) guide.

Inside the mod's folder, create a new folder, called `paks`. Move your .rpak file (and .starpak files if you have any) into the folder.
Inside the mod's folder, create a new folder, called `paks`. Move your `.rpak` file (and `.starpak` files if you have any) into the folder.

![ModStructure](https://user-images.githubusercontent.com/66967891/181840035-3cfa24e0-efdd-49fa-85f6-60e6c4cc9a12.png)

Inside the `paks` folder that you created, make a new .json file called `rpak.json`.
Inside the `paks` folder that you created, make a new `.json` file called `rpak.json`.
In this example, the `camo_skin04_col.rpak` rpak is completely replaced by `example.rpak`.
This is fine for camo RPaks, but isn't suitable for more complex RPaks

Expand Down Expand Up @@ -241,4 +239,4 @@ paks
**After** `rpak.json` **is set up correctly, your RPak mod should be complete and functional!**

!!! note
If when you test the rpak the colour looks weird, use SRGB in the .dds compression, or use non-SRGB if you were already using SRGB
If when you test the rpak the colour looks weird, use SRGB in the `.dds` compression, or use non-SRGB if you were already using SRGB
11 changes: 11 additions & 0 deletions docs/Modding/plugins/exposed-interfaces/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Available interfaces

!!! note

Not every interface is documented here.

Feel free to add more or tell us which ones are missing.

Multiple binaries of the game expose interfaces you can use.

This section aims to document all of them incrementally.
31 changes: 31 additions & 0 deletions docs/Modding/plugins/exposed-interfaces/northstar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Northstar

All interfaces exposed by Northstar.

## ISys

!!! cpp-class "ISys"

Provides basic functions to interact with northstar.

!!! cpp-function "void Log(HMODULE pluginHandle, LogLevel level, char* msg)"

Log a message using the console managed by northstar.

Messages logged using this method are prefixed with the `LOG_NAME` retrieved via your `PluginId` implementation and printed to the game's console.

!!! cpp-function "void Unload(HMODULE pluginHandle)"

Gracefully unload a plugin (usually your own plugin)

!!! cpp-function "void Reload(HMODULE pluginHandle)"

Reload a plugin. The plugin can know if it has been reloaded via the `reloaded` parameter passed in the `Init` callback exposed in the `IPluginCallbacks` Interface.

!!! cpp-enum "LogLevel : i32"

!!! cpp-member "INFO = 0"

!!! cpp-member "WARN = 0"

!!! cpp-member "ERR = 0"
75 changes: 75 additions & 0 deletions docs/Modding/plugins/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Plugins

!!! note

Writing plugins require some very basic familiarity with C++


Plugins are native modules loaded by Northstar. Because they're not limited to any API provided by the game, plugins are a powerful tool to enable you to do almost anything you could with a custom Northstar Client.

For example, you could write a plugin that [compiles maps](https://github.com/catornot/furnace) at runtime, allows squirrel scripts to save and load recorded animations [from disk](https://github.com/uniboi/recanim) or provide [discord rpc](https://github.com/R2Northstar/NorthstarDiscordRPC) integration.

However because plugins have full access to your system plugins should be treated with caution and regular scripts are preferred if possible.

## Installation

Any `.dll` file located in the directories `<Northstar Profile>/plugins/` and `<Northstar Profile>/packages/<Thunderstore package>/plugins/` will be attempted to load as a plugin.

To manually install a plugin, copy the plugin `.dll` into the `<Northstar Profile>/plugins/` directory.

!!! note

The default northstar profile name is `R2Northstar`. Profiles are located in the same location as `NorthstarLauncher.exe`.


Any Plugin is only valid if it exposes every required [interface](interfaces.md).

If a plugin does not expose every Interface the Launcher requires, it is unloaded immediately.

## Development

To debug a plugin it's recommended to compile Northstar itself or download the debug data from the [Release Page](https://github.com/R2Northstar/NorthstarLauncher/releases).

When developing a plugin it's usually easier to output the binary directly in the `<profile>/plugins/` directory, the `packages/` directory is usually only used for complete packaged mods downloaded from Thunderstore.

### Valid plugins

Every plugin must fulfill these criteria to be considered valid by Northstar.

Invalid plugins get unloaded as soon as possible.

- The plugin module must export a function named [`CreateInterface`](interfaces.md/#createinterface) that returns an interface instance when called.

- Every [required interface](required-interfaces.md) must be exposed via `CreateInterface`

### Debugging

If you know how to use a debugger you can safely skip this.

For simplicity it's assumed your development environment is Visual Studio and you're compiling Northstar from source.

Otherwise are the steps basically the same everywhere else.

1. Clone the [Launcher](https://github.com/R2Northstar/NorthstarLauncher)

2. Set the binary output directory to the location wherever you have installed your game. The compiled `NorthstarLauncher.exe` should be outputted next to `Titanfall.exe`.

3. Launch `NorthstarLauncher.exe` with a debugger or attach a debugger to a running process

4. Load debug symbols of your plugin(s) (for example `myplugin.pdb`) in the debugger

That's it.

### Hooks

Any Plugin can install hooks anywhere in memory it desires. However, plugins should avoid hooks if possible because of conflicts with Northstar itself or hooks installed by other plugins.

It is not generically possible to determine if a given address has already been hooked by a different plugin and there is currently **no mechanism for plugins to share information which addresses have hooks installed**.

Northstar does not expose an interface to (un)install hooks. Every plugin is expected to use their own provider.

## Examples and Libraries

- A small plugin [""framework""](https://github.com/uniboi/NSPluginTemplate/) to show the basics of writing plugins and Squirrel bindings in C

- A complete [Rust plugin library](https://crates.io/crates/rrplug) that allows you to easily integrate safely with large parts of the engine itself
Loading

0 comments on commit c1ebd8e

Please sign in to comment.