Skip to content

faradaysage/Retro-WAD-Library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

WADLib - A Custom WAD File System for Bundling Game Assets

📌 Overview

WADLib is a custom asset bundling system inspired by id Software's DOOM WAD format. It allows packing multiple files into a single WAD archive, enabling efficient game resource management. This project was created before standard asset packaging libraries were available, demonstrating low-level file handling, memory management, and real-time file access.

🎯 Features

  • Custom File Packing & Extraction

    • Store multiple game assets in a single WAD archive.
    • Efficient file indexing for fast lookup and retrieval.
  • Real-Time File Access

    • Read assets directly from the WAD file without extraction.
    • Custom wad_fread(), wad_fseek(), and wad_fgetc() functions to mimic standard file operations.
  • Dynamic File Management

    • Add and remove files from the WAD archive.
    • Adjusts internal file offsets automatically to maintain integrity.
  • Optimized File I/O

    • Direct binary reads/writes for performance.
    • Efficient memory handling to prevent fragmentation.

🛠 How It Works

  1. Create a WAD File: Adds game assets into a single structured archive.
  2. Read Files in Real-Time: No need to extract—game resources can be accessed instantly.
  3. Manage Assets: Add or remove files dynamically without breaking the archive structure.

📁 Code Structure

  • WAD.H - Function prototypes and data structures.
  • WAD.C - Core library implementation (file management, memory handling, real-time access).

🚀 Why This Was Important

Before standard asset libraries (like ZIP, PAK, or VFS systems), game developers needed custom solutions for bundling assets. This reduced file clutter, optimized game loading times, and simplified resource management. WADLib showcases expertise in:

  • Low-level file I/O
  • Memory-efficient data structures
  • Custom serialization & asset management

🔧 How to Use

1️⃣ Creating a WAD File

WAD myWad("game_assets.wad");
myWad.AddFile("sprite.bmp");
myWad.AddFile("music.wav");
myWad.Save();

2️⃣ Reading a File from WAD

file_type *sprite = myWad.OpenFile("sprite.bmp");
if (sprite) {
    // Use sprite->buffer to access the file data
    myWad.CloseFile(sprite);
}

🏗 Compilation & Usage

  1. Compile with a C compiler (Borland, Watcom, or modern GCC with DOSBox).
  2. Run in a DOS environment (or an emulator like DOSBox).
  3. Link WAD.C into your game engine for real-time asset access.

📜 License

This project is open-source and available for educational use.

📧 Contact

For questions or further information, feel free to reach out.


🚀 WADLib is a great example of pre-built asset management solutions—perfect for studying real-time file bundling techniques in game development! 🎮

About

A custom WAD file system for packing and reading game assets in real-time. Inspired by id Software’s DOOM, this library provides a custom file structure, efficient asset management, and fast access to game resources. Developed before standard file packaging libraries, it showcases low-level file I/O, memory handling, and optimization techniques.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages