Gamasutra: The Art & Business of Making Gamesspacer
View All     RSS
August 21, 2014
arrowPress Releases
August 21, 2014
PR Newswire
View All
View All     Submit Event





If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 
Hardware LightFX - a chance to enhance gaming experience?
by Rene Korte on 10/30/13 09:54:00 am

The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.

 

Gaming peripherals with lights built into them are a common find nowadays, but a keyboard with individually programmable LEDs underneath each key is a newcomer to the party. After a brief introduction we will cover some basic techniques on how to add support for such a device into your games, both from a developer and a game designer’s point of view. This article is intended to be the first in a series featuring advice on design considerations and small, practical examples for integrating lighting effects into your games.

 

For many years, hardware manufacturers and game companies have tried to develop more immersive games by making the hardware they are played on provide additional feedback outside of the pixels on the screen and the audio from the speakers. Classic arcade machines often feature game-specific hardware, such as light guns, steering wheels, whole starship cockpits, etc. Though those games have dated graphics and simplistic gameplay, the special controls still create a feeling of being in the game, which is something that modern PC and console games have yet to achieve.

In the nineties – shortly after releasing its N64 (codename: Ultra64) console to the market – Nintendo released a simple piece of hardware that is found in nearly every console game controller made since – the Rumble Pak. The simple add-on device for the N64 controller enhanced its functionality to include in-game vibration feedback. The device ate batteries faster than a Game Boy, but the added immersion while playing games was immense. Initially game designers struggled a little with implementing support for the new user feedback, either overusing or underusing it. Nintendo even tried to boost sales by including in-game features that required a Rumble Pak to access them (e.g. the 'Stone of Agony' in Zelda: Ocarina of Time). That was both an extreme and a brilliant marketing idea. Today, most players are irritated when games and controllers don’t have a rumble feature built in by default. To the younger readers out there: we had to buy the controller and the Rumble Pak separately, it was bigger than a portable 2.5'' HDD and it required us to constantly replace the batteries even though the controller was wired.

Another notable example of immersiveness is Philips’ Ambilight technology. It consists of several LEDs on the back of a TV monitor that shine on the wall behind the TV. The increased immersiveness is achieved by the LEDs interpolating the light color from the video signal on the screen and projecting it on the wall around the TV, conveying the feeling that the action on the TV extends a little further than the edge of the screen permits. The Ambilight creates a very nice atmosphere when playing console games with it. Ambilight is not controlled by the game itself, so it supports every game without any additional work – quite a solid technological advancement.

So, what about PC games? As mentioned above, many PC peripherals feature LED lights today, but are primarily aimed at matching a case modding style. If you’ve got a blue glowing gaming rig under your desk then you really need your mouse and keyboard to glow as well, right? But why not use those LEDs to actively enhance the in-game atmosphere? Let your mouse glow red when your health is low, make your keyboard blink when you take damage or make it go dark during an emotional and intense cutscene.

The sample product we are talking about today is the ROCCAT Ryos MK Pro mechanical keyboard. This keyboard does not simply have a standard lighting feature; it has 110 individually programmable LEDs that can be accessed and configured through software. The keyboard’s lights can be controlled completely by the game to show health, mana, damage, ammo, loading times and everything else game designers can put their imagination to.

Keep in mind that the Ryos MK Pro is one of the first of its kind; the technology itself is still being improved upon, and you can almost certainly expect future keyboards to feature even lower latency, full RGB color modes and whatever else hardware designers can make a reality.

But why not start now and add some awesome lighting effects to your game? The Ryos MK Pro SDK is designed to be simple yet powerful at the same time. We shall first talk about its capabilities after that we will give some details and examples about the programming part, which is something game programmers will find interesting.

Ryos MK Pro capabilities:

- Each key can be set to on or off
- Reaction time is about 30ms (due to hardware limits)
- The lighting configuration can be changed at any time

