Code Monkey home page Code Monkey logo

phoenix-studio's Introduction

phoenix studio logo

phoenix studio

Build License C++ Platforms

Here be dragons! phoenix studio is currently in very early development. Bugs are expected and might be very common.

phoenix studio aims to implement a fully featured development environment for ZenGin applications. The ZenGin was a game engine created by Piranha Bytes for their early-2000s games Gothic and Gothic II. Currently, it contains simple command-line utilities for reading and converting data files used for Gothic and Gothic II.

If you have any questions you can open a discussion on this repo or contact me on Discord, ideally by pinging me (lmichaelis#6242) in the GMC Discord in the tools channel.

contributing

If you'd like to contribute, please read contributing first.

currently available tools

phoenix studio comes with some tools to inspect and convert the ZenGin's file formats. The following is a list of all tools currently available:

Name Description
zdump Dump information about various files.
zmodel Convert MRM, MSH, MMB, MDL and MDM files as well as world meshes into the Wavefront model
zscript Display, disassemble and decompile compiled Daedalus scripts (similar to objdump).
ztex Convert TEX files to TGA
zvdfs Extract and list contents of VDF files.

building

phoenix studio is currently only tested on Linux and while Windows should be supported you might run into issues. If so, feel free to create an issue or open a merge request. You will need

  • A working compiler which supports C++17, like GCC 9
  • CMake 3.10 or above
  • Git

To build phoenix studio from scratch, just open a terminal in a directory of your choice and run

git clone --recursive https://github.com/lmichaelis/phoenix-studio
cd phoenix
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

You will find the tool binaries in build/bin and the library in build/lib.

licensing

While the source code of phoenix studio is licensed under the MIT license, the phoenix studio logo is licensed under CC BY-NC 4.0.

phoenix-studio's People

Contributors

lmichaelis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

phoenix-studio's Issues

[zscript] Decompiler does not correctly handle `if ... else` with nested `if`s

Originally mentioned by @auronen in the GMC Discord (also see auronen/DecDat#2).

Original

func void B_SetNpcVisual (var C_NPC slf, var int gender, var string headMesh, var int faceTex, var int bodyTex, var int armorInstance)
{
	slf.aivar[AIV_Gender] = gender;

	Mdl_SetVisual (slf,"HUMANS.MDS");

	if (gender == MALE)
	{
               Mdl_SetVisualBody (slf,	"hum_body_Naked0", 	bodyTex,	0,			headMesh, 	faceTex,	0, 			armorInstance);
		
		if (slf.attribute[ATR_STRENGTH] < 50)
		{
			Mdl_SetModelScale		(slf, 0.9, 1, 1); 			//BREITE / Höhe / Tiefe
		};

		if (slf.attribute[ATR_STRENGTH] > 100)
		{
			Mdl_SetModelScale		(slf, 1.1, 1, 1);			//BREITE / Höhe / Tiefe
		};
	}
	else //gender == FEMALE
	{
		if (bodyTex >= 0) && (bodyTex <= 3) //MännerBodyTex angegeben
		{
			bodyTex = bodyTex + 4; // Females haben Variation 4-7 (Males 0-3)
		};
		Mdl_SetVisualBody (slf,	"Hum_Body_Babe0", 	bodyTex,	0,			headMesh, 	faceTex,  	0,			armorInstance);
	};
};

Decompiled

func void B_SETNPCVISUAL(var C_NPC SLF, var int GENDER, var string HEADMESH, var int FACETEX, var int BODYTEX, var int ARMORINSTANCE) {
    SLF.AIVAR[17] = GENDER;
    MDL_SETVISUAL(SLF, "HUMANS.MDS");
    if ((GENDER) == (MALE)) {
        MDL_SETVISUALBODY(SLF, "hum_body_Naked0", BODYTEX, 0, HEADMESH, FACETEX, 0, ARMORINSTANCE);
        if ((SLF.ATTRIBUTE[4]) < (50)) {
            MDL_SETMODELSCALE(SLF, 1063675494, 1065353216, 1065353216);
        };
        if ((SLF.ATTRIBUTE[4]) > (100)) {
            MDL_SETMODELSCALE(SLF, 1066192077, 1065353216, 1065353216);
        };
    };

    // -----------------------------------------------------
    if (((BODYTEX) >= (0)) && ((BODYTEX) <= (3))) {
        BODYTEX = (BODYTEX) + (4);
    };
    MDL_SETVISUALBODY(SLF, "Hum_Body_Babe0", BODYTEX, 0, HEADMESH, FACETEX, 0, ARMORINSTANCE);
}

Dumping world mesh into .obj files - inverted X and Z axis

Hi,

I'm not sure if you are aware of this, but in Gothic .zen file for some reason the vertices in world mesh are stored in a funny order, that is: Z, Y, X. Therefore, when you dump world mesh inso .obj file you must consider that when writing v ... ... ... line to the file.

So here:

out << "v " << item.x << " " << item.y << " " << item.z << "\n";

it should rather be out << "v " << item.z << " " << item.y << " " << item.x << "\n";,
but only in case if we are dealing with world mesh. (I think other meshes have the proper order)

The world mesh .obj file rendered currently:
image
as you can see the world looks as if seen in a mirror - things that should be on the left side are on the right. Moreover, both the normal vectors (the vn ... ... lines in .obj) and texture coordinates (the vt ... ... lines) seem to be defined with the above assumptions regarding the vertice orders. Hence, you can notice some strange artifacts when rendering, like objects being seen through, objects being lit on the bottom even though I set a source of directional sun light from above the scene, etc.

Here is how the .obj file is rendered after making the change in the source code:
image
looks correct.

Cheers :)

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.