Ruby Doom

A Ruby gem that ports the classic Doom game to Ruby, focusing on core gameplay without sound or networking features.

Installation

Add this line to your application's Gemfile:

gem 'doom'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install doom

Requirements

  • Ruby 2.6 or higher
  • A legal copy of Doom for the WAD files (e.g., DOOM.WAD)

Usage

Command Line Interface

The gem includes two command-line tools:

WAD Explorer

The wad command allows you to explore WAD files:

# Show general information about a WAD file
$ wad -i DOOM.WAD

# List all maps in a WAD file
$ wad -l DOOM.WAD

# Show details for a specific map
$ wad -m E1M1 DOOM.WAD

# List all textures in a WAD file
$ wad -t DOOM.WAD

# Show details for a specific texture
$ wad -x STARTAN1 DOOM.WAD

# List all sprites in a WAD file
$ wad -s DOOM.WAD

# Show details for a specific sprite
$ wad -p TROOA1 DOOM.WAD

# Show help
$ wad -h

Game Launcher

The doom command allows you to start the game:

# Start the game with default settings
$ doom DOOM.WAD

# Start the game with a specific map
$ doom -m E1M1 DOOM.WAD

# Start the game with a custom window size
$ doom -w 800 -h 600 DOOM.WAD

# Start the game in fullscreen mode
$ doom -f DOOM.WAD

# Show help
$ doom --help

Ruby API

You can also use the Ruby API in your own code:

require 'doom'

# Load a WAD file
loaders = Doom.load_wad('path/to/DOOM.WAD')

# Access WAD information
wad_loader = loaders[:wad]
puts "WAD type: #{wad_loader.wad_type}"
puts "Number of lumps: #{wad_loader.lumps.size}"

# Access map information
map_loader = loaders[:maps]
puts "Available maps: #{map_loader.maps.join(', ')}"

# Load a specific map
map_data = map_loader.load_map('E1M1')
puts "Number of things in E1M1: #{map_data[:things].size}"

# Access texture information
texture_loader = loaders[:textures]
puts "Available textures: #{texture_loader.texture_names.join(', ')}"

# Access sprite information
sprite_loader = loaders[:sprites]
puts "Available sprites: #{sprite_loader.sprite_names.join(', ')}"

Features

Phase 1: WAD File Loader

  • WAD file parsing
  • Map data extraction
  • Texture information parsing
  • Sprite data handling

Phase 2: Rendering Engine (Current)

  • Window management
  • BSP rendering
  • Texture mapping
  • Sprite rendering
  • HUD implementation
  • Basic game loop

Future Phases

  • Game mechanics
  • Advanced game loop and state management
  • Polishing

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/khasinski/doom-rb.

License

The gem is available as open source under the terms of the MIT License.

Users must own a legal copy of Doom for the WAD files. This project complies with id Software's terms regarding Doom content.