Code Monkey home page Code Monkey logo

vkquake2's Introduction

Overview

This is the official Quake 2 code v3.21 with additional Vulkan renderer. The goal is to maintain as much compatibility as possible with the original game, so there are no fancy visual upgrades here - just pure, vanilla Quake 2 experience as we knew it back in 1997. There are, however, a few notable differences that made the cut for various reasons:

  • original compiler warnings have been fixed
  • 64 bit support has been added
  • M_DrawTextBox function is being called slightly differently without resorting to ending the frame prematurely
  • debug build comes with additional cmd console for debugging purposes when no visuals are available
  • 1920x1080, 2560x1440, and 3840x2160 screen resolutions have been added and the game is now DPI aware
  • mouse acceleration has been disabled
  • console contents can be scrolled with mouse wheel
  • behavior of video menu has been altered so that pressing escape does not restart the rendering system
  • HUD elements, menus and console text are now scaled accordingly on higher screen resolutions (can be overridden with hudscale console command)
  • warped texture effect (lava, water, slime) is now properly drawn (though only with Vulkan and software renderer!)
  • software renderer has been completely replaced with KolorSoft 1.1 - this adds colored lighting and fixes severe instabilities of the original renderer
  • on first launch, the game attempts to use Vulkan at 1920x1080 resolution by default
  • on Linux, sound is now handled by ALSA instead of OSS

Building

For extra challenge I decided to base vkQuake2 on the original id Software code. Because of this, there are no dependencies on external SDL-like libraries and the entire project is mostly self-contained. This also implies that some of the original bugs could be present - those may be fixed in upcoming releases.

Windows

  • download and install Vulkan SDK - make sure that the VULKAN_SDK environment variable is set afterwards
  • install Visual Studio Community with the MFC package
  • install Windows Universal CRT SDK and Windows SDK 8.1 or just the latest Windows 10 SDK (the latter will require retargetting the solution)
  • open quake2.sln and choose the target platform (32/64bit) - it should build with no additional steps required

Linux

Unfortunately, Linux code for Quake 2 has not aged well and for that reason only the Vulkan renderer is available for use at this time. Build steps assume that Ubuntu is the target distribution:

  • install required dependencies:
sudo apt install make gcc g++ mesa-common-dev libglu1-mesa-dev libxxf86dga-dev libxxf86vm-dev libasound2-dev libx11-dev libxcb1-dev
  • install Vulkan SDK - the easiest way is to use LunarG Ubuntu Packages - just follow instructions and there will be no additional steps required. If you decide to manually install the SDK, make sure proper environment variables are set afterwards - the easiest way is to add a section to your .bashrc file which may look similar to this:
export VULKAN_SDK=/home/user/VulkanSDK/1.1.92.1/x86_64
export PATH=$VULKAN_SDK/bin:$PATH
export LD_LIBRARY_PATH=$VULKAN_SDK/lib:$LD_LIBRARY_PATH
export VK_LAYER_PATH=$VULKAN_SDK/etc/explicit_layer.d
  • make sure your graphics drivers support Vulkan (run vulkaninfo to verify) - if not, you can get them with:
sudo apt install mesa-vulkan-drivers
  • in the main repository, enter the linux subfolder and type make release or make debug depending on which variant you want to build - the output binaries will be placed in releasex64 and debugx64 directories respectively

Running

Windows

The Visual Studio 2017 C++ Redistributable is required to run the application: 32 bit or 64 bit depending on the chosen flavor. These are provided automatically if you have Visual Studio 2017 installed.

All platforms

You'll need proper data files to run the game - the release packages come with game data used in the demo version. For full experience, copy retail Quake 2 data paks (pak0.pak, pak1.pak, pak2.pak) into the baseq2 folder and run the executable. The mission packs have not been tested but should work just as well.

Console commands

The Vulkan renderer comes with a set of its own additional console commands:

Command Action
vk_validation Toggle validation layers.
0 - disabled (default in Release)
1 - only errors and warnings
2 - full validation (default in Debug)
vk_strings Print some basic Vulkan/GPU information.
vk_device Specifiy preferred Vulkan device index on systems with multiple GPUs.
-1 - prefer first DISCRETE_GPU (default)
0..n - use device #n (full list of devices is returned by vk_strings command)
vk_msaa Toggle MSAA.
0 - off (default)
1 - MSAAx2
2 - MSAAx4
3 - MSAAx8
vk_flashblend Toggle the blending of lights onto the environment. (default: 0)
vk_polyblend Blend fullscreen effects: blood, powerups etc. (default: 1)
vk_skymip Toggle the usage of mipmap information for the sky graphics. (default: 0)
vk_finish Inserts vkDeviceWaitIdle() on render start (default: 0).
Don't use this, it's just for the sake of having a gl_finish equivalent.
vk_point_particles Use POINT_LIST to render particles, textured triangles otherwise. (default: 1)
vk_particle_size Rendered particle size. (default: 40)
vk_particle_att_a Intensity of the particle A attribute. (default: 0.01)
vk_particle_att_b Intensity of the particle B attribute. (default: 0)
vk_particle_att_c Intensity of the particle C attribute. (default: 0.01)
vk_particle_min_size The minimum size for a rendered particle. (default: 2)
vk_particle_max_size The maximum size for a rendered particle. (default: 40)
vk_lockpvs Lock current PVS table. (default: 0)
vk_clear Clear the color buffer each frame. (default: 0)
vk_modulate Texture brightness modifier. (default: 1)
vk_shadows Draw experimental entity shadows. (default: 0)
vk_picmip Shrink factor for the textures. (default: 0)
vk_round_down Toggle the rounding of texture sizes. (default: 1)
vk_log Log frame validation data to file. (default: 0)
vk_dynamic Use dynamic lighting. (default: 1)
vk_showtris Display mesh triangles. (default: 0)
vk_lightmap Display lightmaps. (default: 0)
vk_texturemode Change current texture filtering.
VK_NEAREST - nearest filter, no mipmaps
VK_LINEAR - linear filter, no mipmaps
VK_MIPMAP_NEAREST - nearest filter with mipmaps
VK_MIPMAP_LINEAR - linear filter with mipmaps (default)

Known Issues

Some Intel UHD GPUs (most notably the 6XX series) may encounter crashes on startup due to faulty drivers - this has been confirmed by Intel to affect dual-GPU setups.

vkquake2's People

Contributors

kondrak avatar mgrinzplayer avatar tyfighter avatar

Watchers

James Cloos avatar

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.