We’ve always felt at libretro that RetroArch is a platform that is agnostic to emulators. That is, the libretro API is not in any way tied to emulators and allows for far more applications to be ported beyond just emulators. So it’s always a delight to us when game engines get ported as libretro cores to add to the growing pool of non-emulator libretro cores. So it was music to our ears when the talented PS Vita homebrew coder Rinnegatamante graced us with a new libretro core – vitaQuake II! This is a port of a Quake II engine source port that he made originally for the PS Vita.

With this core, you will be able to play Quake II on RetroArch (or any libretro-compatible program for that matter).

YouTube videos coming later today showcasing the game running at both 60Hz and 120Hz!

Where to get it and for what platforms

The core is available right now on our buildbot. It will be only available for Windows PCs, Mac and Linux for now given the OpenGL fixed function requirements right now. We will see where we can go from here.

To install this core, in RetroArch’s Main Menu, go to Online Updater. First make sure your core info files are updated. Select ‘Update Core Info Files’.

After this is done, select ‘Core Updater’. From here, you can select ‘Quake 2 (vitaQuake 2)’ from the list and download it.

How to start Quake 2

You need to load Quake 2’s PAK0.PAK. This is usually found inside the Quake 2 directory’s ‘baseq2’ directory. Both the shareware version and the full version should work fine.

Information

It’s a very early version, and some bugs will still exist. Some examples:

  • If you want this to run with the regular gl driver, “Shared Hardware Context” needs to be enabled in Settings -> Core (you might need to enable Show Advanced Settings first in Settings -> User Appearance). The glcore driver on the other hand does not require you to enable this in order for the game to work as normal.
  • A savefile bug where after having selected New Game for the first time, starting it again after closing vitaQuake 2 for the first time will start you off at the beginning with all enemies already killed and the elevator button missing. In case this happens, you then need to go to the directory where your Quake 2 datafiles are, and manually delete the baseq2/save directory contents. Obviously this is very inconvenient and not at all intentional, so hopefully we can fix this soon.
  • After about 5/7 minutes, there might be a big freeze that can last for 5 seconds, after which the game will resume again. Obviously very nonideal and something we want to fix ASAP.

Technical details

Let us discuss some of the intricacies of this port:

  • Quake II dates back to an era where 3D graphics APIs and 3D video cards in general were truly in their infancy. Quake II makes use of a very limited subset of OpenGL 1.x. To complicate matters, right now the renderer is using some OpenGL 2.x functions as well such as glGetTexImage. We’ll have to see where we go from here – mobile would need a renderer that is at least compatible with GLES2, which means making use of non-fixed function vertex and pixel shaders, while on the other hand we can see an exclusively OpenGL 1.x renderer being very useful for low end hardware such as the 3DS, PS Vita and PSP – all these platforms have an OpenGL 1.x wrapper to some degree that translates back to their native graphics APIs. Frangarcj and Rinnegatamante are discussing possibly adding an OpenGL 1.x hardware context to the libretro API that would make it possible to target these platforms. So perhaps the future of this port is multiple renderers so that we can cast a wide net in terms of compatibility.

    Long story short – for now, this renderer is making use of fixed function GL, so you’ll need to be on a desktop computer to run this for now.

  • The glcore video driver will run this core right now without having to enable ‘Shared Hardware Context’. To get it to run with the regular gl driver, you will need to enable ‘Shared Hardware Context’ inside Settings -> Core. You might need to enable ‘Advanced Settings’ first in Settings -> User Interface before this shows up.
  • The libretro core has been changed slightly from the original so that the Quake II frame logic operates in fixed timesteps. In normal Quake 2 ports, this is usually done with a timer which acts as the framerate limiter. In libretro instead, we can guarantee that each retro_run iteration is exactly one frame, so all we have to do is pass the exact timestep delta for the framerate we are to target to Qcommon_frame. This gives us a silky smooth framerate with minimal frametime deviations. This might complicate matters in terms of existing Quake 2 server compatibility, but we kinda figure that it’s not worth it having suboptimal performance and that the existing Quake 2 server pool is very limited anyway and that it has its own drawbacks in terms of performance as it stands (with hard caps on framerate – most servers cap at 60-70 fps).
  • Quake II in general seems to have a default framerate cap of 90fps. We want to make as many libretro game engine cores suitable for high refresh rate gaming as possible, so we’ve gotten rid of this cap. We’ve tested the game to be running flawlessly at 100Hz and 120Hz.
  • The UI in Quake II normally doesn’t scale, so at higher resolutions it would appear very small. Because it’s 2019 and not a lot of people play their games at 640×480 anymore, there is now UI scaling implemented so that the UI text popups will be readable at 1080p and beyond.
  • Rumble has been implemented and is available as a core option, just like it was in the PS Vita standalone version.

High refresh rate gaming with libretro/RetroArch


There has been an increased focus on making sure libretro game cores are all they can be when it comes to supporting higher refresh rates. So far we have already had the following libretro game cores that can run at higher framerates (>60fps):

  • Prboom (Doom 1/2 game engine core)
  • Cannonball (Outrun game engine core)
  • OpenLara (Tomb Raider game engine core)
  • Tyrquake (Quake 1 game engine core) (NEW)
  • vitaQuake2 (Quake 2 game engine core) (NEW)

Tyrquake and vita Quake2 are two recent additions to this list. In order to get them to run without audio crackling at higher refresh rates, we had to change the audio samplerate from 44Khz to 48Khz, which seemed to do the trick.

To further increase the convenience factor, we’ve also implemented a nifty feature in these libretro cores: support for libretro’s ‘preferred refresh rate’ option. Basically, if you leave the ‘Framerate’ option at ‘Auto’, the libretro core will look at RetroArch’s configured ‘refresh rate’, and it will use this for the framerate. This means that inside RetroArch, you can switch to a 1440p 120Hz mode with the Resolution setting, then start the core, and without having to configure the framerate, it will then run the game at 120fps. Likewise, if you then switch to a 4K resolution at 60Hz, and close and reload the Quake core, the game will automatically run at 60fps instead. So, with cores that support the ‘RETRO_ENVIRONMENT_GET_TARGET_REFRESH_RATE’ environment callback, you don’t have to keep switching back and forth between separate framerates inside the core – you can simply leave it at ‘Auto’ and RetroArch will do the rest.

This feature has not been added yet for OpenLara and Prboom, but we’ll do so soon.