GithubHelp home page GithubHelp logo

netrexmc / netrex Goto Github PK

View Code? Open in Web Editor NEW
70.0 70.0 6.0 715 KB

A powerful minecraft bedrock software written in Rust and Typescript with a powerful Typescript plugin API.

Home Page: https://discord.gg/y4aWA5MQxK

License: Apache License 2.0

Rust 98.04% TypeScript 1.96%
deno minecraft rust rust-lang

netrex's People

Contributors

buchwasa avatar john-bv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

netrex's Issues

Event Function not mutable with current implementation.

Event Function not mutable with current implementation.

Currently, we have an issue with how RakNet handles events. (this may be moved to raknet after further analysis)
The issuing being, the event subscriber function must be able to verify that the instance of the Server lives statically, which is unfortunately not possible. In the context of code, this looks like:

struct Server;

impl Server {
    fn start(&mut self, address: &str) {
        // We can try to create an "Arc" which references self directly
        let self_ref = Arc::new(&self);
        
        // However we can not validate that this will live statically, which
        // is required by raknet.
        let mut rak_server = RakNetServer::new(address.to_string());
        let (_send, _work) = raknet_start!(raknet, move |event: &RakNetEvent| {
			match event.clone() {
				RakNetEvent::GamePacket(address, buf) => {
					// Error: self may not live for the entirety of this thread.
                    self_ref;
					Some(RakResult::Motd(Motd::default()))
				}
				_ => None
			}
		});
    }
}

I'm still currently brainstorming how we could solve this issue, as it's something that affects the servers functionality entirely.

Working login sequence (player spawn)

Working login sequence (player spawn)

  • 1. Basic implementation of packets required to log in via Protocol

    • Login
    • Server to Client Handshake
    • Client to Server Handshake
    • Play Status
    • Resource Packs Info
    • Resource Pack Client Response
    • Resource Pack Stack
    • Start Game
    • Creative Content
    • Biome Definition List
    • Chunks
  • 2. Login authenticator: Handles logins (such as XBL validation)

  • 3. Pesudo packet implementation

  • 4. Start Game Packet:

    • Working block tables
    • Working item tables

Server Ticks? Or not?

Should the server itself tick? I'm thinking probably not because each world should be reliable for ticking, as ticking on the server (because it's a mutex) will hold a handle to everything for the duration of that tick, when we only need to tick worlds as they are open.

Please provide input here ๐Ÿ˜„

Custom Logger crate

To remove redundancies and allow more control on debugging vs actual prints there should be a logger crate that can be used in all sub-crates of netrex like raknet and protocol.

Chat and Commands

Chat and Commands

  • Text Packet
  • Available Commands Packet
  • API Backend for simplicity of creating commands. (needs brain storming.)

[QOP] Results should be used where errors "unwraps" or panics can occur.

Issue / Question:
Currently, we do not use results, and as a result, a simple function such as u32::compose(&[0, 0, 0, 1], &mut 0) may panic, and kill the main thread. We expect a possible error here therefore it should NOT terminate the main thread, but rather just error in console, with a description of what happened.

Proposals / Details:
In places where an unwrap or any function that has the potential to voluntarily panic we should be using results. Consider the following potentially erroneous code:

fn do_read(some_bytes: &[u8]) -> String {
    // read the first byte (length) of the string.
    let length = some_bytes[0];
    // now read for length
    let contents = &some_bytes(1..length);
    String::from_utf8(contents).unwrap()
}

This proposal would change the potentially erroneous code above to:

fn do_read(some_bytes: &[u8]) -> Result<String, ErrorEnum> {
    // read the first byte (length) of the string.
    let length = some_bytes[0]?;
    // now read for length
    let contents = &some_bytes(1..length);
    String::from_utf8(contents)?
}

Feat: RakNet

  • Responds to Offline Packets (0x0 - 0x1c)
  • Shakes the clients connection (Connection sequence) properly
  • Accumulates ACK, NACK packets.
  • Properly handles frames and NACK responses.

Migrate core to rust and maintain TS plugin api (Deno)

Questions & Answers

Why?

Rust is fast, and allows us to practice better memory practicing, allowing us to write efficient code with incredible speed.

So will the Deno Typescript code be discarded?

I plan on keeping a maintained branch with a similar api to the incoming changes for the rust version; this is because I am not set on removing the TypeScript version, as I think it would be a good reference for benchmarking the rust version, as well as offering an opportunity for more people to contribute to it.


Plugin API

While the core code will be migrated to rust, we will still be using a TypeScript plugin API integrated with Deno. The plugin API will be isolated, meaning each plugin will run in it's own "context" to allow full usage of Deno's "secure by default" motive as well as better control of developing and debugging plugins.

Please only use this issue for reporting issues with this change itself, for discussions refer to: #8

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.