Skip to content
/ zen Public

A Game Engine for 3D old school games. Supports Gothic 1 & 2 Game File Formats.

License

Notifications You must be signed in to change notification settings

MordragT/zen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zen - Game Engine

The zen game engine started as port of the Zenlib in Rust, but has since then matured into a own game engine with the capability to load different Fileformats used in the original Gothic Games, respectively the Zengine.

  • At the moment you can open VDFS-Archives, and export Multiresolution-Meshes (.mrm) aswell as normal Zengin-Meshes (.msh) from the archives to gltf files.
  • The corresponding textures will also be exported (similiar to dds textures), or you can export those textures one by one aswell.
  • I am working on the export of Zengin World Scenes (.zen) to gltf and a Daedalus (scripting language) virtual machine to execute the bytecode.
  • Expect breaking changes

Links

Examples

Vdfs Archive

use std::{fs::File, io::Write};
use zen_archive::Vdfs;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let vdf_file = File::open("/home/user/../Gothic II/Data/Sounds.vdf")?;
    let vdf = Vdfs::new(vdf_file)?;
    let entry = vdf.get_by_name_slice("CHAPTER_01.WAV").unwrap();
    let mut audio_file = File::create("/home/user/../files/audio/chapter_01.wav")?;
    audio_file.write(&entry.data)?;
    Ok(())
}

Daedalus Bytecode

use std::fs::File;
use zen_daedalus::prelude::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let file =
        File::open("/home/user/../Gothic II/_work/Data/Scripts/_compiled/CAMERA.DAT")?;

    let code = Code::new(file)?;
    let mut machine = Machine::new(code);
    machine.run();
    Ok(())
}

Multi Resolution Mesh

use std::{convert::TryFrom, fs::File, io::Cursor};
use zen_archive::Vdfs;
use zen_mesh::{gltf, mrm::MrmMesh, GeneralMesh};
use zen_types::path::INSTANCE;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let vdf_file = File::open(INSTANCE.meshes())?;
    let vdf = Vdfs::new(vdf_file)?;
    let mesh_entry = vdf
        .get_by_name("ORC_MASTERTHRONE.MRM")
        .expect("Should be there!");
    let cursor = Cursor::new(mesh_entry.data);
    let mesh = MrmMesh::new(cursor, "ORC_MASTERTHRONE")?;
    let mesh = GeneralMesh::try_from(mesh)?;
    let _gltf = gltf::to_gltf(mesh, gltf::Output::Binary);
    Ok(())
}

Mesh

use std::{convert::TryFrom, fs::File, io::Cursor};
use zen_archive::Vdfs;
use zen_mesh::{gltf, msh::MshMesh, GeneralMesh};
use zen_types::path::INSTANCE;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let vdf_file = File::open(INSTANCE.meshes())?;
    let vdf = Vdfs::new(vdf_file)?;
    vdf.filter_list("MSH");
    let mesh_entry = vdf.get_by_name("MFX_FEAR4.MSH").expect("Should be there!");
    let cursor = Cursor::new(mesh_entry.data);
    let mesh = MshMesh::new(cursor, &mesh_entry.name)?;
    let mesh = GeneralMesh::try_from(mesh)?;
    let _gltf = gltf::to_gltf(mesh, gltf::Output::Binary);
    Ok(())
}

License

  • MIT

About

A Game Engine for 3D old school games. Supports Gothic 1 & 2 Game File Formats.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages