Вы находитесь на странице: 1из 15

www.thefarm51.

com

Linux as a gaming platform


Ideology aside

ERRATA

Leszek Godlewski Generalist Programmer leszek.godlewski@thefarm51.com 14-07-2013

I stand corrected!

On April 19, 2 1! " ga#e a talk on game de#elopment for $in%& at the 'igital 'ragons (%ropean Games )esti#al. "n it, " made a co%ple of mistakes and omissions that " here*+ wo%ld like to correct.

www.thefarm51.com

What if SDL doesn't cut it?

'espite its awesomeness, ,'$ has its shortcomings -o e&plicit G$./0G$ conte&t data sharing and no direct conte&t access 1 no threaded rendering

-o !' positioning or ',P s%pport in the stock ,'$ a%dio s%*s+stem - Partiall+ remedied *+ ,'$5mi&er But we need those! Now what?!

2hit this corner while porting Painkiller 3'4

Original slide 24

www.thefarm51.com

What if SDL doesn't cut it?

'espite its awesomeness, ,'$ has its shortcomings -o e&plicit G$./0G$ conte&t data sharing and no direct conte&t access 1 no threaded rendering

-o !' positioning or ',P s%pport in the stock ,'$ a%dio s%*s+stem - Partiall+ remedied *+ ,'$5mi&er But we need those! Now what?!

2hit this corner while porting Painkiller 3'4

Original slide 24

www.thefarm51.com

OpenGL context sharing in SDL2

It actually is possible! 7%st %ndoc%mented... Onl+ mention " co%ld find in Google is the 8a+ 2 12 commit that introd%ces the feat%re -eeds an ,'$ OpenG$ attri*%te set be ore window creation9

SDL_GL_SetAttribute( SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);

:oila ; all conte&ts created from now on with SDL_GL_CreateCo te!t() will share data with the c%rrentl+ *o%nd conte&t 2*%ffers, shaders etc.4<
5 www.thefarm51.com

OpenGL context sharing in SDL2

" re;read the :al#e slides a*o%t porting their games to $in%&, and noticed their renderer is m%ltithreaded. " knew from elsewhere the+ are %sing ,'$2, so " tho%ght " sho%ld check the so%rce code, not >%st the ,'$2 doc%mentation. As soon as " fo%nd o%t a*o%t m+ mistake, " rewrote the Painkiller 3ell ? 'amnation client code to %se ,'$2, too.
= www.thefarm51.com

Joystick ga!epad "#I

-ot part of .11 inp%t e#ent framework Aernel *lock de#ices - Breated as "#e$"i %ut"&'( - 3otpl%g e#ents #ia li*%de# 2also in ,team $in%& C%ntime4 - 3andled #ia o%e () and io)t*() - 'etailed doc%mentation in the kernel

$ $ $ t u b # h a e y # l http9//kernel.org/doc/'oc%mentation/inp%t/>o+stick;api.t&t l e "
www.thefarm51.com

Original slide 2!

SDL2 $oystick and contro%%er "#Is

0h+ h%rt +o%rself with the low;le#el kernel >o+stick interface and li*%de#E

www.thefarm51.com

SDL2 $oystick and contro%%er "#Is

%oystick &'I
,%pport for a&es, *%ttons, hats and track*alls ,tate polling or e#ents 3otpl%gging )orce feed*ack #ia the haptic ,'$2 s%*s+stem

www.thefarm51.com

SDL2 $oystick and contro%%er "#Is

Ga(e controller &'I


F%ilt on top of the >o+stick AP" 8aps an+ >o+stick/gamepad inp%t to a la+o%t modelled after the .*o& != controller F%ilt *+ :al#e with ,team Fig Pict%re in mind Findings ma+ *e imported/e&ported #ia strings Pop%lar controllers ha#e *%ilt;in mappings AP" #er+ similar to the reg%lar >o+stick AP", *%t *%ttons and a&es are identified *+ en%merations

SDL_Ga+eCo tro**erA!i' SDL_Ga+eCo tro**er,utto

www.thefarm51.com

1 1

Where do I put the fi%es?

0indows - Game data and *inaries9 B9GProgram )iles - Hser data9 IAPP'AJAI, 'oc%ments... - Ao,;like organization $in%& 2con#entional4 - Game *inaries9 /%sr/*in/, /%sr/games/ - Game data9 /%sr/share/games/ - Hser data9 K3O8(/.config/

$ $ $ t u b # h a e y 2K.'G5BO-)"G53O8( en#ironment #aria*le4 # l l - ,oA;like organization e " - )ilesyste( *ierarchy +tandard


www.thefarm51.com

Original slide 42

1 2

Where do I put the fi%es?

)3, mainl+ concerns distro packages Proprietar+ software often installs into /opt/Lpackage nameM/

$ $ Proprietar+ software also often installs t$ u Nwhere#erO b # ,team games li#e in h a P/.steam/steam/,teamApps/ ye # l 7%st p%t game data and *inaries in one l e place, and sa#e %ser data to P/.config/ "
2NAdd;on application software packagesO4
www.thefarm51.com

Original slide 4,

1 !

&'DG()O*+IG(,O-. and friends

Act%all+, -XDG_CON.IG_HO/E 2a.k.a. -HO/E"0)o 1i24 is a for te-tual con iguration iles Hser data, which is a more acc%rate description for sa#egames, '$B etc., goes into -XDG_DATA_HO/E 2defa%lts to -HO/E"0*o)a*"'3are4 All of this is reg%lated *+ a )ree'esktop.org standard9

http9//standards.freedesktop.org/*asedir;spec/*asedir;spec;latest.html

1!

www.thefarm51.com

1 6

Su!!ary

JhatQs all, folks, for now. ,orr+ for not getting this errata o%t earlier R at Jhe )arm 51 weQre #er+ *%s+ finishing .ead all &d/entures. 0hat do +o% think, sho%ld it *e coming to $in%& as wellE "f +o% spot an+ more mistakes, feel free to shoot me an email. 8an+ thanks to 8ichael $ara*el at Phoroni& for *lowing %p m+ ,lideshare with all the traffic from their news stor+. 0eep on playing# Linu- ga(ers!
16 www.thefarm51.com

1 5

www.thefarm51.com

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

Вам также может понравиться