Giter Site home page Giter Site logo

rust.world's Introduction

Rust.World

Welcome to the Rust World SDK. In its current state it allows the creation of tools that load, visualize, edit and save Rust map files.

Getting Started

  • Shaders on loaded prefabs are only working in the deferred rendering path
  • The WorldExample class demonstrates how to load and work with a map file

rust.world's People

Contributors

andererandre 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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

rust.world's Issues

Trying to decode the LZ4 compression (Invalid magic number?)

As i am messing around, building a web based map editor, i have some issues decoding the LZ4 compression.

As the data from a map is:

<Buffer 08 00 00 00 01 80 80 40 97 8c 1d ff 09 08 ac 1b 12 90 c0 80 04 0a 07 74 65 72 72 61 69 6e 12 82 c0 80 04 99 39 02 00 ff ff ff ff ff ff ff ff ff ff ff ... >

The first 4 bytes are for the version (https://github.com/Facepunch/Rust.World/blob/master/Assets/Plugins/Rust.World/WorldSerialization.cs#L216) which should be 8 (<Buffer 08 00 00 00>), but after those 4 bytes, it starts with:

<Buffer 01 80 80 40 97 8c 1d ff 09 08 ac 1b 12 90 c0 80 04 0a 07 74 65 72 72 61 69 6e 12 82 c0 80 04 99 39 02 00 ff ff ff ff ff ff ff ff ff ff ff ... >

What should be decoded by LZ4 (https://github.com/Facepunch/Rust.World/blob/master/Assets/Plugins/Rust.World/WorldSerialization.cs#L220). However, when i checkout the documentation for LZ4 the frame should start with a magic number 0x184D2204 (see: https://github.com/lz4/lz4/wiki/lz4_Frame_format.md#general-structure-of-lz4-frame-format).

So, how can i read the map files?


Example

As i am writing this in the backend of a NodeJS application, this is how i try to decode it now:

import fs from 'fs';
import lz4 from 'lz4';

const data = fs.readFileSync('./map/proceduralmap.3500.26341726.169.map');
const map = data.slice(4); // Slice versioning number
const decoded = lz4.decode(map);
console.log(decoded);

// id magic number: 40808001 @0
//     at Decoder.emit_Error (/Users/kevin/dev/test/node-rust-map/node_modules/lz4/lib/decoder_stream.js:64:22)
//     at Decoder.read_MagicNumber (/Users/kevin/dev/test/node-rust-map/node_modules/lz4/lib/decoder_stream.js:93:8)
//     at Decoder._main (/Users/kevin/dev/test/node-rust-map/node_modules/lz4/lib/decoder_stream.js:289:25)
//     at Decoder._transform (/Users/kevin/dev/test/node-rust-map/node_modules/lz4/lib/decoder_stream.js:60:7)
//     at Decoder.Transform._read (_stream_transform.js:185:10)
//     at Decoder.Transform._write (_stream_transform.js:173:12)
//     at doWrite (_stream_writable.js:407:12)
//     at writeOrBuffer (_stream_writable.js:393:5)
//     at Decoder.Writable.write (_stream_writable.js:290:11)
//     at Decoder.Writable.end (_stream_writable.js:573:10)

Update LZ4 library

The old lz4net lib that is used in Rust is not maintained, and not compatible with official LZ4 Frame format specification. This produce a really obscure situation:
Map files can not be decompressed outside of C# environment (they can be serialized though, protobuf is available almost everywhere)

Newer version of lz4 library is available here: https://github.com/MiloszKrajewski/K4os.Compression.LZ4 (it is recommended by lz4net archived README). Legacy access method is already in the lib itself, which you can use to implement migration mechanism. Link: https://github.com/MiloszKrajewski/K4os.Compression.LZ4#legacy-lz4net-compatibility

I hope you will look into this for the sake of Rust being more open to modding

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.