15
Linux as a gaming platform Ideology aside 14-07-2013 Leszek Godlewski Generalist Programmer [email protected] www.thefarm51.com ERRATA

Linux as a gaming platform - Errata

Embed Size (px)

DESCRIPTION

Errata to my Digital Dragons 2013 talk: http://www.slideshare.net/LeszekGodlewski/linuxgames

Citation preview

Page 1: Linux as a gaming platform - Errata

Linux as a gaming platformIdeology aside

14-07-2013

Leszek GodlewskiGeneralist [email protected]

www.thefarm51.com

ERRATA

Page 2: Linux as a gaming platform - Errata

2I stand corrected!

www.thefarm51.com

On April 19, 2013 I gave a talk on game development for Linux at the Digital Dragons European Games Festival. In it, I made a couple of mistakes and omissions that I hereby would like to correct.

2

Page 3: Linux as a gaming platform - Errata

3What if SDL doesn't cut it?

www.thefarm51.com

Despite its awesomeness, SDL has its shortcomings● No explicit GLX/WGL context data sharing

and no direct context access→ no threaded rendering ☹

(hit this corner while porting Painkiller HD)● No 3D positioning or DSP support in the

stock SDL audio subsystem- Partially remedied by SDL_mixer

But we need those! Now what?!Original slide 24

Page 4: Linux as a gaming platform - Errata

4What if SDL doesn't cut it?

www.thefarm51.com

Despite its awesomeness, SDL has its shortcomings● No explicit GLX/WGL context data sharing

and no direct context access→ no threaded rendering ☹

(hit this corner while porting Painkiller HD)● No 3D positioning or DSP support in the

stock SDL audio subsystem- Partially remedied by SDL_mixer

But we need those! Now what?!Original slide 24

Page 5: Linux as a gaming platform - Errata

5OpenGL context sharing in SDL2

www.thefarm51.com5

It actually is possible!

● Just undocumented... ☹ Only mention I could find in Google is the May 2012 commit that introduces the feature

● Needs an SDL OpenGL attribute set before window creation:SDL_GL_SetAttribute( SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);

● Voila - all contexts created from now on with SDL_GL_CreateContext() will share data with the currently bound context (buffers, shaders etc.)!

Page 6: Linux as a gaming platform - Errata

6OpenGL context sharing in SDL2

www.thefarm51.com

I re-read the Valve slides about porting their games to Linux, and noticed their renderer is multithreaded. I knew from elsewhere they are using SDL2, so I thought I should check the source code, not just the SDL2 documentation.

As soon as I found out about my mistake, I rewrote the Painkiller Hell & Damnation client code to use SDL2, too. ☺

6

Page 7: Linux as a gaming platform - Errata

7Joystick/gamepad API

www.thefarm51.com

● Not part of X11 input event framework● Kernel block devices- Created as /dev/input/js*-Hotplug events via libudev (also in Steam

Linux Runtime)-Handled via open() and ioctl()-Detailed documentation in the kernel

http://kernel.org/doc/Documentation/input/joystick-api.txt

Original slide 28

Well, yeah,

Well, yeah, but...

but...

Page 8: Linux as a gaming platform - Errata

8SDL2 joystick and controller APIs

www.thefarm51.com8

Why hurt yourself with the low-level kernel joystick interface and libudev?

Page 9: Linux as a gaming platform - Errata

9SDL2 joystick and controller APIs

www.thefarm51.com9

Joystick API● Support for axes, buttons, hats and trackballs● State polling or events● Hotplugging● Force feedback via the haptic SDL2 subsystem

Page 10: Linux as a gaming platform - Errata

10 SDL2 joystick and controller APIs

www.thefarm51.com10

Game controller API● Built on top of the joystick API● Maps any joystick/gamepad input to a layout

modelled after the Xbox 360 controller● Built by Valve with Steam Big Picture in mind● Bindings may be imported/exported via strings● Popular controllers have built-in mappings

● API very similar to the regular joystick API, but buttons and axes are identified by enumerations● SDL_GameControllerAxis● SDL_GameControllerButton

Page 11: Linux as a gaming platform - Errata

11 Where do I put the files?

www.thefarm51.com

● Windows-Game data and binaries: C:\Program Files-User data: %APPDATA%, Documents...-AoS-like organization

● Linux (conventional)-Game binaries: /usr/bin/, /usr/games/-Game data: /usr/share/games/-User data: $HOME/.config/

($XDG_CONFIG_HOME environment variable)

- SoA-like organization- Filesystem Hierarchy Standard

Original slide 42

Well, yeah,

Well, yeah, but...

but...

Page 12: Linux as a gaming platform - Errata

12 Where do I put the files?

www.thefarm51.com

● FHS mainly concerns distro packages● Proprietary software often installs into

/opt/<package name>/(“Add-on application software packages”)

● Proprietary software also often installs “wherever”

● Steam games live in ~/.steam/steam/SteamApps/

● Just put game data and binaries in one place, and save user data to ~/.config/

Original slide 43

Well, yeah,

Well, yeah, but...

but...

Page 13: Linux as a gaming platform - Errata

13 $XDG_CONFIG_HOME and friends

www.thefarm51.com13

● Actually, $XDG_CONFIG_HOME (a.k.a. $HOME/.config) is a for textual configuration files

● User data, which is a more accurate description for savegames, DLC etc., goes into $XDG_DATA_HOME (defaults to $HOME/.local/share)

● All of this is regulated by a FreeDesktop.org standard:http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

Page 14: Linux as a gaming platform - Errata

14 Summary

www.thefarm51.com14

That's all, folks, for now. Sorry for not getting this errata out earlier – at The Farm 51 we're very busy finishing Deadfall Adventures. What do you think, should it be coming to Linux as well? ☺

If you spot any more mistakes, feel free to shoot me an email.

Many thanks to Michael Larabel at Phoronix for blowing up my Slideshare with all the traffic from their news story. ☺

Keep on playing, Linux gamers!

Page 15: Linux as a gaming platform - Errata

15

Thank you!

Like us on Facebook!http://www.facebook.com/farm51http://www.facebook.com/deadfalladventureshttp://www.facebook.com/PainkillerGame

[email protected]

www.thefarm51.com