Linux as a gaming platform - Errata

Leszek Godlewski
Leszek GodlewskiEngine Programmer at Flying Wild Hog Cracow
Linux as a gaming platform
Ideology aside
14-07-2013
Leszek Godlewski
Generalist Programmer
leszek.godlewski@thefarm51.com
www.thefarm51.com
ERRATA
2
I 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
3
What 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
4
What 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
5
OpenGL 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.)!
6
OpenGL 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
7
Joystick/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
W
ell, yeah,
W
ell, yeah, but...
but...
8
SDL2 joystick and controller APIs
www.thefarm51.com8
Why hurt yourself with the low-level kernel joystick
interface and libudev?
9
SDL2 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
1
0 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
1
1 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
W
ell, yeah,
W
ell, yeah, but...
but...
1
2 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
W
ell, yeah,
W
ell, yeah, but...
but...
1
3 $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
1
4 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!
1
5
Thank you!
Like us on Facebook!
http://www.facebook.com/farm51
http://www.facebook.com/deadfalladventures
http://www.facebook.com/PainkillerGame
leszek.godlewski@thefarm51.com
www.thefarm51.com
1 of 15

Recommended

OpenGL (ES) debugging by
OpenGL (ES) debuggingOpenGL (ES) debugging
OpenGL (ES) debuggingLeszek Godlewski
1.7K views36 slides
Advanced Linux Game Programming by
Advanced Linux Game ProgrammingAdvanced Linux Game Programming
Advanced Linux Game ProgrammingLeszek Godlewski
74.9K views98 slides
Gamedev-grade debugging by
Gamedev-grade debuggingGamedev-grade debugging
Gamedev-grade debuggingLeszek Godlewski
1.3K views92 slides
Linux as a gaming platform, ideology aside by
Linux as a gaming platform, ideology asideLinux as a gaming platform, ideology aside
Linux as a gaming platform, ideology asideLeszek Godlewski
24.4K views49 slides
One Year of Porting - Post-mortem of two Linux/SteamOS launches by
One Year of Porting - Post-mortem of two Linux/SteamOS launchesOne Year of Porting - Post-mortem of two Linux/SteamOS launches
One Year of Porting - Post-mortem of two Linux/SteamOS launchesLeszek Godlewski
31.8K views44 slides
Digging for Android Kernel Bugs by
Digging for Android Kernel BugsDigging for Android Kernel Bugs
Digging for Android Kernel BugsJiahong Fang
4.6K views33 slides

More Related Content

What's hot

Software to the slaughter by
Software to the slaughterSoftware to the slaughter
Software to the slaughterQuinn Wilton
1K views35 slides
4Developers 2015: Gamedev-grade debugging - Leszek Godlewski by
4Developers 2015: Gamedev-grade debugging - Leszek Godlewski4Developers 2015: Gamedev-grade debugging - Leszek Godlewski
4Developers 2015: Gamedev-grade debugging - Leszek GodlewskiPROIDEA
244 views90 slides
Don't Give Credit: Hacking Arcade Machines by
Don't Give Credit: Hacking Arcade MachinesDon't Give Credit: Hacking Arcade Machines
Don't Give Credit: Hacking Arcade MachinesMichael Scovetta
7.9K views60 slides
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012) by
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)Matthias Brugger
10.9K views31 slides
Linux: the first second by
Linux: the first secondLinux: the first second
Linux: the first secondAlison Chaiken
692 views61 slides
Ice Age melting down: Intel features considered usefull! by
Ice Age melting down: Intel features considered usefull!Ice Age melting down: Intel features considered usefull!
Ice Age melting down: Intel features considered usefull!Peter Hlavaty
599 views64 slides

What's hot(20)

