LibGDX játék fejlesztése és publikálása Google Play-en Vörös Viktor, NNG
Outline 1. Cross-platform játékfejlesztés LibGDX használatával 2. Kihívások a. különböző képernyőméretek kezelése b. irányítás c. animációk d. hangok 3. Google Play a. applikáció publikálása b. reklámbannerek c. Google Play Games szolgáltatások
Development tools Java SDK (7+ for Android 5.0+) Android SDK Eclipse + ADT plugin / Android Studio
Supporting Different Platform Versions
Supporting Multiple Screens
Various Screen Resolutions
Top 10 most popular phones (2013) LG G3 1440 2560 QHD Nexus 5 1080 1920 FHD Galaxy S5 1080 1920 FHD Galaxy S4 1080 1920 FHD Galaxy Note 3 1080 1920 FHD HTC One M8 1080 1920 FHD HTC One M7 1080 1920 FHD Galaxy S3 720 1280 WXGA Moto X 720 1280 WXGA Galaxy Note 800 1280 WXGA Nexus 4 768 1280 WXGA
Top 10 most popular phones (2013) LG G3 360 640 QHD 16:9 Nexus 5 360 640 FHD 16:9 Galaxy S5 360 640 FHD 16:9 Galaxy S4 360 640 FHD 16:9 Galaxy Note 3 360 640 FHD 16:9 HTC One M8 360 640 FHD 16:9 HTC One M7 360 640 FHD 16:9 Galaxy S3 360 640 WXGA 16:9 Moto X 360 640 WXGA 16:9 Galaxy Note 400 640 WXGA 16:10 Nexus 4 384 640 WXGA 15:9
Features Cross-Platform Windows Linux Mac OS X Android (2.2+) BlackBerry ios Java Applet (requires JVM to be installed) Javascript/WebGL (Chrome, Safari, Opera, Firefox, IE via Google Chrome Frame)
Features Audio (wav, mp3, ogg) Input Handling (mouse, touch-screen, keyboard, accelerometer, compass) Math & Physics (matrix, vector, bounding shapes, splines, common interpolators,concave polygon triangulator, intersection and overlapping testing,...) File I/O & Storage Graphics (custom OpenGL ES 2.0 bindings, low-level OpenGL helpers, high-level 2D and 3D APIs Utilities (Json, XML)
LibGDX project setup https://libgdx.badlogicgames.com/ gdx-setup.jar
LibGDX project setup https://libgdx.badlogicgames.com/ gdx-setup.jar
LibGDX project structure
Starter classes
The application life cycle
ApplicationListener interface
Game abstract class Provides an implementation of ApplicationListener, along with some helper methods to set and handle Screen rendering Together, Screen and Game objects are used to create a simple and powerful structure for games A Game object will be the entry point to the game
Game class - entry point to the game
Screen interface Screens are fundamental to any game with multiple components Screens contain many of the methods you are used to from ApplicationListener objects, and include a couple of new methods: show and hide, which are called when the Screen gains or loses focus, respectively
Screen class implementation
Rendering shapes
Managing assets - AssetManager
Texture
Input handling Different platforms have different input facilities On the desktop: keyboard and mouse On Android, the mouse is replaced with a (capacitive) touch screen, and a hardware keyboard is often missing. Android devices also could feature an accelerometer, compass,... Libgdx abstracts all these different input devices. Mouse and touch screens are treated as being the same
Querying Available Input Devices
Polling the Touch Screen
Listener interface - InputProcessor
Audio LibGDX provides methods to playback small sound effects LibGDX can stream larger music pieces directly from disk It also provides convenient read and write access to the audio hardware LibGDX will automatically pause and resume all audio playback for you if your application is paused and resumed
Sound effects Sound effects are small audio samples, usually no longer than a few seconds, that are played back on specific game events such as a jumping or shooting a gun Libgdx supports MP3, OGG and WAV files
Create sound effects http://www.superflashbros.net/as3sfxr/
Streaming music For any sound that's longer than a few seconds it is preferable to stream it from disk instead of fully loading it into RAM Music instances are heavy, you should usually not have more than one or two at most loaded
http://exonmusic.hu/
Animation
Universal Tween Engine features Enables the interpolation of every attributes from any object One line is sufficient to create and start a simple interpolation Tweens can be easily sequenced thanks to Timelines Tweens can act on more than one value at a time, so a single tween can change the whole position (X and Y) of a sprite for instance Tweens and Timelines can be repeated Many callbacks can be specified (when tweens complete, start, end, etc)
Tween and its callbacks
Tween code
Tween demo http://www.aurelienribon.com/universal-tween-engine/gwt/demo.html
How to put your app in Google Play Register for Google Play at the Google Play publisher site (There is a $25 USD charge to register) If you want to sell your apps, instead of offering them for free with ads, you also need to set up a Google Wallet Merchant account. (Turn ads off when selling your app on Google Play) Prepare to publish
Prepare to publish Your final application file (APK) must be under 50MB in size The title for your app should be max 30 characters A description of your app should be max 4000 characters App launcher icons (48x48, 72x72, 96x96, 144x144) High-res icon (512x512 32-bit PNG with alpha) Feature graphic (1024x500 JPG or 24-bit PNG no alpha) At least 2 screenshots are required (max 8, JPEG or 24-bit PNG no alpha) - Min length for any side: 320px. Max length for any side: 3840px
Nibly Snake https://play.google.com/store/apps/details?id= com.vvgames.niblysnake.android
Ads Use Google Play Services SDK Update AndroidManifest.xml - Add two <uses-permission> tags for INTERNET and ACCESS_NETWORK_STATE - Add a <meta-data> tag that references the Google Play services version - Add an <activity> element with configchanges and theme attributes. This activity is used by the SDK when banners are clicked or interstitials are presented
Play Games Services Achievements Leaderboards Real-time Multiplayer Turn-based Multiplayer Events and Quests Saved games