Saturday, November 19, 2011

Advanced RetroArch Configuration Options

Update (4/23/2012): SSNES has changed its name to reflect its versatility beyond SNES emulation. The new name is RetroArch and this article has been updated to reflect the change.

This guide picks up from where the basic guide left off, so if you haven't read it yet, you should.

In the main window, you can choose whether to save a BSV movie, which is basically a small file that logs all of your keypresses when you play. You can later take this file and replay it back like a sort of movie. This can be used to share your gameplay with others without the necessity of passing around gigantic files.

Below that, we have FFmpeg movie output, which allows you to dump actual video files using state-of-the-art, lossless RGB x264 with FLAC audio. The files can be quite large, but are appropriate for high-quality recording for things like speed runs. Currently, only *.mkv files are supported, so if you want to use this feature, make sure your file name ends in mkv. This feature can be used in conjunction with BSV playback to simplify recording speed runs, etc.

General

At the top of the main window, you'll see a menu labeled Settings. From there, click on General, and it should open a window that looks like this:
The first entry, Enable rewind, is what toggles on the ability to use real-time rewind, similar to what you find in the popular indie game Braid.

The next few options are for special use cases and can generally be ignored (the defaults are usually fine).

The next option I want to point out is Records filtered output, which will make the aforementioned mkv video dumps capture the image *after* filters (but not shaders) are applied, so your video will look as fancy as what you see on your screen. Below that, you have fields to load XML cheat databases, such as those used in bsnes, and below that you have some entries to specify paths for various additional files, such as save data and screenshots, that RetroArch creates. If left blank, these will default to the folder the ROM is loaded from.

Video
From here, you can choose your desired video driver. For most people, OpenGL (the default), will be fine and I will assume that's the one you'll use for the remainder of this tutorial. However, if OpenGL doesn't work for you, you can choose the slow and crappy (but reliable) SDL driver, or the D3D driver (not available in Linux, of course).

Windowed X and Y scale let you set custom sizes for the emulator window, while Fullscreen X and Y resolutions let you set custom resolutions in fullscreen (leaving it at 0 will attempt to scale the window as large as possible).

Checking VSync will cap your framerate to your monitor's refresh rate (a good thing, or else the emulator will run as fast as it can...).

Start in fullscreen is self-explanatory, and you probably want to leave Force 16-bit color turned off.

Disable composition (Win Vista/7) will automatically turn off Aero transparency, which can conflict with VSync in windowed mode (makes video stuttery), but doesn't affect fullscreen.

Bilinear filtering will add a slight blur to the image to take the edge off of the hard pixel edges (also known as smooth video in some emulators). This option has very little impact on performance.

Lock aspect ratio will ensure that the image is always a given aspect ratio (default is 8:7, assuming square pixels). You can also enter a custom aspect ratio (in decimal format, such as 1.333333 for 4:3 assuming non-square pixels) in the window next to the Aspect ratio entry farther down.

Crop overscan cuts off a few pixels around the edges of the image that were customarily left blank by developers and sometimes contain garbage pixels.

Below that, we have Shader/filter settings, which opens the advanced shader and filter settings window, and at the bottom we have Font settings which opens the advanced preferences for the onscreen text display.

Shader and Filter Settings

This is where RetroArch gets its bling:
The first entry, Cg pixel shader, allows you to load pixel shaders in Nvidia's Cg format. Below that, you can load bSNES XML shaders (deprecated in bsnes with v083, but RetroArch still supports them). The Cg shader format works with both OpenGL and D3D drivers, which is nice, but the selection is more limited than with the more common bSNES XML shaders.

The XML shader directory option allows you to select a folder that contains XML shaders that will be loaded in sequence when you press the assigned hotkey.

Checking the box by Render-to-texture (2-pass rendering) allows you to "stack" an additional XML pixel shader for additional effects. If you enable this, the FBO X and Y Scale fields allow you to specify a scale factor for the first-pass pixel shader. This often doesn't make a huge difference, but it can help with certain shaders that are intended to be calculated at a specific scale, such as HQ2x. Bilinear filtering (2. pass) applies the same slight blurring as before, but this setting ensures that you have fine control over how much blurring occurs and when. Finally, the Shader (2. pass) field is where you select the desired shader for the second pass.

The last field, bSNES video filter, allows you to apply CPU-powered filter libraries from bsnes (like XML shaders, they were deprecated in bsnes as of v083, but RetroArch still supports them), such as blargg's kickass NTSC filter.

You can download a number of Cg shaders from my Mediafire Cg repo, while XML shaders can be downloaded from Screwtape's XML shader repo and/or my Mediafire XML repo.

This page has preview pics for most of the XML shaders and a link to Themaister's WebGL shader testing applet.

You can download bsnes video filters for Windows here (32-bit) and here (64-bit) and for Linux here (32-bit) and here(64-bit).

Font Settings

With the On-screen message font entry, you can load a custom Truetype Font for RetroArch to display onscreen, while On-screen font size specifies the font size in points.