Software to the slaughter by Quinn Wilton
Software to the slaughterSoftware to the slaughter
Software to the slaughter
Quinn Wilton1K views
4Developers 2015: Gamedev-grade debugging - Leszek Godlewski by PROIDEA
4Developers 2015: Gamedev-grade debugging - Leszek Godlewski4Developers 2015: Gamedev-grade debugging - Leszek Godlewski
4Developers 2015: Gamedev-grade debugging - Leszek Godlewski
PROIDEA244 views
Don't Give Credit: Hacking Arcade Machines by Michael Scovetta
Don't Give Credit: Hacking Arcade MachinesDon't Give Credit: Hacking Arcade Machines
Don't Give Credit: Hacking Arcade Machines
Michael Scovetta7.9K views
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012) by Matthias Brugger
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
Matthias Brugger10.9K views
Ice Age melting down: Intel features considered usefull! by Peter Hlavaty
Ice Age melting down: Intel features considered usefull!Ice Age melting down: Intel features considered usefull!
Ice Age melting down: Intel features considered usefull!
Peter Hlavaty599 views
The Listening: Email Client Backdoor by Michael Scovetta
The Listening: Email Client BackdoorThe Listening: Email Client Backdoor
The Listening: Email Client Backdoor
Michael Scovetta1.3K views
Kernel Recipes 2014 - Writing Code: Keep It Short, Stupid! by Anne Nicolas
Kernel Recipes 2014 - Writing Code: Keep It Short, Stupid!Kernel Recipes 2014 - Writing Code: Keep It Short, Stupid!
Kernel Recipes 2014 - Writing Code: Keep It Short, Stupid!
Anne Nicolas1.8K views
Why kernelspace sucks? by OpenFest team
Why kernelspace sucks?Why kernelspace sucks?
Why kernelspace sucks?
OpenFest team1.7K views
Q4.11: Porting Android to new Platforms by Linaro
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new Platforms
Linaro4.4K views
Jollen's Presentation: Introducing Android low-level by Jollen Chen
Jollen's Presentation: Introducing Android low-levelJollen's Presentation: Introducing Android low-level
Jollen's Presentation: Introducing Android low-level
Jollen Chen2.5K views
Android Variants, Hacks, Tricks and Resources presented at AnDevConII by Opersys inc.
Android Variants, Hacks, Tricks and Resources presented at AnDevConIIAndroid Variants, Hacks, Tricks and Resources presented at AnDevConII
Android Variants, Hacks, Tricks and Resources presented at AnDevConII
Opersys inc.2.9K views
Alessandro Abbruzzetti - Kernal64 by Scala Italy
Alessandro Abbruzzetti - Kernal64Alessandro Abbruzzetti - Kernal64
Alessandro Abbruzzetti - Kernal64
Scala Italy2.5K views
Android Variants, Hacks, Tricks and Resources by Opersys inc.
Android Variants, Hacks, Tricks and ResourcesAndroid Variants, Hacks, Tricks and Resources
Android Variants, Hacks, Tricks and Resources
Opersys inc.3.6K views
Android Hacks, Variants, Tricks and Resources ESC SV 2012 by Opersys inc.
Android Hacks, Variants, Tricks and Resources ESC SV 2012Android Hacks, Variants, Tricks and Resources ESC SV 2012
Android Hacks, Variants, Tricks and Resources ESC SV 2012
Opersys inc.2.2K views
Inside Android's UI by Opersys inc.
Inside Android's UIInside Android's UI
Inside Android's UI
Opersys inc.7.6K views
Build your own embedded linux distributions by yocto project by Yen-Chin Lee
Build your own embedded linux distributions by yocto projectBuild your own embedded linux distributions by yocto project
Build your own embedded linux distributions by yocto project
Yen-Chin Lee31.2K views

Viewers also liked

Social Media For Busy Entrepreneurs and Small Businesses by
Social Media For Busy Entrepreneurs and Small Businesses Social Media For Busy Entrepreneurs and Small Businesses
Social Media For Busy Entrepreneurs and Small Businesses Fikriyyah George
304 views35 slides
Suir img by
Suir imgSuir img
Suir imgRocío Citroni
305 views4 slides
Crisis Subprime en España by
Crisis Subprime en EspañaCrisis Subprime en España
Crisis Subprime en Españaespejodeoesed
69 views35 slides
Green Peace y WWF by
Green Peace y WWFGreen Peace y WWF
Green Peace y WWFespejodeoesed
148 views12 slides
Gamedev-grade debugging by
Gamedev-grade debuggingGamedev-grade debugging
Gamedev-grade debuggingLeszek Godlewski
1.1K views32 slides
El presidencialismo mexicano antes y después by
El presidencialismo mexicano antes y después El presidencialismo mexicano antes y después
El presidencialismo mexicano antes y después espejodeoesed
156 views7 slides

Viewers also liked(15)

Social Media For Busy Entrepreneurs and Small Businesses by Fikriyyah George
Social Media For Busy Entrepreneurs and Small Businesses Social Media For Busy Entrepreneurs and Small Businesses
Social Media For Busy Entrepreneurs and Small Businesses
Fikriyyah George304 views
El presidencialismo mexicano antes y después by espejodeoesed
El presidencialismo mexicano antes y después El presidencialismo mexicano antes y después
El presidencialismo mexicano antes y después
espejodeoesed156 views
CriminalEFS-PowerPoint by Jenn Amabile
CriminalEFS-PowerPointCriminalEFS-PowerPoint
CriminalEFS-PowerPoint
Jenn Amabile221 views
Cross-platform game engine development with SDL 2.0 by Leszek Godlewski
Cross-platform game engine development with SDL 2.0Cross-platform game engine development with SDL 2.0
Cross-platform game engine development with SDL 2.0
Leszek Godlewski9.5K views
Хипстеры в энтерпрайзе by Aleksandr Tarasov
Хипстеры в энтерпрайзеХипстеры в энтерпрайзе
Хипстеры в энтерпрайзе
Aleksandr Tarasov1.8K views
каталог керасис by Nastasik
каталог керасискаталог керасис
каталог керасис
Nastasik3.4K views
Service Discovery. Spring Cloud Internals by Aleksandr Tarasov
Service Discovery. Spring Cloud InternalsService Discovery. Spring Cloud Internals
Service Discovery. Spring Cloud Internals
Aleksandr Tarasov1.7K views

Similar to Linux as a gaming platform - Errata

SDL2 Game Development VT Code Camp 2013 by
SDL2 Game Development VT Code Camp 2013SDL2 Game Development VT Code Camp 2013
SDL2 Game Development VT Code Camp 2013Eric Basile
6K views38 slides
Taking the hard out of hardware by
Taking the hard out of hardwareTaking the hard out of hardware
Taking the hard out of hardwareRonald McCollam
550 views33 slides
Schizophrenic files v2 by
Schizophrenic files v2Schizophrenic files v2
Schizophrenic files v2Ange Albertini
1.2K views98 slides
Video Drivers by
Video DriversVideo Drivers
Video DriversAnil Kumar Pugalia
23.4K views38 slides
GS-4136, Optimizing Game Development using AMD’s GPU PerfStudio 2, by Gordon ... by
GS-4136, Optimizing Game Development using AMD’s GPU PerfStudio 2, by Gordon ...GS-4136, Optimizing Game Development using AMD’s GPU PerfStudio 2, by Gordon ...
GS-4136, Optimizing Game Development using AMD’s GPU PerfStudio 2, by Gordon ...AMD Developer Central
3.5K views49 slides
Sweet fx readme by
Sweet fx readmeSweet fx readme
Sweet fx readmeMLGGS
700 views10 slides

Similar to Linux as a gaming platform - Errata(20)

SDL2 Game Development VT Code Camp 2013 by Eric Basile
SDL2 Game Development VT Code Camp 2013SDL2 Game Development VT Code Camp 2013
SDL2 Game Development VT Code Camp 2013
Eric Basile6K views
GS-4136, Optimizing Game Development using AMD’s GPU PerfStudio 2, by Gordon ... by AMD Developer Central
GS-4136, Optimizing Game Development using AMD’s GPU PerfStudio 2, by Gordon ...GS-4136, Optimizing Game Development using AMD’s GPU PerfStudio 2, by Gordon ...
GS-4136, Optimizing Game Development using AMD’s GPU PerfStudio 2, by Gordon ...
Sweet fx readme by MLGGS
Sweet fx readmeSweet fx readme
Sweet fx readme
MLGGS700 views
Shall We Play A Game - BSides Cape Town 2018 by HypnZA
Shall We Play A Game - BSides Cape Town 2018Shall We Play A Game - BSides Cape Town 2018
Shall We Play A Game - BSides Cape Town 2018
HypnZA352 views
Embedded Linux Multimedia by Caglar Dursun
Embedded Linux MultimediaEmbedded Linux Multimedia
Embedded Linux Multimedia
Caglar Dursun3.5K views
PiFlash: Linux utility to flash SD cards for Raspberry Pi computers by Ian Kluft
PiFlash: Linux utility to flash SD cards for Raspberry Pi computersPiFlash: Linux utility to flash SD cards for Raspberry Pi computers
PiFlash: Linux utility to flash SD cards for Raspberry Pi computers
Ian Kluft533 views
OSC-Fall-Tokyo-2012-v9.pdf by nitinscribd
OSC-Fall-Tokyo-2012-v9.pdfOSC-Fall-Tokyo-2012-v9.pdf
OSC-Fall-Tokyo-2012-v9.pdf
nitinscribd6 views
Console development by spartasoft
Console developmentConsole development
Console development
spartasoft522 views
[Ubucon Europe 2018] Introduction to mesa, the open-source graphics API imple... by Samuel Iglesias Gonsálvez
[Ubucon Europe 2018] Introduction to mesa, the open-source graphics API imple...[Ubucon Europe 2018] Introduction to mesa, the open-source graphics API imple...
[Ubucon Europe 2018] Introduction to mesa, the open-source graphics API imple...
Introduction to Mesa. The Open-Source Graphics API Implementation Library (Ub... by Igalia
Introduction to Mesa. The Open-Source Graphics API Implementation Library (Ub...Introduction to Mesa. The Open-Source Graphics API Implementation Library (Ub...
Introduction to Mesa. The Open-Source Graphics API Implementation Library (Ub...
Igalia259 views
Lessons Learned with Unity and WebGL by Lior Tal
Lessons Learned with Unity and WebGLLessons Learned with Unity and WebGL
Lessons Learned with Unity and WebGL
Lior Tal39.1K views
Porting your favourite cmdline tool to Android by Vlatko Kosturjak
Porting your favourite cmdline tool to AndroidPorting your favourite cmdline tool to Android
Porting your favourite cmdline tool to Android
Vlatko Kosturjak1.3K views

Recently uploaded

Special_edition_innovator_2023.pdf by
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdfWillDavies22
17 views6 slides
20231123_Camunda Meetup Vienna.pdf by
20231123_Camunda Meetup Vienna.pdf20231123_Camunda Meetup Vienna.pdf
20231123_Camunda Meetup Vienna.pdfPhactum Softwareentwicklung GmbH
33 views73 slides
AMAZON PRODUCT RESEARCH.pdf by
AMAZON PRODUCT RESEARCH.pdfAMAZON PRODUCT RESEARCH.pdf
AMAZON PRODUCT RESEARCH.pdfJerikkLaureta
19 views13 slides
Microsoft Power Platform.pptx by
Microsoft Power Platform.pptxMicrosoft Power Platform.pptx
Microsoft Power Platform.pptxUni Systems S.M.S.A.
52 views38 slides
Uni Systems for Power Platform.pptx by
Uni Systems for Power Platform.pptxUni Systems for Power Platform.pptx
Uni Systems for Power Platform.pptxUni Systems S.M.S.A.
55 views21 slides
Tunable Laser (1).pptx by
Tunable Laser (1).pptxTunable Laser (1).pptx
Tunable Laser (1).pptxHajira Mahmood
24 views37 slides

Recently uploaded(20)

Special_edition_innovator_2023.pdf by WillDavies22
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdf
WillDavies2217 views
AMAZON PRODUCT RESEARCH.pdf by JerikkLaureta
AMAZON PRODUCT RESEARCH.pdfAMAZON PRODUCT RESEARCH.pdf
AMAZON PRODUCT RESEARCH.pdf
JerikkLaureta19 views
Case Study Copenhagen Energy and Business Central.pdf by Aitana
Case Study Copenhagen Energy and Business Central.pdfCase Study Copenhagen Energy and Business Central.pdf
Case Study Copenhagen Energy and Business Central.pdf
Aitana16 views
Data Integrity for Banking and Financial Services by Precisely
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial Services
Precisely12 views
Piloting & Scaling Successfully With Microsoft Viva by Richard Harbridge
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft Viva
Serverless computing with Google Cloud (2023-24) by wesley chun
Serverless computing with Google Cloud (2023-24)Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)
wesley chun10 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ... by Jasper Oosterveld
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院 by IttrainingIttraining
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf by Dr. Jimmy Schwarzkopf
STKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdfSTKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdf
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf
Empathic Computing: Delivering the Potential of the Metaverse by Mark Billinghurst
Empathic Computing: Delivering  the Potential of the MetaverseEmpathic Computing: Delivering  the Potential of the Metaverse
Empathic Computing: Delivering the Potential of the Metaverse
Mark Billinghurst476 views

Linux as a gaming platform - Errata

  • 1. Linux as a gaming platform Ideology aside 14-07-2013 Leszek Godlewski Generalist Programmer leszek.godlewski@thefarm51.com www.thefarm51.com ERRATA
  • 2. 2 I 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
  • 3. 3 What 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
  • 4. 4 What 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
  • 5. 5 OpenGL 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.)!
  • 6. 6 OpenGL 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
  • 7. 7 Joystick/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 W ell, yeah, W ell, yeah, but... but...
  • 8. 8 SDL2 joystick and controller APIs www.thefarm51.com8 Why hurt yourself with the low-level kernel joystick interface and libudev?
  • 9. 9 SDL2 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
  • 10. 1 0 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
  • 11. 1 1 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 W ell, yeah, W ell, yeah, but... but...
  • 12. 1 2 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 W ell, yeah, W ell, yeah, but... but...
  • 13. 1 3 $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
  • 14. 1 4 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!
  • 15. 1 5 Thank you! Like us on Facebook! http://www.facebook.com/farm51 http://www.facebook.com/deadfalladventures http://www.facebook.com/PainkillerGame leszek.godlewski@thefarm51.com www.thefarm51.com