M2RS is an experimental projet which targets to entierly rewrite the game Metin2 (an old Korean MMORPG) using pure Rust and wgpu.
- I love Metin2, Rust, Web, graphics programming and performance critical things
- I was looking for a challenging project
- Because I can and you've probably already heard « L'impossible n'est pas Français 🇫🇷 »
-
WASM
support -
GLTF
support- material
- mesh
- skeleton
- animation clip
-
AnimationMixer
- frames interpolation
- blend two clips when playing a new clip
-
Character
- allow characters to control it's own animation mixer (pc/npc basically have more than one "wait" animation, we must play them randomly)
- dynamic
Object3DInstance
loading using (main) character position - create character controller
- basic collisions (using 2d algorithms for performance reasons)
-
ThirdPersonCamera
- third person camera
-
BoneAttachement
- allow
Object3D
to be attached to a skeleton bone (hairs, weapons)
- allow
-
Terrain
- parse and generate terrain chunks
- shader
- shadows
- raycast to make characters walk above the ground
- objects
- trees
- water geometry
- water shader
-
Environment
- sun light that follow a realistic path between day and night
- environment colors
- fog
- clouds
- skybox
-
Particle system
- ???
-
CLI
- textureset.txt
- setting.txt
- areaambiencedata.txt
- areadata.txt
- areaproperty.txt
- property
- environment
GLTF
loader currently produces 4 skeletons if there is 4 skinned mesh linked to the same skeleton.- Water generation is currently slow due to vertices height comparaison between two planes without being equal in vertices count (HashMap set/get overhead)
To start the game, run the following command and Vulkan or Metal will be used for rendering depending on the platform (Windows, Linux or macOS).
cargo run --bin m2rs --release
In order to export both WASM and JS glue code, you will need to install wasm-pack.
cargo install wasm-pack
Then, you can use wasm-pack
command to export the game.
wasm-pack build --target web
Finally, use a live server to serve the content and open index.html on the selected port. I personnally use Live Server VSCode extension.
A CLI is available if assets need conversion. Currently supported conversions are:
textureset.txt
->textureset.json
In the future, this CLI will be used to optimize + encrypt assets.
cargo run --bin cli --release
All DDS files should be converted to PNG files. I usually do this with imagemagick:
find . -type f -name "*.dds" -exec mogrify -format png {} +
To convert FBX files to GLTF: