Coder Social home page Coder Social logo

emptii / skrillax Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kumpelblase2/skrillax

0.0 0.0 0.0 873 KB

Learning Rust and ECS by implementing an emulator for Silkroad Online.

License: GNU Affero General Public License v3.0

Shell 0.01% Rust 99.90% Dockerfile 0.08%

skrillax's Introduction

Skrillax

Learning Rust and ECS by implementing an emulator for an MMORPG.

Skrillax is my learning project for playing around with Rust, learning about lifetimes, shared state, async, and whatever else I encounter on the way. My goal isn't to have a (fully) working server emulator. However, having a somewhat working program at the end of the day would help with motivation.

This project is organized in many subprojects, each having their own individual goal:

  • silkroad-protocol: Packet specification that is used for communicating with the client
  • silkroad-rpc: Shared types for RPC between servers
  • silkroad-security: Implementation of security primitives used in Silkroad
  • silkroad-network: Abstraction to handle connections to Silkroad clients
  • silkroad-navmesh: Navigation Mesh implementation, loading from official data files
  • silkroad-gateway: Loginserver implementation
  • silkroad-agent: Gameserver implementation
  • silkroad-packet-decryptor: Tool to decrypt encrypted packet stream from silkroad.
  • silkroad-serde: Serialization/Deserialization traits used for packets.
  • silkroad-serde-derive: Derive macros to implement serialization/deserialization traits.

Usage

While there's a lot (probably 97%) still missing, it's possible to run the server(s) and connect to it. There are two ways to go from here: Either you run the servers in a container or you run them directly. Please follow the steps for the method you chose below.

In both cases you also need a working Silkroad Online installation. This needs to also be accessible by the server, as this provides most of the data (skills, characters, items, world mesh). Unlike many previous implementations, this currently uses a (mostly) recent iSro version (around v1.600). Currently, it will accept any version

via Docker

If you want to run the servers in a docker container, ensure docker is already installed as well as docker-compose. Next, copy the docker-compose.yml.example to docker-compose.yml. Now adjust the <silkroad game location> to match the path of your silkroad directory (e.g. /home/me/games/silkroad). Then you can simply run

$ docker-compose up

to start all servers; the database, the gateway server, and the agent server. You're almost ready, please continue with the after install step.

Local Build

You can also choose to build and run the servers directly. For this you need to first install Rust. You can verify the installation by running rustc --version and checking that you get a version back. Additionally, make sure you have either installed or otherwise access to a PostgreSQL instance.

First, lets set up the database. For this, create a new database in postgres that we can use. Then migrate the database using the scripts provided in the migrations folder. You can either do this manually or, if you want to continuously develop, use sqlx to do it for you. You can install sqlx by running cargo install sqlx-cli --features postgres. Next, copy the .env.example to .env and adjust the connection string to your installation. Format is: postgres://<user>:<password>@<host>/<db>. Then, you can run cargo sqlx migrate run. After all this, your database should have some tables in it, albeit empty.

Now we need to adjust the configuration files. In configs/agent_server.toml and configs/gateway_server.toml configure the database connection similar to the following with the appropriate values for your environment:

[database]
host = "localhost"
user = "skrillax"
password = "skrillax"
database = "skrillax"

We also need to adjust the game.data-location path in the agent_server.toml to match that of your Silkroad installation directory as well as the rpc-address in the same config to be localhost. If you plan on running the agent and gateway server on different hosts, the address you put in here should be the host or ip the gateway can use to access the agent server.

With the configuration and database set up, we can now start the servers. It doesn't really matter in which order we do it - the gateway server will pick up the agent server by checking occasionally - but you can start the gateway server first:

$ cargo run --bin silkroad-gateway --release

After that, you can do the same with the agent server:

$ cargo run --bin silkroad-agent --release

Both servers should start up just fine and would now wait for connections.

After Setup

The servers are now running, and you could connect to them, but there would be no user to use to log in. One can be created using the gateway:

$ cargo run --bin silkroad-gateway --release -- register <username> <password>

and fill in the parameters with the values you wish. With these, you will be able to log in.

As a last step, you need to configure Silkroad to use the local gateway server instead. You can do this either by using a so-called "Loader" to redirect the client to the gateway server on startup, or by editing the Media.pk2 directly.

skrillax's People

Contributors

kumpelblase2 avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.