We already mentioned some ideas on what to use the LEDs of the keyboard for, so let us explore this a little further now. The gamer will almost certainly have his left hand covering WASD and his right hand clutching the mouse, so take a brief moment and shift your eyes a few inches down on your keyboard (that is of course, if you are reading this on a PC). This is what the gamer will be able to see.
A simple idea would be to light up WASD itself and if your game is a classic FPS: light up the number keys for the weapons the player has picked up. Make the active weapon key blink. Make the use key blink if there is something to be used. Why not make the whole keyboard a loading bar and light it up to full once the player reloads his weapon, or charges a spell? In most 3D games the player can be hit from all directions, so why not let the keyboard light up on the side the player is being hit from?

Yet always keep in mind that unless you (the game designer) make the player look at the keyboard, the player will most likely only perceive these effects in the peripheral field of vision, so try to avoid complex light configurations when you don't plan to give the player the time to look at them.

So much for inspiration, now we will try to take the tension off the poor coder that has to implement the effects the game designer has come up with. The Ryos MK Pro SDK is designed simply: a C++ header file and either a DLL or a static LIB. Integration in almost every C++ based engine should be straight forward. Other programming languages need to use their native code-binding capabilities or the currently in-development CLI executable as a last resort.

From a C++ programmer’s point of view – apart from including the header – only a few function calls are needed to start sending events to the Ryos MK Pro:

- a simple init ROCCAT Talk call, to see if there is a Ryos MK Pro keyboard present
- an init SDK mode call to the keyboard in order to activate the built-in effects

And then just send LED configurations as pleased. For example like this (code taken from SDK manual)

CROCCAT_Talk roccat;
    /* Try to connect to the Ryos */
    if (!roccat.init_ryos_talk()) {
        printf("Error: Could not connect to Ryos Keyboard!\n");
    } else {
        printf("Success: Connection established!\n");
        /* Activate SDK mode */
        roccat.set_ryos_kb_SDKmode(TRUE);
        
        /* Ensure all LEDS off */
        roccat.turn_off_all_LEDS();
        
        /* Turn on a single LED */
        roccat.set_LED_on(0); /* [Esc] */

        Sleep(1000); /* here should be game code */
        
        /* Give LED control back to system 
         * Note: this does also turn off all lights */
        roccat.set_ryos_kb_SDKmode(FALSE);
    }

 

Programmers should also keep an eye on how to gracefully ignore the Ryos MK Pro FX relevant code when no keyboard is connected or the user simply does not wish to see the game's built-in lighting effects.

The Ryos SDK documentation also features a full example on how to integrate some simple effects into an actual 3D game engine. The engine of choice is Wouter van Oortmerssen's Cube engine (as you might have already seen in the video above).

Although this engine is not latest technology, its basic code structure is similar to most common 3D engines and programmers should be able to find the code locations for integrating the example in their own engines without any problems. Hey, everyone has a drawGUI() or playerDamage() method somewhere in their code, right?

Please note that there is currently only a Windows version of the SDK available. (Don't worry: it will most likely be available for other operating systems in the future, too)

That's it for this article. We hope you enjoyed reading it, and that you are eager to try out integrating some cool lighting effects into your game. Stay tuned for our follow-up article on how to code colored lighting effects with ROCCAT Talk and the full-featured article on how to use ROCCAT Power-Grid as a second screen solution for your game.

 


Related Jobs

Retro Studios - Nintendo
Retro Studios - Nintendo — Austin, Texas, United States
[08.21.14]

Gameplay Engineer
Trion Worlds
Trion Worlds — Redwood City, California, United States
[08.21.14]

Senior Gameplay Engineer
GREE International
GREE International — San Francisco, California, United States
[08.21.14]

Senior Software Engineer, Unity
GREE International
GREE International — San Francisco, California, United States
[08.21.14]

Engineering Manage - Game Server






Comments



none
 
Comment: