62 lines
3.2 KiB
Markdown
62 lines
3.2 KiB
Markdown
<p align="center">
|
|
<img height="300px" src="https://raw.githubusercontent.com/Thetya/assets/main/logo_v1_nobg.png?token=ARRVKZWL45UC2QTB7B47J2K7YK5MI">
|
|
</p>
|
|
|
|
# Thetya server
|
|
|
|
This repository is a part of the Thetya project and contains the server-side code.
|
|
|
|
#### Directory structure
|
|
| Directory | Description |
|
|
|-------------------|------------------------------------------------------------|
|
|
| `.idea/` | IntelliJ IDEA project meta-data. |
|
|
| `custom-configs/` | Configs modified by the Thetya team for the server to use. |
|
|
| `build/` | Project build output. |
|
|
| `docs/` | Design documents and notes on how various mechanisms work. |
|
|
| `lib/` | Libraries (*.jar files*) imported manually by IDEA. |
|
|
| `scenes/` | Game scenes in exported XML format. |
|
|
| `sql-queries/` | Some SQL queries you need to run during set-up. |
|
|
| **`src/`** | Thetya source code. |
|
|
| **`rsrc/`** | Thetya and Spiral Knights resources. |
|
|
|
|
#### External dependencies
|
|
1. MySQL / MariaDB / Postgres database
|
|
|
|
## Configuring and starting the server
|
|
|
|
#### Configuration
|
|
The first thing you need to do is to generate a RSA Keypair so that you can have secure communication between the client
|
|
and the server. To do so, run `com.github.thetya.server.tools.RsaKeypairGenerator`. You do not need to pass any arguments.
|
|
When it's done, you will either see the keys in the console or have them generated in a `keys.txt` file.
|
|
|
|
Copy the private key and open up `rsrc/server.properties`. Find `key.private` and paste it.
|
|
|
|
You will need to determine your local IPv4 address. On Windows:
|
|

|
|
|
|
Put this into `rsrc/server.properties` under the field `hostname.bind`. You can now close the file.
|
|
|
|
Now open Spiral Knights client directory, go to `code/`, unzip `config.jar` and extract `deployment.properties`. Open it.
|
|
Set `server_host` to the value you pasted into server config before, `server_ports` to `47624`, `datagram_ports` to
|
|
`47625` and `key.public` to the public key you should have generated in the first step. Save the file and replace it in the
|
|
jar.
|
|
|
|
---
|
|
|
|
Now we need to set up the database. Open `rsrc/server.properties`, scroll to the bottom. You need to create 3 databases
|
|
and fill out the credentials using which they can be operated. The tables and schema migrations will be handled
|
|
automatically.
|
|
|
|
#### Starting the server
|
|
Just run `com.github.thetya.server.ThetyaServer`.
|
|
|
|
#### Creating a user
|
|
Make sure you have database credentials typed in into server config. Use:
|
|
|
|
```
|
|
$ com.github.thetya.server.tools.UserTool create [username] [password] [email]
|
|
```
|
|
|
|
The password will be hashed for you and a new account will be created. `siteId` will be set to `204` as this is the ID
|
|
for Spiral Knights.
|