Enable on-screen messages is pretty self-explanatory. Uncheck to disable onscreen messages from  RetroArch.

On-screen message pos lets you specify custom X and Y axis positions for onscreen text, and Message color (RGB hex) determines the the color of the text in hex format. You can use an online color picker like this one to get your desired color in the proper format.

Audio


The first option is self-explanatory. Uncheck it to completely disable audio.

Audio driver is also pretty straightforward. DirectSound is usually the most compatible in Windows, but XAudio2 has lower latency and is often less buggy. In Linux, ALSA is what I use, but many speak highly of OSS.

With the External audio driver option, you can choose a custom driver that conforms to the RetroArch plugin API, but the only one available at the time of this writing is Themaister's experimental WASAPI driver. Below that, you can specify an Audio DSP plugin, which can potentially provide reverb and echo effects, etc. Mudlord has written a few of these, which even come with a fancy Qt GUI.

Audio sample rate should be set to match your computer's sound card output rate, which is usually the default 48 kHz.

Audio input rate can be confusing at first but is awesome once you get it set up (like RetroArch itself :P). Basically, as the emulator chugs away, it creates video frames at a rate of 60 per second and audio at an ideal rate of 32,040 samples per second. However, modern LCD monitors rarely have a true 60 Hz refresh rate, so, when displayed with VSync enabled on such a display, the audio and video will get faintly out of sync and cause either a video frame to drop (manifested as a stutter in the video) or a crackle in the audio. The default value of 31,980 is a closer match to modern display refresh rates than the ideal rate, but you can nudge it higher--if your video still drops frames occasionally--or even lower if your audio continues to crackle.

Audio rate step specifies the granularity at which the audio rate increases or decreases when you press the corresponding hotkeys.

Dunno what Audio device does.

Audio sync is similar to VSync in that it keeps the framerate in synchronization with the audio. Keep it checked for best results.

Audio latency (ms) is pretty self-explanatory. The default value is usually fine.

Input Settings

The Input settings window is where you can assign buttons and/or keys.

The slider at the top, labeled Input axis threshold, determines at which point an analog control will register as a digital button-press.

Below that, you can choose whether or not to use Player 1 button/key assignments during netplay regardless of whether you're hosting the game or connecting to someone else.

The pulldown menu below that lists the categories of keys you can assign, including all of the available controller slots from Player 1 to Player 5 and the miscellaneous RetroArch functions, like rewind. You can bind any of these functions by double-clicking on its entry and then pressing the appropriate key when prompted.

Last, the Detect analog checkbox determines whether analog inputs are even polled.

Netplay

Netplay is one of RetroArch's crown jewels and can be enabled via the main RetroArch-Phoenix window. We'll cover its configuration first and then go over some of the quirks you should be aware of.

If you check the box to enable netplay, you must specify whether you will be hosting (server) or joining (client) the game. If joining, you must also enter the host's IP address in the field below. Make sure your firewall is open on port 55435 (default; you can change it if you like) and that the port is forwarded in your router, if applicable. You can also specify 'spectator mode,' which will allow an arbitrary number of spectators to join and watch you play without being able to play themselves.

Delay frames denotes the maximum number of frames RetroArch will need to emulate at once to maintain synchonization due to actual network latency. You can figure out an appropriate ballpark for this number by pinging the other player and dividing the time (in milliseconds) by 16 (roughly the number of milliseconds in a frame from a game running at 60 fps).

Similar to the GGPO platform, RetroArch creates a constant stream of savestates which, along with button presses, are exchanged and compared between the server and client machines. If the savestates start to diverge, the game rolls back in time to a point where they both agree and then emulates the missing frames all at once to get back to the appropriate spot. This gives the illusion of completely lagless inputs, which is invaluable for twitchy, fine controls, such as parrying in Street Fighter III: Third Strike.

The downside to this method is that sound is almost always crackly and it can sometimes create odd time-rollback isues (hard to explain, but you'll know them when you see them ;P). It also produces occasonal spikes in CPU utilization as the emulator needs to emulate a series of frames all at once to catch up after a rollback.

If the gameplay is a bit choppy, try increasing the number of delay frames a bit. If you try to connect to a server and it immediately says client disconnected, open your log and make sure your ROMs match exactly (it will complain about a hash mismatch otherwise). If it gives you a weird time-out error, just close the window and try to connect again and it should work itself out (sometimes excessive spikes in network latency can cause the states to diverge catastrophically, resulting in this error).

It is also important to note that netplay does not work with all libsnes implementations. Known working implementations include snes9x (and the -next variant) and FBA's CPS3 driver (e.g., for SFIII: Third Strike). Other implementations may work, but you'll have to try them yourself (please leave a comment with your experiences if other implementations work/fail). Often, RetroArch won't show a disconnection if things desync during netplay and will instead show either a non-moving second player, or his/her behavior will be weird (like jumping into holes, running into enemies, etc.).

No comments:

Post a Comment