Skip to content

DMCK96/almetica

 
 

Repository files navigation

Almetica Logo

LOC

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.

Status

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.

Requirements

A stable rust installation (version 1.42+).

Building

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.

Configuration

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.

integrity.yaml

A YAML file with a list of all packet names that need the integrity check (>= version 93).

Format:

- C_CAST_FISHING_ROD
- C_DIALOG
...

key.yaml

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
...

messages.yaml

A YAML file with a list of all system messages in the same order as the client.

Format:

- SMT_UNDEFINED
- SMT_LOBBY_CANNOT_CONNECT
...

opcocode.yaml

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
...

Running

You can run the server with the following commands:

RUST_LOG=info cargo run --bin almetica

Testing

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:password@192.168.1.1:5432"

Use the format that is documented here:

https://docs.rs/postgres/0.17.2/postgres/config/struct.Config.html

Contributing

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.

Code of Conduct

The almetica project adheres to the Contributor Covenant.

FAQ

What are your goals?

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.

Why didn't you extend already existing server projects:

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.

License

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.

Legal

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".

Credits

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

About

Private server implementation of the MMORPG TERA written in Rust.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 99.5%
  • Other 0.5%