This is a server for the MMORPG TERA written in rust. Currently targeting TERA EU 93.04.
To connect to the server you need to use the custom client launcher. It's a direct replacement for the publisher launcher and Tl.exe.
The development of Almetica is currently on hiatus. The codebase is pretty well designed and could be extended easily if you wish. It's testsuite is extensive and commented pretty well.
A stable rust installation (version 1.42+).
Developer build:
cargo build
For hardware accelerated AES you will need to use a compatible CPU and this build command:
RUSTFLAGS="-C target-feature=+aes,+ssse3" cargo build
For the best performance (including AES speed improvements) compile the server with the full native instruction set of your CPU:
RUSTFLAGS="-C target-cpu=native" cargo build
Remember to use the --release
flag if you want to activate all compiler optimizations.
Configure the server with the help of the provided configuration template (config.yaml.tmpl).
You also need some additional files that you need to extract yourself from the TERA client. We will provide tools / instructions how to do so in the future.
You can find these tools yourself though on Github.
A YAML file with a list of all packet names that need the integrity check (>= version 93).
Format:
- C_CAST_FISHING_ROD
- C_DIALOG
...
A YAML file with two keys: "key" and "iv". These are the parts of the AES256 key which is used to decrypt the datacenter file. Extracted from the memory while the TERA client is runnig.
Format:
key: E1B1C4666F64681889BC8A5594387E2D
iv: 1F494C6BB424C916CA44BB1C64CEAA41
...
A YAML file with a list of all system messages in the same order as the client.
Format:
- SMT_UNDEFINED
- SMT_LOBBY_CANNOT_CONNECT
...
A YAML file with a hashmap of the packet name as key and the opcode value as the value as defined in the client.
Format:
C_ACCEPT_CONTRACT: 12345
C_ACCEPT_FRIEND: 67890
...
You can run the server with the following commands:
RUST_LOG=info cargo run --bin almetica
Since some tests are integration tests that need a postgres database, you need to configure a database connection which will be used for the testing. You need a database user that is allowed to create and delete databases and I recommend just to spin up a docker container for the testing. Don't run the tests against your production database.
The tests will create a randomly named test database so that they can run in parallel.
To configure the database access, please create a .env file in the project root and add a TEST_DATABASE_CONNECTION variable:
TEST_DATABASE_CONNECTION="postgres://username:[email protected]:5432"
Use the format that is documented here:
https://docs.rs/postgres/0.17.2/postgres/config/struct.Config.html
Please have a look in the project backlog in Github to see what is currently being worked on. If you plan make big changes to the codebase, it's wise to contact the project in advance, so that possible issues with the implementation can be discusses in advance.
Always write tests for the code you write. Code without tests will not be included.
The almetica project adheres to the Contributor Covenant.
Provide a server platform for TERA that gives better performance then the original server while providing the same feature set.
I don't strive to emulate the original TERA server 100% the same. We will optimize / improve functionality where it seems logical (for example stricter validation of client commands).
This server should also act as a way to preserve TERA for the future.
I had four requirements for the server projects for me to consider continue developing them:
- Open Source License
- Some kind of tests (unit / integration test etc.)
- Written in a compiled and typed language
- Written with a clear design goal
None of he evaluated existing server projects did fulfilled these requirements.
Licensed under AGPL version 3.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the AGPL version 3 license, shall be licensed as above, without any additional terms or conditions.
This software contains no code from the original game. We are developing an alternative server implementation like the open source server implementation for Lineage 2: L2J, or Ragnarok Online: rathena.
The cryptography algorithm used by by Bluehole in their network protocol is a direct implementation of the freely available stream cipher Pike published in Ross Anderson's 1994 paper "On Fibonacci Keystream Generators".
It's pretty hard to trace the origin of some of the achievements. So I will just credit people without their specific contributions. Most of them did discover specific issues while reverse engineering the TERA network protocol or did some other kind of groundwork that this server is based on (ordered alphabetically):
alexrp, caali-hackerman, mirrawrs, meishu, P5yl0, pinkiepie