Skip to main content

Building Pipeline for video game assets

Project description

Asset Forge

credit: Dalle3

Asset Forge: CMake for video game assets. With this utility, you will be able to preprocess your asset files, which are human and tool-readable/usable, into binary files that can be directly streamed into C/C++ structs and classes. This process will streamline loading complex assets in small video game projects written in C/C++ or other systems languages.

Instead of linking several libraries dedicated to loading different types of files: meshes, animations, sprite sheets, and etc. Now you can just write a simple python script that loads in any complicated mesh/assimp file, optimize the mesh, do some precalculations for vertex normals and tangent vectors, then package it into a binary file that can be easily loaded in C/C++ by streaming the data into a struct or class that has a mirror structure to the binary file.


First define a Amake.py file:

import AssetForge
from amake import atlas, text, compress

from pathlib import Path

AssetForge.RegisterTool(compress.CompressTool(), 3) 
AssetForge.RegisterTool(atlas.AtlasTool(), 2)  
AssetForge.RegisterTool(text.TextTool(), 1)  
AssetForge.RegisterTool(AssetForge.common.General(), 0)  

AssetForge.Build(input_folder=Path("assets"), output_folder=Path("build"), recursive=True, parallel=True)

Then run:

python Amake.py

Note: amake in from amake import atlas, text, compress is a folder of scripts that define the specific instructions for preprocessing .txt, .atlas, and .bin files:

  • AtlasTool takes in a .atlas file which is just a json which defines the aabb of sprites in an image in a human readable json format, and outputs a .atlas.bin file which is binary that can be directly loaded into a std::vector of aabbs and a std::unordered_map<std::string, unsigned int> in C++
  • CompressTool takes .bin files (like .atlas.bin) and compresses them into .bin.z files
  • TextTool just copies all .txt files from input dir to the output dir
  • General is a base case which links every other file not captured by the other tools into the output dir from the input dir

The result of python Amake.py:

ls -R input_folder

assets/:
atlases  test.txt

assets/atlases:
atari_8bit_font.atlas  atari_8bit_font.png

python Amake.py
[0%  ] building ... 
[20% ] General "assets/atlases/atari_8bit_font.atlas"
[40% ] TextTool "assets/test.txt"
[60% ] General "assets/atlases/atari_8bit_font.png"
[80% ] AtlasTool "assets/atlases/atari_8bit_font.atlas"
[100%] CompressTool "build/atlases/atari_8bit_font.atlas.bin"
ls -R output_folder

build:
atlases  output.log  test.txt

build/atlases:
atari_8bit_font.atlas (link)  atari_8bit_font.atlas.bin  atari_8bit_font.atlas.bin.z (60% compression) atari_8bit_font.png (link)

check out exp for the full example of this.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

assetforge-0.1.2.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

AssetForge-0.1.2-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file assetforge-0.1.2.tar.gz.

File metadata

  • Download URL: assetforge-0.1.2.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for assetforge-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ac72d544c679062de93a4c60321b11b85e4fd4dd6b747b5d45c001dffb17265c
MD5 549a328763fdbb08f74261dd1e78a5ce
BLAKE2b-256 7abc961382e0036cb695df53a536bcbb75986303c058a1c4f01a4bfe4a3669e5

See more details on using hashes here.

File details

Details for the file AssetForge-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: AssetForge-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for AssetForge-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d32052a81bf3cc3135892ec13bf3a99743de4283d063f0b6e2ad1f5cc8835e1e
MD5 ddf7fdfe5a3860dc0c62ffdbd90ee277
BLAKE2b-256 3ad977cf40926c357092ab7f1ababeeb529d385ac959a6d19a46494796d60f1d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page