Jump to content
  • entries
    943
  • comments
    5,899
  • views
    924,333

Project Workflows


Josh

1,466 views

 Share

It's funny how all of the various features in the new engine are interconnected and development just flows from one to another. I was working on terrain, and I needed to save out some texture data so I implemented Pixmaps, and I wanted to add Basis support and DXT decompression, and then I started converting texture formats, and now I need a way to manage this all. This is an idea I have had for several years and I finally got to try it out.

Leadwerks Game Engine 4 has a strictly defined workflow and it works well. If an image file is encountered it is converted to our own TEX texture file format. if an FBX file is encountered it is converted to our own MDL model file format. If a file change is detected by the editor, the source file is reconverted into the new file format, which is then loaded by your game. It works well and has been very reliable, but is somewhat limited.

The new engine is all about options. We support import and export plugins, and I plan to support modding for various games as well as regular game development. We have new formats like BASIS that no model files have textures stored as. I don't want to hard-code a bunch of file type overrides, so instead each project can have its own customized workflow. This is loaded from a JSON file, but a visual tool will be included in the new editor. The file data looks like this:

{
    "workflow":
    {
        "pipelines":
        [
            {
                "type": "TEXTURE",
                "includeFile": ["jpg","jpeg","bmp","tga","png","psd"],
                "preferFile": ["basis","dds"],
                "comments":
                [
                    "Prefers BASIS and DDS files over source images files, in that order, if they are newer than the original image."
                ]
            },
            {
                "type": "TEXTURE",
                "includeFile": ["r16"],
                "preferFile": ["dds"],
                "comments":
                [
                    "Prefers DDS files over R16 heightmap files, if they are newer than the original image."
                ]
            },
            {
                "type": "MODEL",
                "includeFile": ["*"],
                "preferFile": ["glb","gltf"],
                "comments":
                [
                    "Prefers binray and text GLTF files over all other model formats, in that order, if they are newer than the original model."
                ]
            },
            {
                "type": "SOUND",
                "includeFile": ["wav"],
                "preferFile": ["ogg","mp3"],
                "comments":
                [
                    "Prefers OGG and MP3 files over WAV, in that order, if they are newer than the original sound."
                ]
            }
        ]
    }
}

I created a script in the "Scripts/Start" folder with one line:

LoadWorkflow("Config/workflow.json")

According to the rules set out in the workflow scheme, any time LoadTexture() is called with a .tex file extension, if there is a .basis or .dds file in the same folder, and if that file is newer than the .tex file, or if the .tex file is missing, the engine will load that file instead. Under these conditions, if your code says this:

local tex = LoadTexture("Materials/Brick/brick01.tex")

You will see this printed output in the console:

Loading texture "Materials/Brick/brick01.basis"

Because this works internally in the texture load routine, the same goes for all material files and models that reference a .tex file. This will help bring all your projects forward to make use of new file formats like BASIS and GLTF, as well as new formats you might someday want to use.

In the future I plan to support converters in the workflow scheme as well, that the editor will detect and act upon. So for example if you were working on a map for one of the Source Engine games, the editor could be configured to automatically convert all texture files into Valve's VTF texture format. If you want to do something else I haven't accounted for yet, well you can do that too.

The packaging step will be configurable as well, so you can pack your game files into a ZIP archive or any other package file format you have a plugin for. For example, all your textures used in a scene could be packed into a WAD file for use with the game Quake so you can use modern tools for classic game mapping and mods.

With this setup, I was able to convert most of our sample textures to DDS and Basis, and all the example demos seamlessly loaded the preferred texture files and displayed perfectly.

  • Like 1
 Share

1 Comment


Recommended Comments

Adding the LOAD_NO_OVERRIDE load flag in any load command will prevent this system from changing the file extension.

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...