Filter
-
Content Type
-
Category
Mobile/Wearable
Visual Display
Digital Appliance
Platform
Recommendations
Filter
Develop GameDev
docintroduction galaxy smartphones make up the world's largest mobile gaming platform even a number of major game engine companies, publishers and studios are already collaborating with samsung, we announced the galaxy gamedev program at the 2016 samsung developer conference, where we extended our support beyond major players in the games industry to any developers creating games for galaxy devices new technologies are essential to creating high fidelity, high performance gaming experience in mobile devices samsung is committed to bringing new technology to our suite of galaxy products, such as; 64bit, multi-thread rendering and the new generation graphics api - vulkan samsung's galaxy gamedev team has engineers located in five strategic global locations to cover game developers from all over the world we ensure that our partners have the engineering support they need to launch the best gaming experiences on galaxy devices and strengthen the android ecosystem galaxy gamedev provides a variety of technical support options to assist developers there are 4 key areas gpu drivers gpu driver optimization and streamlining driver updates is a key area to making the most of hardware capabilities and maintaining optimized performance of a gpu samsung collaborated with google and the major gpu vendors like arm and qualcomm to develop and ship the new android feature game driver game driver provides the new way of updating gpu driver by store and this delivers more stable and better performing gpu driving for the target games now this functionality started with the limited number of major galaxy models and continues to scale with more devices soon tools & sdks samsung develops and supports its own tools & sdks like gpuwatch and galaxy gamesdk which help game developers to find resource bottlenecks and solve performance issues in real-time sdks are integrated with major game engines too like unity adaptive performances to guide developers with easy way of use developer support our gamedev engineers are available to support developers in multiple ways, from answering general day-to-day development questions all the way to on-site engineering collaboration a deep engagement with on-site support is available to developers who have signed a confidentiality agreement with samsung game engines supporting the optimization of game engines is key to wide distribution of optimization samsung’s gamedev team are focused on supporting game engines, which ensures that games released through the engine's ecosystem achieve the significant optimizations that would normally be delivered into just one game partners samsung keeps working closely with more than 50 partners including game studio, publisher, tool developers, game engine companies and gpu vendors
Develop GameDev
docgamedev best practices to share our experiences and know-hows from gamedev supports, we've authored the following technical blogs you can find our stories and some useful tips here using variable rate shading to improve performance on mobile games "samsung developers blog" , 22 nov 2022 foldable device features with unity and unreal engine 4 "samsung developers blog" , 16 sep 2022 how to use jetpack windowmanager in android game dev "samsung developers blog" , 20 july 2022 optimizing mobile game performance runescape " runescape" , jagex , 2021 lighting up xcom 2 on android with galaxy gamedev " xcom 2 " , feral interactive , 2021 using conservative morphological anti-aliasing to improve game visuals " msaa " , samsung r&d uk , 2021 accelerating performance in xbox game studios' forza street " forza street " , electric square / microsoft , 2020 jet set vulkan reflecting on the move to vulkan " sky gamblers infinite jets " , atypical games , 2019 adaptive performance in call of duty mobile " call of duty mobile " , tencent , 2019 l2m binding and format optimization " lineage2 mobile " , nc soft , 2019 a year in a fortnite " fortnite " , epic games , 2019 the challenges of porting traha to vulkan " traha " , moai games / nexon , 2019
Develop GameDev
docevent archive 2022 event date/location session presenter s gdc2022 may 21-25, 2022san francisco, usa unfolding your gaming potential with galaxy gamedev gdc vault michael barnes, head of game ecosystem at samsung research uk gdc2022 may 21-25, 2022san francisco, usa game performance optimization with causal models gdc vault hesham dar, senior data scientist at samsung research uk gdc2022 may 21-25, 2022san francisco, usa what if your phone's avatar is in the game or metaverse? gdc vault jinho lim, principal engineerjeoungju kim, principal engineersanglae kim, staff engineer gdc2022 may 21-25, 2022san francisco, usa new gpu, the ultimate reality! gdc vault gary keen, engineer, samsung research uk 2020 event date/location session presenter s unite seoul 2020 201203online how to optimize sustainable gaming performance in mobile devices using adaptive performance video munseong kang unity korea webinar 2020 200730online how to maintain stable gaming performance, adaptive performance video inae kim, jihyun oh unity unite now 2020 200723online build aaa games with adaptive performance video benjamin mitchell 2019 event date/location session presenter s unity webinar seoul 2019 191212seoul, korea adaptive performance video_korean junsik kong, jihyun oh unity reboot develop red 2019 191030banff, canada mobilizing call of duty bringing a blockbuster title to android video benjamin mitchell sdc 2019 191030san jose,usa a deep look inside games gamesdk and unity adaptive performance video junsik kong, david berger unity sdc 2019 191030san jose,usa vulkanized mobile game optimization techniques pdf igor nazarov,yao wei sdc 2019 191030san jose,usa galaxy gamedev bringing maximun boost to mobile gamesⅱ video jungwoo kim, seunghwan lee, richard huddy unite copenhagen 2019 190923københavn,denmark bringing call of duty to mobile video/slide jungwoo kim, anton syniavskyi casual connect london 190528london,uk next level mobile graphics video munseoung kang,oleksii vasylenko unite seoul 2019 190521seoul, korea technique of mobile game optimization-vulkan and unity adaptive performance video junsik kong, seunghwan lee, david berger unity unite seoul 2019 190521seoul, korea keynote pdf jungwoo kim unite shanghai 2019 190512shanghai,china gamedev partner practices pdf yao wei unite shanghai 2019 190512shanghai,china keynote pdf joonyong park google i/o 2019 190507mountainview,usa making high fidelity android games possible with vulkan video jungwoo kim, francesco carucci google , tom olson arm unreal summit seoul 2019 190503seoul, korea vulkan mobile optimization white book video/pdf-korean joonyong park, dohyun kim reboot develop blue 2019 190419dubrovnik,croatia some seriously explicit lessons in vulkan video alon or-bach, karlo jez croteam unreal fest europe 2019 190411prague, czech republic vulkan! powering aaa experiences on android video oleksii vasylenko,michael parkin-white gdc2019 190318-190322sanfrancisco,usa bringing 'fortnite' to mobile with vulkan and opengles presented by khronos pdf/video kostiantyn drabeniuk, jack porter epic games gdc2019 190318-190322sanfrancisco,usa a quick look inside your game gpuwatch & gamesdk presented by samsung video hyokeun lee, junsik kong, david berger unity gdc2019 190318-190322sanfrancisco,usa galaxy gamedev bringing maximum boost to mobile games presented by samsung video jungwoo kim, dohyun kim, sangmin lee gdc2019 190318-190322sanfrancisco,usa all-in-one guide to vulkan on mobile presented by samsung and arm michael parkin-white gdc2019 190318-190322sanfrancisco,usa making use of new vulkan features presented by khronos video lewis gordon, dr matthäus chajdas amd , tiemo jung gaijin entertainment 2018 event date/location session presenter s sdc2018 181107-181108sanfrancisco,usa going into the new era galaxy gamedev -update,secrets and leaks video jungwoo kim, richard huddy sdc2018 181107-181108sanfrancisco,usa a quick look inside your games gpuwatch tutorial + gameengine talk video hyo-keun lee, niklas smedberg unity sdc2018 181107-181108sanfrancisco,usa fortnite behind the story road to android and vulkan collaboration with galaxy gamedev video sangmin lee, jack porter epic games siggraph 2018 180812-180816vancouver, canada moving mobile graphics mobile graphics 101 pdf andrew garrard vulkanised!2018 180522cambridge,uk the low-level mysteries of pipeline barriers pdf/video frederic garnier, andrew garrard android game developer summit 2018 180507mountainview,usa vulkan game optimization video jungwoo kim, ito kosei luminous productions , yoshimasa enji summertimestudio unite seoul 2018 180502-180504seoul,south korea keynote pdf taeyong kim vulkan developer day in montreal 2018 180430montreal,canada overview and vulkan 1 1 recap video alon or-bach gdc2018 180319-180323sanfrancisco,usa vulkan on android gotchas and best practices presented by the khronos group video frederic garnier, inae kim, arseny kapoulkine roblox gdc2018 180319-180323sanfrancisco,usa getting explicit how hard is vulkan really? hosted by the khronos group video alon or-bach, dustin land id software , dr matthäus chajdas amd , hai nguyen google , arseny kapoulkine roblox gdc2018 180319-180323sanfrancisco,usa perfdoc optimize early with vulkan validation layer tools presented by arm link jungwoo kim, hans-kristian arntzen arm 2017 event date/location session presenter s gcon g-star 2017 171117busan,south korea future mobile game ecosystem and high fidelity android gaming pdf meeso kim, jungwoo kim sdc 2017 171018-171019sanfrancisco,usa developing high-fidelity android games collaboration best practices video eunsil cho,ethan choi hound13 ,ito kosei square enix ,ebato takahito square enix sdc 2017 171018-171019sanfrancisco,usa vulkan game optimization deep-dive case study video daemyung jang, jungwoo kim sdc 2017 171018-171019sanfrancisco,usa level up your game! new insights and tools for game developers video jungwoo kim, jongheun yoo game republic mobile games special 171018sheffield,uk samsung game ecosystem pdf david pither html5ct forum 171013seoul,south korea introducing vulkan with practices pdf jungwoo kim unreal fest east 2017 171008yokohama,japan developing high performance games for android pdf jungwoo kim, hak matsuda google khronos-vulkanised!2017 170525cambridge,uk bringing vainglory to vulkan pdf fred garnier khronos-vulkanised!2017 170525cambridge,uk panel discussion worst practices! lessons learnt from game devs pioneering with vulkan video alon or-bach, tobias hector img , fred garnier, dean sekulic croteam ,hans-kristian arntzen arm , tom olson arm google i/o 2017 170519mountain view,usa developing high performance games for android video jungwoo kim, bill bilodeau google , donghyun kim netmarble android game developer summit 2017 170516mountainview,usa game optimization pdf jungwoo kim, jonas gustavsson unite seoul 2017 170516-170517seoul,south korea keynote pdf joonyong park ndc 2017 170425-170427pangyo,south korea developing vulkan game with unity pdf seunghwan lee, inae kim, daemyung jang gdc2017 170227sanfrancisco,usa vulkan game development in mobile pdf soowan park gdc2017 170227sanfrancisco,usa refocusing on vr innovation can standards simplify cross-platform virtual reality development? pdf/video alon or-bach gdc2017 170227sanfrancisco,usa mobile the future of vr pdf/video alon or-bach casual connect berlin 170208berlin,germany optimizing high-end games for premium mobile devices video jonas gustavsson, joe davis hci korea 2017 170208-170210jeongseon,south korea future of vr with vulkan pdf daemyung jang 2016 event date/location session presenter s gcon g-star 2016 161118busan,south korea vulkan and the future of mobile gaming pdf meeso kim, jungwoo kim khronos-vulkan devu 161021seoul,south korea vulkan tutorial pdf hyokeun lee, minwook kim khronos-vulkan devu 161021seoul,south korea vulkan case study video soowan park, joonyong park cedec 2016 160824-160826yokohama,japan the vulkan™ new generation graphics api – an introduction and overview pdf jungwoo kim e3 2016 160614-160616los angeles,usa samsung e3 press conference pdf jungwoo kim khronos-moving to vulkan 160525cambridge,uk swapchains unchained video alon or-bach sdc2016 160427sanfrancisco,usa introducing the galaxy gamedev program video taeyong kim, rob dyer, ray tran, carl callewaert sdc2016 160427sanfrancisco,usa introducing vulkan for galaxy s7 video jungwoo kim, valentyn kulikovskiy sdc2016 160427sanfrancisco,usa unreal engine developing console-level games with vulkan video jungwoo kim, niklas smedberg epic games
Develop GameDev
docresources to ensure all developers benefit from our collaboration with galaxy gamedev members, we have authored and gathered the following collection of technical documents and resources articles foldable field of view guide – unity foldable field of view guide – unreal engine introduction to gpu technologies introduction to vulkan render passes game asset optimization opengl es usage vulkan usage gpu framebuffer memory understanding tiling tool guides arm mobile studio arm perfdoc vulkan layer gamebench android gpu inspector google systrace qualcomm snapdragon profiler renderdoc sdk and samples glslang lunarg vulkan samples spirv-cross vulkan-samples lunarg vulkan samples mali vulkan sdk mali opengl es sdk adreno vulkan sdk sascha willems' vulkan demo
Develop GameDev
docadaptive performance resources the following is a collection of documents and resources for adaptive performance announcements, articles, and blogs unity forums announcement - adaptive performance package best practices for mobile game developers and artists, 2021 may build stunning mobile games that run smoothly with adaptive performance, 2021 mar android game analysis with arm mobile studio, 2020 sep create astc textures faster with the new astcenc 2 0 open source compression tool, 2020 sep higher fidelity and smoother frame rates with adaptive performance, 2019 apr vulkan extensions for mobile new game changing vulkan extensions for mobile timeline semaphores, 2021 jul new game changing vulkan extensions for mobile buffer device address, 2021 jul new game changing vulkan extensions for mobile descriptor indexing, 2021 jun new vulkan extensions for mobile legacy support extensions, 2021 jun new vulkan extensions for mobile maintenance extensions, 2021 jun video sessions and talks gdc 2021 - galaxy gamedev bringing high quality gaming experiences to mobile unite now 2020 - build better aaa mobile games with adaptive performance sdc19 - a deep look inside games gamesdk and unity adaptive performance unite 2019 - bringing call of duty to mobile gdc 2019 keynote - improve mobile game performance in real time with adaptive performance gdc 2019 - megacity on mobile how we optimized it with adaptive performance unity documentation android game development mobile solutions optimize your mobile game performance release marketing user guide, v2 1 1
Distribute Galaxy Store Games
docget started in galaxy store the following is a list of tasks required, recommended, and optional , videos, and recommended reading to help you start selling your apps in galaxy store a link to more detailed information is provided, when available the icons represent the following required task recommended task optional task video recommended reading prepare before you do anything, sign up for a samsung account using your samsung account, you can register with samsung developers and seller portal and apply for commercial seller status then, understand what you need to do if you are submitting your app to more than one app store, and review the online resources provided by galaxy gamedev register with seller portal downloadable pdf seller portal is used to manage your applications that are distributed in galaxy store if you want to sell your app in galaxy store, you must have a seller portal account the seller portal user guide provides more information about seller portal registration also, watch the video about how to create a seller portal account apply for commercial seller status downloadable pdf in seller portal, you must apply for commercial seller status the seller portal user guide provides more information about commercial seller status review apk package naming and billing guidelines when you are submitting a game or app to more than one app store, you need to keep track of the package name and/or version codes you use in your apk for each app store and, if you have in-app purchases, the billing solution used add a galaxy store review link get feedback from your customers by adding a link from your app to your app's review page in galaxy store positive feedback can influence users to purchase your app explore the samsung developers portal samsung developers portal provides access to sdks, services, tools, and guides you can also sign up for a newsletter that keeps you up-to-date with the latest blogs, news, and events register using your samsung account how to create a seller portal account seller portal is used to manage your applications that are distributed in galaxy store if you want to sell your app in galaxy store, you must have a seller portal account explore the seller portal dashboard check out the top level menus, learn some of the basic tasks, and discover where to find additional information and support for seller portal learn about samsung seller portal a basic overview of the major features in seller portal learn about galaxy gamedev review technical support options for game developers monetize learn about requirements for in-app items and paid apps integrate with samsung in-app purchase iap downloadable pdf if you are selling your app and/or in-app items, samsung recommends that you use samsung iap as your billing solution samsung iap includes an sdk, guides, examples, and unity and unreal plugins maximize your revenue with samsung in-app purchase learn about the new features and improvements released in samsung in-app purchase iap 6 0 monetize your games with samsung in-app purchase introduction to samsung iap plug-in functionality for unity and unreal game engines learn more about samsung iap review the online samsung iap documentation make the most from your games discover different ways to generate revenue in galaxy store launch register your app and in-app items in seller portal, test your app, then launch your app in galaxy store all apps must be reviewed and approved by samsung before they are distributed to galaxy store for sale noteare you a developer of a popular game on galaxy smartphones? we can help you go live in five minutes in galaxy store contact us to learn more about our fast app review process register your app in seller portal downloadable pdf, by app type android, galaxy themes how to register your app in seller portal, based on the app type the seller portal user guide provides more information about app registration review the app distribution guide, intellectual property infringement checklist, and galaxy self-check list ensure that your app meets samsung's requirements and standards of quality to pass publication review set a publication date determine when your app becomes available in galaxy store your app can be published when it passes an initial review, on a set date, or you can manually control the release of your app in seller portal, set the publication date in the publication tab using the start publication field beta test your app learn how to deploy your app for beta testing and receive valuable feedback from testers test your in-app item transactions test your samsung iap integration, such as in-app item offering, purchase, and payment functionality available for closed beta testing only get started in instant plays 2 0 bring users directly from an ad click into your game using our mobile cloud gaming platform, your game becomes instantly available and accessible to all compatible samsung galaxy devices publish in five minutes contact us to find out if your games qualify for our fast app review process review the seller portal user guide review information about seller portal use the galaxy store developer api learn how to manage your apps and in-app items and view statistics about your apps programmatically seller portal android app binary registration device resolution lists the device resolutions most used by customers in galaxy store this is a required field when you register your android app in seller portal manage in-app items read more about how to manage your in-app items in seller portal test your app on a samsung device test your app on the latest samsung galaxy devices using remote test lab understand the review process check out the steps samsung takes to review your app level up after your app is published in galaxy store, learn more about tracking performance metrics, promoting your app, and tracking user data pre-certify your app if you are working with the samsung business development team and they are merchandizing your app, your apps must be pre-certified pre-certification helps to uncover issues if no issues are found, pre-certification can take around five days to complete engage on social media promote your content and attract new customers using our social media kits, hashtags, and guidelines create galaxy store badges directly link users from your web site or social media channels to your app product detail page generate badges from seller portal after the publication of your app request promotion for your galaxy themes promote your app and increase your downloads by being included in a collection in galaxy store discover user attribution data identify how a user finds your app's detail page in galaxy store using galaxy store statistics integrate with third-party attribution platforms track user data using third-party attribution platforms integrated with galaxy store become familiar with galaxy store statistics galaxy store statistics gss is a tool that is included with seller portal and allows you to see the performance metrics of all your apps learn about the valuable data available to you in gss u s partner onboarding guidelines the pdf content provided on this page was taken from the u s partner onboarding guidelines for your convenience, the entire guideline is provided in a single downloadable pdf for each app type you must log in or be logged in to your samsung account to download these pdfs u s partner onboarding guideline android 407kb pdf u s partner onboarding guideline galaxy themes 3 8mb pdf
Learn Code Lab
codelaboptimize game performance with adaptive performance in unity objective learn how to optimize the performance of a demo game on samsung galaxy devices using the adaptive performance in unity the adaptive performance package provides you with tools to properly adjust you’re game and improve its overall game performance overview galaxy gamesdk delivers an interface between game application and device which helps developers optimize their games integrating unity adaptive performance with galaxy gamesdk allows unity developers to use this feature on unity editor within unity package manager and also customize their game contents by c# scripting game performance and quality settings can be adjusted in real time by identifying device performance status and heat trends moreover, using a set of simple ui controls, you can scale the quality of the game to match the device platform the latest version of adaptive performance, now uses new android apis that gather information from samsung hardware to provide more detailed insights into the device's thermal components and cpu optimization there are two providers for adaptive performance the samsung provider 5 0 utilizes apis from the gamesdk, which is supported from samsung galaxy s10 or note10 devices until newer models on the other hand, the android provider 1 2 uses the android dynamic performance framework adpf apis and is supported on devices running android 12 or higher this code lab focuses on using the samsung provider of adaptive performance thermal throttling mobile devices lack active cooling systems, causing temperatures to rise this triggers a warning to the unity subsystems, which lowers hardware demand to control heat and avoid performance degradation the ideal goal is to make performance stable with low temperature adaptive performance, primarily for performance and quality balance management, can help achieve this thermal warning the warning system implemented in gamesdk can trigger both internal unity systems and developer-defined behavior, such as disabling custom scripts and shaders quality settings it also provides you with the option to adjust the quality of the game to maintain stable performance at different warning levels you can scale the quality of your game in real time to meet the desired performance this includes changes in level of detail, animation, physics, and visual effects scalers with adaptive performance enabled, the game's fps becomes more stable and consistently higher over time this is because the game adapts its contents based on thermal warnings provided by samsung's thermal callback system the adaptive performance in unity provides developers with scalers that affect various aspects of the game frame rate resolution batching level of detail lod lookup texture lut multisample anti-aliasing msaa shadow cascade shadow distance shadow map resolution shadow quality sorting transparency view distance physics decals layer culling these general scalers can be used to scale the content based on your settings in the editor however, you may also create custom scalers that integrate with your own systems for instance, your own scalers can disable cpu-expensive scripts from running when thermal warnings are reached the latest version of adaptive performance, v5 0, includes new additions to the scalers decal scaler changes the draw distance of decals it controls how far a decal can be before not being rendered layer culling scaler adjusts the distance that expensive layers, such as transparency or water, when they start being culled it’s a useful scaler for scenes with more expensive shader calculations in every frame, unity calculates how all the physics in a level interacts with everything else, such as when the ball is dropping to the floor physics scaler adjusts the frequency at which this calculation is performed a lower frequency means fewer cpu calculations per second set up your environment you will need the following unity editor version 2022 3 visual studio or any source code editor supported samsung galaxy device remote test lab if physical device is not available requirements samsung account java runtime environment jre 7 or later with java web start internet environment where port 2600 is available sample code here is a sample project for you to start coding in this code lab download it and start your learning experience! adaptive performance sample code 903 96 mb demo game the sample project contains a demo game named boat attack it is an open-source demo game provided by unity it has the following features triangles 800,000 vertices 771,000 shadow casters 133 start your project after downloading the sample project, follow the steps to open your project launch the unity hub click projects > open after locating the unzipped project folder, you can open it in unity editor it initially downloads the needed resources for your project open benchmark_island-flythrough scene found under assets notethe project was tested in unity 2022 3 it is recommended to use this version in this code lab set up adaptive performance components in window > package manager > adaptive performance, you can check if the adaptive performance is already included in the project go to edit > project settings > adaptive performance enable the initialize adaptive performance on startup and select samsung android provider enable the scalers by going to adaptive performance > samsung android > indexer settings check the scaler settings and just use the default values add adaptive performance script to your project you are going to use a script that contains examples of the adaptive performance api code it gives you access to the frame time information, thermal information, and cpu/gpu bottlenecks this script adjusts the performance based on the device's thermal state, allowing longer game time by reducing in-game demands download the adaptive performance script adaptiveperformanceconroller cs 6 15 kb simply drag and drop the script into assets folder create a new object and attach the script to the object change the frame rate based on thermal warnings get to know about thermal warnings throttling warnings allow you to know when your game is about to be forcibly throttled and have sections of lag and lowered frame rate adaptive performance provides these thermal alerts that allow you to take control and adjust settings before the performance downgrades check the registered event handler to trigger thermal status ithermalstatus thermalstatus thermalevent then, check thermalmetrics information in the handler name description value nowarning no warning is the normal warning level during standard thermal state 0 throttlingimminent if throttling is imminent, the application should perform adjustments to avoid thermal throttling 1 throttling if the application is in the throttling state, it should make adjustments to go back to normal temperature levels 2 temperaturelevel 0 0 ~ 1 0 current normalized temperature level in the range of [0, 1] a value of 0 means standard operation temperature and the device is not in a throttling state a value of 1 means that the maximum temperature of the device is reached and the device is going into or is already in throttling state temperaturetrend -1 0 ~ 1 0 current normalized temperature trend in the range of [-1, 1] a value of 1 describes a rapid increase in temperature a value of 0 describes a constant temperature a value of -1 describes a rapid decrease in temperature it takes at least 10s until the temperature trend may reflect any changes adjust the frame rate in the adaptiveperformancecontroller cs, the following code is responsible for changing the frame rate depending on the current thermal alert void onthermalevent thermalmetrics ev { switch ev warninglevel { case warninglevel nowarning application targetframerate = 30; break; case warninglevel throttlingimminent application targetframerate = 25; break; case warninglevel throttling application targetframerate = 15; break; } } change the quality settings the performance bottleneck api informs you via an enum value if there is a bottleneck so you can adjust the workload iadaptiveperformance performancestatus performancemetrics performancebottleneck namespace unityengine adaptiveperformance { public enum performancebottleneck { unknown = 0, cpu = 1, gpu = 2, targetframerate = 3 } } in the adaptiveperformancecontroller cs script, the code below is responsible for controlling the lod of the models depending on the performance bottleneck a model with multiple lod is a prime example of a quality setting that can heavily affect the games performance lowering it lessens the load on the gpu, frees up resources, and eventually prevents thermal throttling change the quality setting by adjusting lod in real time by using the performancebottleneck api switch ap performancestatus performancemetrics performancebottleneck // iadaptiveperformance performancestatus performancemetrics performancebottleneck { case performancebottleneck gpu debug logformat "[adp] performancebottleneck gpu " ; lowerlod ; break; case performancebottleneck cpu debug logformat "[adp] performancebottleneck cpu " ; break; case performancebottleneck targetframerate debug logformat "[adp] performancebottleneck targetframerate " ; break; case performancebottleneck unknown debug logformat "[adp] performancebottleneck unknown" ; break; } create a custom scaler to create custom scalers, you need to create a new class that inherits from adaptiveperformancescaler the adaptive performance package includes this class that can be added to the adaptive performance framework, which adjusts quality settings based on unity's thermal settings download this custom scaler to control the texture quality of the demo game texturescaler cs 1 17 kb simply drag and drop the downloaded file into the project test using device simulator in unity the device simulator in unity allows you to test out adaptive performance functionality without a physical mobile device go to window > general > device simulator go to edit > project settings > adaptive performance enable the initialize adaptive performance on startup and select device simulator provider in the device simulator, you can try to send thermal warnings and create artificial bottlenecks to test different behaviors of the demo game the visual scripts display the scalers available and show if it is enabled enabling a specific scaler means that the adaptive performance w you can override the scalers to test their impact on the demo game's performance and scene some scalers may not affect the scene but may improve the performance in the long run build and launch the apk go to file > build settings connect your galaxy device enable development build and select scripts only build option make sure that the autoconnect profiler is enabled to check the profiler in unity and measure the performance in build to device, click the patch button to install or update the apk in your device test using unity profiler unity has also introduced a new module in its profiler that allows you to monitor the scalers changes and extract frame time information to your editor the profiler allows you to get real-time information from the adaptive performance plugin navigate to windows > analysis > profiler set the play mode to your connected galaxy device once connected, you can analyze the frame time stats and check the state of the scalers during runtime scalers in this profiler are reacting to the thermal trend and are being raised or lowered in response to the thermal warning observe the scalers when enabled or disabled texture scaler the texture scaler is the custom script to lower the texture quality based on thermal levels when enabled and maxed out, the texture fidelity has been lowered this lowers the gpu load and memory usage lod scaler you may notice a subtle change in the appearance of the rocks, trees, and umbrella models this is due to the adaptation of the lod bias that determines which version of the models to use as the thermal levels rise, lower poly models are selected to reduce the number of triangles rendered this reduces the gpu load and minimizes thermal build-up shadow map resolution shadow map resolution creates a blurring effect on the shadows which incidentally lowers the performance load required to render them basically, lower shadow detail means fewer gpu calculations, which lead to less heat build-up check the game performance using gpuwatch gpuwatch is a profiling tool for observing gpu activity in your app the following are the common information shown by the gpuwatch fps counters current average cpu and gpu load cpu load gpu load it is very helpful in profiling your game during the post-development stage so you can further optimize to enable gpuwatch on your galaxy device you can easily reposition the gpuwatch widgets on the screen by enabling unlock widgets under the notification menu of gpuwatch you’re done! congratulations! you have successfully achieved the goal of this code lab now, you can improve and optimize your android game on samsung galaxy devices using adaptive performance in unity by learning about scalers, thermal warnings, and bottleneck apis the performance of your mobile games can be pushed further by utilizing these tools if you face any trouble, you may download this file adaptive performance complete project 1 06 gb to learn more, visit developer samsung com/galaxy-gamedev
Learn Code Lab
codelabimplement flex mode into a unity game objective learn how to implement flex mode into a unity game using android jetpack windowmanager and unity's java native interface jni wrapper overview the flexible hinge and glass display on galaxy foldable devices, such as the galaxy z fold4 and galaxy z flip4, let the phone remains propped open while you use apps when the phone is partially folded, it will go into flex mode apps will reorient to fit the screen, letting you watch videos or play games without holding the phone for example, you can set the device on a flat surface, like on a table, and use the bottom half of the screen to navigate unfold the phone to use the apps in full screen mode, and partially fold it again to return to flex mode to provide users with a convenient and versatile foldable experience, developers need to optimize their apps to meet the flex mode standard set up your environment you will need the following unity hub with unity 2022 3 5f1 or later must have android build support visual studio or any source code editor galaxy z fold2 or newer remote test lab if physical device is not available requirements samsung account java runtime environment jre 7 or later with java web start internet environment where port 2600 is available sample code here is a sample project for you to start coding in this code lab download it and start your learning experience! flex mode on unity sample code 1 17 gb start your project after downloading the sample project files, follow the steps below to open your project launch the unity hub click projects > open locate the unzipped project folder and click open to add the project to the hub and open in the editor notethe sample project was created in unity 2022 3 5f1 if you prefer using a different unity version, click choose another editor version when prompted and select a higher version of unity configure android player settings to ensure that the project runs smoothly on the android platform, configure the player settings as follows go to file > build settings under platform, choose android and click switch platform wait until this action finishes importing necessary assets and compiling scripts then, click player settings to open the project settings window go to player > other settings and scroll down to see target api level set it to api level 33 as any less than this will result in a dependency error regarding an lstar variable you can set the minimum api level on lower levels without any problem next, in the resolution and presentation settings, enable resizable window it is also recommended that render outside safe area is enabled to prevent black bars on the edges of the screen lastly, enable the custom main manifest, custom main gradle template, and custom gradle properties template in the publishing settings after closing the project settings window, check for the new folder structure created within your assets in the project window the newly created android folder contains androidmanifest xml, gradletemplate properties, and maintemplate gradle files import the foldablehelper and add dependencies foldablehelper is a java file that you can use in different projects it provides an interface to the android jetpack windowmanager library, enabling application developers to support new device form factors and multi-window environments before proceeding, read how to use jetpack windowmanager in android game dev and learn the details of how foldablehelper uses windowmanager library to retrieve information about the folded state of the device flat for normal mode and half-opened for flex mode , window size, and orientation of the fold on the screen download the foldablehelper java file here foldablehelper java 6 22 kb to import the foldablehelper java file and add dependencies to the project, follow the steps below in assets > plugins > android, right-click and select import new asset locate and choose the foldablehelper java file, then click import next, open the gradletemplate properties file to any source code editor like visual studio and add the following lines below the **additional_properties** marker android useandroidx = true android enablejetifier = true useandroidx sets the project to use the appropriate androidx libraries instead of support libraries enablejetifier automatically migrates existing third-party libraries to use androidx by rewriting their binaries lastly, open the maintemplate gradle file and add the dependencies for the artifacts needed for the project **apply_plugins** dependencies { implementation filetree dir 'libs', include ['* jar'] implementation "androidx appcompat appcompat 1 6 1" implementation "androidx core core 1 10 1" implementation "androidx core core-ktx 1 10 1" implementation "androidx window window 1 0 0" implementation "androidx window window-java 1 0 0" implementation "org jetbrains kotlin kotlin-stdlib-jdk8 1 9 0" **deps**} create a new playeractivity to implement flex mode on your applications, you must make necessary changes to the activity since it is impossible to access and change the original unityplayeractivity, you need to create a new playeractivity that inherits from the original to do this create a new file named foldableplayeractivity java and import it into the android folder, same as when you imported the foldablehelper java file to extend the built-in playeractivity from unity, write below code in the foldableplayeractivity java file package com unity3d player; import android os bundle; import com unity3d player unityplayeractivity; import com samsung android gamedev foldable foldablehelper; import com samsung android gamedev foldable foldablehelper windowinfolayoutlistener; import android util log; public class foldableplayeractivity extends unityplayeractivity { @override protected void oncreate bundle savedinstancestate { super oncreate savedinstancestate ; foldablehelper init this ; } @override protected void onstart { super onstart ; foldablehelper start this ; } @override protected void onstop { super onstop ; foldablehelper stop ; } @override protected void onrestart { super onrestart ; foldablehelper init this ; } public void attachunitylistener windowinfolayoutlistener listener { foldablehelper attachnativelistener listener, this ; } } oncreate calls the foldablehelper init to ensure that the windowinfotracker and metrics calculator gets created as soon as possible onstart calls the foldablehelper start since the first windowlayoutinfo doesn't get created until onstart onstop calls the foldablehelper stop to ensure that when the application closes, the listener gets cleaned up onrestart calls foldablehelper init when returning to the app after switching away windowinfotracker must be re-initialized; otherwise, flex mode will no longer update after creating the foldableplayeractivity, ensure that the game uses it open the androidmanifest xml file and change the activity name to the one you've just created <activity android name="com unity3d player foldableplayeractivity" android theme="@style/unitythemeselector"> … </activity> store foldablelayoutinfo data to flexproxy implement a native listener that receives calls from java when the device state changes by following these steps use the androidjavaproxy provided by unity in its jni implementation androidjavaproxy is a class that implements a java interface, so the next thing you need to do is create an interface in the foldablehelper java file public interface windowinfolayoutlistener { void onchanged foldablelayoutinfo layoutinfo ; } this interface replaces the temporary native function therefore, remove the code below from the foldablehelper java file public static native void onlayoutchanged foldablelayoutinfo resultinfo ; then, go to the assets > flex_scripts folder and right-click to create a new c# script called flexproxy cs inside this script, replace the automatically generated class with the flexproxy class inheriting from androidjavaproxy public class flexproxy androidjavaproxy { } in flexproxy class, define the variables needed to store the data from foldablelayoutinfo and use enumerators for the folded state, hinge orientation, and occlusion type for the various bounds, use unity's rectint type also, use a boolean to store whether the data has been updated or not public enum state { undefined, flat, half_opened }; public enum orientation { undefined, horizontal, vertical }; public enum occlusiontype { undefined, none, full }; public state state = state undefined; public orientation orientation = orientation undefined; public occlusiontype occlusiontype = occlusiontype undefined; public rectint foldbounds; public rectint currentmetrics; public rectint maxmetrics; public bool needsupdate = false; next, define what java class the flexproxy is going to implement by using the interface's fully qualified name as below public flexproxy base "com samsung android gamedev foldable foldablehelper$windowinfolayoutlistener" { } com samsung android gamedev foldable is the package name of the foldablehelper java file foldablehelper$windowinfolayoutlistener is the class and interface name separated by a $ after linking the proxy to the java interface, create a helper method to simplify java to native conversions private rectint converttorectint androidjavaobject rect { if rect != null { var left = rect get<int> "left" ; var top = rect get<int> "top" ; var width = rect call<int> "width" ; var height = rect call<int> "height" ; return new rectint xmin left, ymin top, width width, height height ; } else { return new rectint -1, -1, -1, -1 ; } } this method takes a java rect object and converts it into a unity c# rectint now, use this converttorectint function for the onchanged function to retrieve the information from the java object and store it in the flex proxy class public void onchanged androidjavaobject layoutinfo { foldbounds = converttorectint layoutinfo get<androidjavaobject> "bounds" ; currentmetrics = converttorectint layoutinfo get<androidjavaobject> "currentmetrics" ; maxmetrics = converttorectint layoutinfo get<androidjavaobject> "maxmetrics" ; orientation = orientation layoutinfo get<int> "hingeorientation" + 1 ; state = state layoutinfo get<int> "state" + 1 ; occlusiontype = occlusiontype layoutinfo get<int> "occlusiontype" + 1 ; needsupdate = true; } implement native flex mode this section focuses on creating the flex mode split-screen effect on the game’s ui create a new c# script in the flex_scripts folder called flexmodemanager cs after creating the script, define the variables you need for this implementation public class flexmodemanager monobehaviour { private flexproxy windowmanagerlistener; [serializefield] private camera maincamera; [serializefield] private camera skyboxcamera; [serializefield] private canvas controlscanvas; [serializefield] private canvas healthcanvas; [serializefield] private gameobject flexbg; [serializefield] private gameobject uiblur; windowmanagerlistener is the callback object which receives the foldablelayoutinfo from the foldablehelper java implementation maincamera and skyboxcamera are two cameras to modify in this project for creating a seamless flex mode implementation controlscanvas and healthcanvas are the two ui elements to manipulate for implementing the flex mode flexbg is a background image to disable in normal mode and enable in flex mode to fill the bottom screen uiblur is a background blur element used as part of the tutorial text it doesn't function properly with flex mode, so disabling it when in flex mode makes the ui looks better next, in the start method, create a new instance of the flexproxy class and attach it to the unity application's activity via the attachunitylistener function void start { windowmanagerlistener = new flexproxy ; using androidjavaclass javaclass = new androidjavaclass "com unity3d player unityplayer" { using androidjavaobject activity = javaclass getstatic<androidjavaobject> "currentactivity" { activity call "attachunitylistener", windowmanagerlistener ; } } } in the update method, check if the windowmanagerlistener has received any new data on the folded state of the device if the system needs an update, then call updateflexmode void update { if windowmanagerlistener needsupdate { updateflexmode ; } } create the updateflexmode method to enable or disable flex mode notethis project is set up for landscape mode only the implementation discussed in this code lab only covers setting up flex mode with a horizontal fold in landscape however, if you were able to follow, it should be simple to set up something similar for different fold orientations on devices such as the galaxy z flip series of devices private void updateflexmode { } check the folded state of the device via the windowmanagerlistener if the device is half_opened, implement flex mode private void updateflexmode { if windowmanagerlistener state == flexproxy state half_opened { } } to split the ui screen horizontally, set the anchor points of the controlscanvas and the healthcanvas so they are locked at the bottom screen or below the fold also, set the viewports of the maincamera and skyboxcamera to be above the fold - which is the top screen next, set the anchors for the flexbg object and enable it to fill the space behind the ui on the bottom screen deactivate the uiblur element if it exists the ui blur element is only present at level 1 of the demo game a check is necessary to ensure the flex mode manager works on the second level private void updateflexmode { if windowmanagerlistener state == flexproxy state half_opened { float lowerscreenanchormax = float windowmanagerlistener foldbounds ymin / windowmanagerlistener currentmetrics height; recttransform controlscanvastransform = controlscanvas getcomponent<recttransform> ; recttransform healthcanvastransform = healthcanvas getcomponent<recttransform> ; recttransform flexbgtransform = flexbg getcomponent<recttransform> ; controlscanvastransform anchormin = new vector2 0, 0 ; controlscanvastransform anchormax = new vector2 1, lowerscreenanchormax ; healthcanvastransform anchormin = new vector2 0, lowerscreenanchormax ; healthcanvastransform anchormax = new vector2 0, lowerscreenanchormax ; flexbgtransform anchormin = new vector2 0, 0 ; flexbgtransform anchormax = new vector2 1, lowerscreenanchormax ; float upperscreenrectheight = float windowmanagerlistener foldbounds ymax / windowmanagerlistener currentmetrics height; maincamera rect = new rect 0, upperscreenrectheight, 1, upperscreenrectheight ; skyboxcamera rect = new rect 0, upperscreenrectheight, 1, upperscreenrectheight ; flexbg setactive true ; if uiblur != null uiblur setactive false ; } } return the ui to full screen when the device is no longer in flex mode by disabling flexbg; enabling uiblur when it exists; and setting all the anchor points and viewports back to their original values and finally, inform the windowmanagerlistener that it doesn't need an update else { recttransform controlscanvastransform = controlscanvas getcomponent<recttransform> ; recttransform healthcanvastransform = healthcanvas getcomponent<recttransform> ; controlscanvastransform anchormin = new vector2 0, 0 ; controlscanvastransform anchormax = new vector2 1, 1 ; healthcanvastransform anchormin = new vector2 0, 1 ; healthcanvastransform anchormax = new vector2 0, 1 ; maincamera rect = new rect 0, 0, 1, 1 ; skyboxcamera rect = new rect 0, 0, 1, 1 ; flexbg setactive false ; if uiblur != null uiblur setactive true ; } windowmanagerlistener needsupdate = false; set up the scenes for flex mode go back to the unity editor in assets > 3dgamekit > scenes > gameplay, double-click on the level 1 scene to open it right-click in the hierarchy window and select create empty name the new gameobject as flexmanager or a similar name to reflect its purpose select the flexmanager object and click the add component button in the inspector window type in flexmodemanager, and select the script when it shows up select the relevant objects for each camera, canvas and game object as below do the same for level 2 but leave the ui blur empty build and run the app go to file > build settings click build at the bottom of the window to build the apk after building the apk, run the game app on a foldable galaxy device and see how the ui switches from normal to flex mode if you don’t have any physical device, you can also test it on a remote test lab device tipwatch this tutorial video and know how to easily test your app via remote test lab you're done! congratulations! you have successfully achieved the goal of this code lab now, you can implement flex mode in your unity game app by yourself! to learn more, visit www developer samsung com/galaxy-z www developer samsung com/galaxy-gamedev
Learn Code Lab
codelabimplement flex mode on an unreal engine game objective learn how to implement flex mode on an unreal engine game using android jetpack windowmanager and raw java native interface jni overview the flexible hinge and glass display on galaxy foldable devices, such as the galaxy z fold4 and galaxy z flip4, let the phone remains propped open while you use apps when the phone is partially folded, it will go into flex mode apps will reorient to fit the screen, letting you watch videos or play games without holding the phone for example, you can set the device on a flat surface, like on a table, and use the bottom half of the screen to navigate unfold the phone to use the apps in full screen mode, and partially fold it again to return to flex mode to provide users with a convenient and versatile foldable experience, developers need to optimize their apps to meet the flex mode standard set up your environment you will need the following epic games launcher with unreal engine 4 or later visual studio or any source code editor samsung galaxy foldable device galaxy z fold2, z fold3, or newer galaxy z flip, z flip3, or newer remote test lab if physical device is not available requirements samsung account java runtime environment jre 7 or later with java web start internet environment where port 2600 is available create and set up your project after launching unreal engine from the epic games launcher, follow the steps below to start your project in the select or create new project window, choose games as a new project category and click next select third person as template, then click next to proceed noteyou can implement flex mode on any template or existing projects and use this code lab activity as a reference in the project settings window, set the following type of project c++ target platform mobile / tablet performance characteristics scalable 3d or 2d real-time raytracing raytracing disabled include an additional content pack no starter content project name tutorial_project click create project wait for the engine to finish loading and open the unreal editor once the project is loaded, go to edit > project settings > platforms > android click the configure now button if the project is not yet configured for the android platform then, proceed with the following apk packaging and build settings a apk packaging set target sdk version to 30 set orientation to full sensor change the maximum supported aspect ratio to 2 8 aspect ratio of galaxy z fold3 in decimal to prevent black bars from appearing on the cover display leave it if your game does not need to use the cover display enable use display cutout region?, to prevents black bars at the edge of the main screen otherwise, leave it unchecked b build disable support opengl es3 1 and enable support vulkan notecurrently, there is a problem with opengl es and the split-screen system being investigated the only option right now is to turn off opengl es and use vulkan instead enable native resize event the resize event of a game when switching between displays is disabled in the engine by default however, this behavior can be easily enabled by setting android enablenativeresizeevent=1 in the deviceprofile currently, the only way to create a profile for foldable devices is by creating a specific rule for each device to save time in this code lab, enable the native resize event for all android devices instead locate and open the tutorial_project > config folder in file explorer inside the config folder, create a new folder named android create a new file called androiddeviceprofiles ini and open this file in a text editor, such as visual studio copy below deviceprofile code to the newly created androiddeviceprofiles ini file [deviceprofiles] +deviceprofilenameandtypes=android,android [android deviceprofile] devicetype=android baseprofilename= +cvars=r mobilecontentscalefactor=1 0 +cvars=slate absoluteindices=1 +cvars=r vulkan delayacquirebackbuffer=2 +cvars=r vulkan robustbufferaccess=1 +cvars=r vulkan descriptorsetlayoutmode=2 ; don't enable vulkan by default specific device profiles can set this cvar to 0 to enable vulkan +cvars=r android disablevulkansupport=1 +cvars=r android disablevulkansm5support=1 ; pf_b8g8r8a8 +cvars=r defaultbackbufferpixelformat=0 +cvars=android enablenativeresizeevent=1 ; previewallowlistcvars and previewdenylistcvars are arrays of cvars that are included or excluded from being applied in mobile preview ; if any previewallowlistcvars is set, cvars are denied by default previewallowlistcvars=none this is a copy of the default android deviceprofile from the existing basedeviceprofiles ini file but with the enabled nativeresizeevent console variable cvars notethis step is not required when you only want to implement flex mode yet, it's recommended, to allow applications to run seamlessly from main to cover display without stretching and squashing the game, by enabling the nativeresizeevent create a new plugin and import the foldablehelper foldablehelper is a java file that you can use in different projects it provides an interface to the android jetpack windowmanager library, enabling application developers to support new device form factors and multi-window environments before proceeding, read how to use jetpack windowmanager in android game dev and learn the details of how foldablehelper uses windowmanager library to retrieve information about the folded state of the device flat for normal mode and half-opened for flex mode , window size, and orientation of the fold on the screen download the foldablehelper java file here foldablehelper java 5 64 kb to import the foldablehelper java file to the project, follow the steps below go to edit > plugins in the unreal editor click the new plugin button and select blank to create a blank plugin in the name field, type foldables_tutorial and click the create plugin button in file explorer, locate and open tutorial_project > plugins folder go to plugins > foldables_tutorial > source> foldables_tutorial > private and create a new folder called java copy the foldablehelper java file into java folder open the tutorial_project sln file in visual studio in the same private folder path, add a new filter called java right-click on the java filter and click add > existing item locate the foldablehelper java file, then click add to include this java file in the build modify java activity to use foldablehelper unreal plugin language upl is a simple xml-based language created by epic games for manipulating xml and returning strings using upl, you can utilize the foldablehelper java file by modifying the java activity and related gradle files as follows in visual studio, right-click on source > foldables_tutorial folder, then click add > new item > web > xml file xml create an xml file called foldables_tutorial_upl xml ensure that the file location is correct before clicking add in the newly created xml file, include the foldablehelper java file in the build by copying the java folder to the build directory <root xmlns android="http //schemas android com/apk/res/android"> <prebuildcopies> <copydir src="$s plugindir /private/java" dst="$s builddir /src/com/samsung/android/gamedev/foldable" /> </prebuildcopies> set up the gradle dependencies in the build gradle file by adding the following in the xml file <buildgradleadditions> <insert> dependencies { implementation filetree dir 'libs', include ['* jar'] implementation "org jetbrains kotlin kotlin-stdlib-jdk8 1 6 0" implementation "androidx core core 1 7 0" implementation "androidx core core-ktx 1 7 0" implementation "androidx appcompat appcompat 1 4 0" implementation "androidx window window 1 0 0" implementation "androidx window window-java 1 0 0" } android{ compileoptions{ sourcecompatibility javaversion version_1_8 targetcompatibility javaversion version_1_8 } } </insert> </buildgradleadditions> next, modify the gameactivity <gameactivityimportadditions> <insert> <!-- package name of foldablehelper --> import com samsung android gamedev foldable foldablehelper; </insert> </gameactivityimportadditions> <gameactivityoncreateadditions> <insert> foldablehelper init this ; </insert> </gameactivityoncreateadditions> <gameactivityonstartadditions> <insert> foldablehelper start this ; </insert> </gameactivityonstartadditions> <gameactivityonstopadditions> <insert> foldablehelper stop ; </insert> </gameactivityonstopadditions> </root> gameactivityimportadditions adds the com samsung android gamedev foldable foldablehelper into the gameactivity with the existing imports gameactivityoncreateadditions adds the code to the oncreate method inside the gameactivity gameactivityonstartadditions adds the code to the onstart method inside the gameactivity gameactivityonstopadditions adds the code to the onstop method inside the gameactivity save the xml file then, ensure that the engine uses the upl file by modifying the foldables_tutorial build cs script, located in the same folder as the foldables_tutorial_upl xml file after the dynamicallyloadedmodulenames addrange call, add the following if target platform == unrealtargetplatform android { additionalpropertiesforreceipt add "androidplugin", moduledirectory + "\\foldables_tutorial_upl xml" ; } this means that the game engine will use the upl file if the platform is android otherwise, the foldablehelper won’t work implement a storage struct the next thing to implement is a struct, the native version of java’s foldablelayoutinfo class to store the data retrieved from the java code using a struct, do the following in content browser of unreal editor, right-click on c++ classes > add/import content then, click new c++ class select none for the parent class and click next name the new class as foldablelayoutinfo assign it to the foldables_tutorial plugin then, click create class delete the created foldablelayoutinfo cpp file and only keep its header file in the header file called foldablelayoutinfo h, set up a struct to store all needed data from the windowmanager #pragma once #include "core h" enum efoldstate { undefined_state, flat, half_opened }; enum efoldorientation { undefined_orientation, horizontal, vertical }; enum efoldocclusiontype { undefined_occlusion, none, full }; struct ffoldablelayoutinfo { efoldstate state; efoldorientation orientation; efoldocclusiontype occlusiontype; fvector4 foldbounds; fvector4 currentmetrics; fvector4 maxmetrics; bool isseparating; ffoldablelayoutinfo state efoldstate undefined_state , orientation efoldorientation undefined_orientation , occlusiontype efoldocclusiontype undefined_occlusion , foldbounds -1, -1, -1, -1 , currentmetrics -1, -1, -1, -1 , maxmetrics -1, -1, -1, -1 , isseparating false { } }; implement jni code to implement jni, create a new c++ class with no parent and name it foldables_helper assign the class to the same plugin, then modify the c++ header and source files as follows in the created header file foldables_helper h , include foldablelayoutinfo h #include "foldablelayoutinfo h" then, declare a multicast_delegate to serve as a listener for passing the data from the java implementation to the rest of the engine declare_multicast_delegate_oneparam fonlayoutchangeddelegate, ffoldablelayoutinfo ; lastly, set up the methods and member variables class foldables_tutorial_api ffoldables_helper { public static void init ; static bool haslistener; static fonlayoutchangeddelegate onlayoutchanged; }; moving to the source file foldables_helper cpp , set up the definitions for the methods and member variables created in the header file bool ffoldables_helper haslistener = false; fonlayoutchangeddelegate ffoldables_helper onlayoutchanged; void ffoldables_helper init { haslistener = true; } now, in the same source file, create the native version of the onlayoutchanged function created in the foldablehelper java file since the java onlayoutchanged function only works on android, surround the function with an #if directive to ensure that it compiles only on android #if platform_android #endif within this directive, copy the code below to use the jni definition of the java onlayoutchanged function extern "c" jniexport void jnicall java_com_samsung_android_gamedev_foldable_foldablehelper_onlayoutchanged jnienv * env, jclass clazz, jobject jfoldablelayoutinfo { create the ffoldablelayoutinfo to store the data retrieved from java ffoldablelayoutinfo result; retrieve the field ids of the foldablelayoutinfo and rect objects created in the java file //java foldablelayoutinfo field ids jclass jfoldablelayoutinfocls = env->getobjectclass jfoldablelayoutinfo ; jfieldid currentmetricsid = env->getfieldid jfoldablelayoutinfocls, "currentmetrics", "landroid/graphics/rect;" ; jfieldid maxmetricsid = env->getfieldid jfoldablelayoutinfocls, "maxmetrics", "landroid/graphics/rect;" ; jfieldid hingeorientationid = env->getfieldid jfoldablelayoutinfocls, "hingeorientation", "i" ; jfieldid stateid = env->getfieldid jfoldablelayoutinfocls, "state", "i" ; jfieldid occlusiontypeid = env->getfieldid jfoldablelayoutinfocls, "occlusiontype", "i" ; jfieldid isseparatingid = env->getfieldid jfoldablelayoutinfocls, "isseparating", "z" ; jfieldid boundsid = env->getfieldid jfoldablelayoutinfocls, "bounds", "landroid/graphics/rect;" ; jobject currentmetricsrect = env->getobjectfield jfoldablelayoutinfo, currentmetricsid ; //java rect object field ids jclass rectcls = env->getobjectclass currentmetricsrect ; jfieldid leftid = env->getfieldid rectcls, "left", "i" ; jfieldid topid = env->getfieldid rectcls, "top", "i" ; jfieldid rightid = env->getfieldid rectcls, "right", "i" ; jfieldid bottomid = env->getfieldid rectcls, "bottom", "i" ; retrieve the current windowmetrics and store it in the ffoldablelayoutinfo as an fintvector4 // currentmetrics int left = env->getintfield currentmetricsrect, leftid ; int top = env->getintfield currentmetricsrect, topid ; int right = env->getintfield currentmetricsrect, rightid ; int bottom = env->getintfield currentmetricsrect, bottomid ; // store currentmetrics rect to fvector4 result currentmetrics = fintvector4{ left, top, right, bottom }; do the same for the other variables in the java foldablelayoutinfo // maxmetrics jobject maxmetricsrect = env->getobjectfield jfoldablelayoutinfo, maxmetricsid ; left = env->getintfield maxmetricsrect, leftid ; top = env->getintfield maxmetricsrect, topid ; right = env->getintfield maxmetricsrect, rightid ; bottom = env->getintfield maxmetricsrect, bottomid ; //store maxmetrics rect to fvector4 result maxmetrics = fintvector4{ left, top, right, bottom }; int hingeorientation = env->getintfield jfoldablelayoutinfo, hingeorientationid ; int state = env->getintfield jfoldablelayoutinfo, stateid ; int occlusiontype = env->getintfield jfoldablelayoutinfo, occlusiontypeid ; bool isseparating = env->getbooleanfield jfoldablelayoutinfo, isseparatingid ; // store the values to an object for unreal result orientation = tenumasbyte<efoldorientation> hingeorientation + 1 ; result state = tenumasbyte<efoldstate> state + 1 ; result occlusiontype = tenumasbyte<efoldocclusiontype> occlusiontype + 1 ; result isseparating = isseparating; // boundsrect jobject boundsrect = env->getobjectfield jfoldablelayoutinfo, boundsid ; left = env->getintfield boundsrect, leftid ; top = env->getintfield boundsrect, topid ; right = env->getintfield boundsrect, rightid ; bottom = env->getintfield boundsrect, bottomid ; // store maxmetrics rect to fvector4 result foldbounds = fintvector4{ left, top, right, bottom }; broadcast the result via the onlayoutchanged delegate for use in the engine if ffoldables_helper haslistener { ue_log logtemp, warning, text "broadcast" ; ffoldables_helper onlayoutchanged broadcast result ; } } create a player controller and two ui states this section focuses on adding a player controller and creating two user interface ui states for flat and flex modes these objects are needed for the flex mode logic implementation following are the steps to add a player controller and create two ui states add a new player controller blueprint in content browser, go to content > thirdpersoncpp and right-click on blueprints > add/import content > blueprint class pick player controller as its parent class rename it as flexplayercontroller notethe flexplayercontroller added is generic and can be replaced by your custom player controller in an actual project add a new c++ class with actor component as its parent class name it as foldables_manager and assign it to the foldables_tutorial plugin click the create class button open the flexplayercontroller blueprint by double-clicking it click open full blueprint editor attach the actor component to the flexplayercontroller in the left pane, click add component, then find and select the foldables_manager next, create a pair of userwidget classes for the ui layouts needed flat mode ui for the full screen or normal mode; and flex mode ui for split-screen in add c++ class window, select the show all classes checkbox find and pick userwidget as the parent class then, click next name the new user widget as flatui and attach it to the plugin click next repeat the process but name the new user widget as flexui you might get an error when trying to compile stating that the userwidget is an undeclared symbol to fix this, open the foldables_tutorial build cs file, and in the publicdependencymodulenames addrange call, add "inputcore" and "umg" to the list create a pair of blueprints made from subclasses of these two user widgets right-click on content and create a new folder called foldui inside the newly created folder, right-click to add a new blueprint class in all classes, choose flatui and click the select button rename the blueprint as bp_flatui in the same folder, repeat the process but choose the flexui class and rename the blueprint as bp_flexui double-click on bp_flatui and bp_flexui, then design your two uis like below to visualize switching between flat and flex mode flat ui flex ui notethis code lab activity does not cover the steps on how to create or design ui if you want to learn about how to create your own game design in unreal engine 4, refer to unreal motion graphics ui designer guide implement the flex mode logic after creating the flexplayercontroller and the two ui states bp_flatui and bp_flexui , you can now implement flex mode logic in the foldables_manager open the foldables_manager h and include the necessary c++ header files #pragma once #include "coreminimal h" #include "components/actorcomponent h" #include "engine h" #include "flatui h" #include "flexui h" #include "foldables_helper h" #include "foldables_manager generated h" remove the line below to save a little bit of performance as this component doesn't need to tick public // called every frame virtual void tickcomponent float deltatime, eleveltick ticktype, factorcomponenttickfunction* thistickfunction override; set up the functions needed in foldables_manager the constructor, a function to create the ui widgets the implementation of onlayoutchanged delegate public // sets default values for this component's properties ufoldables_manager ; void createwidgets ; protected // called when the game starts virtual void beginplay override; protected void onlayoutchanged ffoldablelayoutinfo foldablelayoutinfo ; then, set up the variables needed references to the flat and flex ui classes references to the flat and flex ui objects mark the pointers as uproperty to ensure that garbage collection does not delete the objects they point to tsubclassof<uuserwidget> flatuiclass; tsubclassof<uuserwidget> flexuiclass; uproperty class uflatui* flatui; uproperty class uflexui* flexui; finally, define a new private function restoreflatmode , to disable flex mode and return to normal mode private void restoreflatmode ; moving over to foldables_manager cpp, implement the constructor using the constructorhelpers, find the ui classes and set the variables to store these classes also, set the bcanevertick to false to prevent the component from ticking and remove the code block of tickcomponent function // sets default values for this component's properties ufoldables_manager ufoldables_manager { primarycomponenttick bcanevertick = false; static constructorhelpers fclassfinder<uflatui> flatuibpclass text "/game/foldui/bp_flatui" ; static constructorhelpers fclassfinder<uflexui> flexuibpclass text "/game/foldui/bp_flexui" ; if flatuibpclass succeeded { flatuiclass = flatuibpclass class; } if flexuibpclass succeeded { flexuiclass = flexuibpclass class; } } next, set up the beginplay function to link the delegate to the onlayoutchanged function, to initialize the foldables_helper, and to create the widgets ready for use in the first frame // called when the game starts void ufoldables_manager beginplay { super beginplay ; ffoldables_helper onlayoutchanged adduobject this, &ufoldables_manager onlayoutchanged ; ffoldables_helper init ; createwidgets ; } set up the createwidgets function to create the widgets using the ui classes acquired in the constructor add the flatui widget to the viewport, assuming the app opens in normal mode until it receives the foldablelayoutinfo void ufoldables_manager createwidgets { flatui = createwidget<uflatui> aplayercontroller* getowner , flatuiclass, fname text "flatui" ; flexui = createwidget<uflexui> aplayercontroller* getowner , flexuiclass, fname text "flexui" ; flatui->addtoviewport ; } afterward, create the onlayoutchanged function, which will be called via a delegate inside this function, check whether the device’s folded state is half_opened if so, check whether the orientation of the fold is horizontal void ufoldables_manager onlayoutchanged ffoldablelayoutinfo foldablelayoutinfo { //if state is now flex if foldablelayoutinfo state == efoldstate half_opened { if foldablelayoutinfo orientation == efoldorientation horizontal { notefor this third person template, splitting the screen vertically isn’t ideal from a user experience ux point of view for this code lab activity, split the screen only on the horizontal fold top and bottom screen if you want it vertically, you need to use the same principle in the next step but for the x-axis instead of the y-axis you must also ensure that you have a flex ui object for the vertical layout if the device is both on flex mode and horizontal fold, change the viewport to only render on the top screen using the normalized position of the folding feature then in an asynctask on the game thread, disable the flatui and enable the flexui however, if the device is on normal mode, then return to flat ui using restoreflatmode function //horizontal split float foldratio = float foldablelayoutinfo foldbounds y / foldablelayoutinfo currentmetrics w - foldablelayoutinfo currentmetrics y ; gengine->gameviewport->splitscreeninfo[0] playerdata[0] sizex = 1 0f; gengine->gameviewport->splitscreeninfo[0] playerdata[0] sizey = foldratio; asynctask enamedthreads gamethread, [=] { if flatui->isinviewport { flatui->removefromparent ; } if !flexui->isinviewport { flexui->addtoviewport 0 ; } } ; } else { restoreflatmode ; } } else { restoreflatmode ; } } reverse the flex mode implementation logic to create the restoreflatmode function by setting the viewport to fill the screen, then disable the flexui and enable the flatui void ufoldables_manager restoreflatmode { gengine->gameviewport->splitscreeninfo[0] playerdata[0] sizex = 1 0f; gengine->gameviewport->splitscreeninfo[0] playerdata[0] sizey = 1 0f; asynctask enamedthreads gamethread, [=] { if !flatui->isinviewport { flatui->addtoviewport 0 ; } if flexui->isinviewport { flexui->removefromparent ; } } ; } set up a game mode and attach the flexplayercontroller the game mode defines the game rules, scoring, and any game-specific behavior set up the game mode in unreal editor by creating a blueprint class in the content > thirdpersoncpp > blueprints folder pick game mode base as the parent class and rename it as flexgamemode double-click on flexgamemode in the drop-down menu next to player controller class, choose the flexplayercontroller lastly, go to edit > project settings > project > maps & modes and select flexgamemode as the default gamemode build and run the app go to edit > package project > android to build the apk ensure that the android development environment for unreal is already set up to your computer noteif the build failed due to corrupted build tools, consider downgrading the version to 30 or lower using the sdk manager or, simply rename d8 bat to the name of the missing file dx bat in sdk path > build-tools > version number directory and, in lib folder of the same directory, rename d8 jar to dx jar after packaging your android project, run the game app on a foldable galaxy device and see how the ui switches from normal to flex mode if you don’t have any physical device, you can also test it on a remote test lab device tipwatch this tutorial video and know how to easily test your app via remote test lab you're done! congratulations! you have successfully achieved the goal of this code lab now, you can implement flex mode in your unreal engine game app by yourself! if you're having trouble, you may download this file flex mode on unreal complete code 20 16 mb to learn more, visit www developer samsung com/galaxy-z www developer samsung com/galaxy-gamedev
Develop GameDev
docadaptive performance v1 0adaptive performance v1 0 v2 0adaptive performance v2 0 introduction adaptive performance provides that way to manage both the thermals and performance of a game on a mobile device samsung has partnered with unity, to provide this solution why is managing both the thermals and performance important on a device? the answer is that today’s mobile devices have more resources than in the past, but they are still limited as resources increased, developers wanted more natural and authentic graphics so the game needs more resources, which naturally leads to an increase in temperature but in this situation, the problem is that there is no information about those resources and that means that developers couldn’t recognize the reason for performance drops to avoid this situation, developers not only optimize the entire game, but also use settings to control various graphics qualities to target the appropriate performance on each device but if a developer could know sufficient hardware information before the device faces a performance drop, then they can easily and effectively manage the performance of the device samsung provides hints that can easily read the temperature and state of the device through the gamesdk, then unity processes that information and provides a way to manage thermal and performance through adaptive performance this graph shows how adaptive performance helps sustain a high frame rate in the mega city unity demo running on the samsung galaxy s10 the blue line shows a much more stable frame rate with adaptive performance while the red line shows the behaviour before adaptive performance was added as you can see from this result, adaptive performance makes much more stable frame rate, and it can improve the user experience how to use adaptive performance is a package for unity engine to use it, follow the instructions below unity editor → window → package manager → choose package all → install adaptive performance & adaptive performance samsung android actually that is all that is required to use adaptive performance, you don't need any setting for this but if you need more detailed information, look at the links below adaptive performance release note adaptive performance preview! install and user guide korean a deep look inside games gamesdk and adaptive performance english unity blog korean unity blog english supported devices with the first launch of adaptive performance, we supported devices after galaxy s10 running android pie after launch we have added support for all old and new samsung galaxy models with android 10 also we provide below support devices list series models galaxy s galaxy s10e / s10 / s10+galaxy s10 lite galaxy s20 / s20+ / s20 ultra galaxy s20 lite galaxy note galaxy note9 galaxy note10 / note10+ galaxy note10 litegalaxy note20 / note20 ultra galaxy z galaxy z fold2 galaxy a galaxy a10sgalaxy a11 galaxy a21s galaxy a31 galaxy a41 galaxy a50s galaxy a51 galaxy a51 5g galaxy a71 galaxy a71 5g galaxy a80 galaxy a8 2018 galaxy a9 2018 galaxy a9 2018 galaxy a90 5g galaxy xcover galaxy xcover 4s galaxy xcover pro galaxy m galaxy m11 galaxy m30s galaxy m31s galaxy tab galaxy tab s6galaxy tab s7 galaxy tab s7+ support status for each model could be different by the selling area and the os version of the device
We use cookies to improve your experience on our website and to show you relevant advertising. Manage you settings for our cookies below.
These cookies are essential as they enable you to move around the website. This category cannot be disabled.
These cookies collect information about how you use our website. for example which pages you visit most often. All information these cookies collect is used to improve how the website works.
These cookies allow our website to remember choices you make (such as your user name, language or the region your are in) and tailor the website to provide enhanced features and content for you.
These cookies gather information about your browser habits. They remember that you've visited our website and share this information with other organizations such as advertisers.
You have successfully updated your cookie preferences.