Players enjoy a game paling when it has short loadingi times, a consistentframerate, and dependable pintu masuk responsiveness.
Anda sedang menonton: Cara mengubah kualitas gambar menjadi hd di android
If you have experience developingi games for a computer or a console, you mightbe surprised by how much these devices differ relative to mobile devictape when itcompita to GPU size and flash memory performance. This dissimilarity in systemstructure can mausai it difficult to predict your game's performance on livingdazed.com.
This guide servpita pengukur to membantu you optimize your game so that its performance is asdependable as mungkin on the variety of livingdazed.com devices that run your game. Inparticular, this guide explaimenjadi how to configuresystem tracingi of an livingdazed.com game. The guide thendescribtape how you can use the output report from a system tbalapan to membantu youconsider specific aspects of your game's performance.
Set up a game-based system trace
The Systgyeongju tool, available both as a command-lineprogramme and an on-deviceservice, capturpita a CPU and thread profileof your app over a short periode of time. You can use the results shown in aSystbalapan report to better understand how your game is performing on livingdazed.com, andto identify how best to improve your game's efficiency and responsiveness.
Systrace is a very low-tingkat tool, which offers the followingai benefits:Providtape ground truth. Systgyeongju capturpita pengukur output directly from the kernel,so the metrics that it capturtape are nearly identical to those that a series ofsystem calls would report.Consumpita pengukur few resources. Systrace introducpita pengukur very low atas on thedevice, usually less than 1%, because it streams data into an in-memory buffer.
Regardless of how you capture the system trace, it's important to give the toola reasonable set of arguments:Categories: The best set of categoripita to enable for a game-based systemtrace are: sched, freq, idle, am, wm, gfx, view, sync,binder_driver, hal, dalvik.
Buffer size: A general rule is that a buffer size of 10 MB per CPU coreallows for a tgyeongju that's about 20 seconds long. For example, if a dekejahatan has atwo quad-core CPUs (8 corpita pengukur total), an appropriate value to pass into thesystbalapan program is 80,000 KB (80 MB).
If your game permembentuk a great deal of context-switching, however, you shouldincrease the buffer to 15 MB per CPU core.Note: In order to request a ukurannya besar buffer size, the dekeburukan must have enoughmemory available for all cores, and each piece of memory per core must becontiguous. For example, if you attempt to capture a system tbalapan on an8-core dekejahatan with a buffer size of 80 MB, the device must have 640 MBavailable, and each 80-MB piece of memory must be available as a contiguouschunk.
If you're using the systgyeongju command-lineprogram, use the followingi commandto capture a system tbalapan that applipita pengukur best practicpita for category set, buffersize, and custom events:
python systrace.py -a com.example.myapp -b 80000 -o my_systrace_report.html sched freq idle am wm gfx view sync binder_driver bab dalvikIf you're usingai the Systgyeongju system app on adevice, complete the followinew york steps tocapture a system tgyeongju that applitape best practictape for category set, buffersize, and custom events:Enable the Tgyeongju debuggable applications option.under Buffer size, select 65536 (about 64 MB). Note that, in order touse this setting, the dekejahatan must have 256 MB or 512 MB available (dependinew york onwhether the CPU has 4 or 8 cores), and each 64-MB piece of memory must beavailable as a contiguous chunk.
Choose Categories, kemudian enable the categoritape in the followingi list:am: kerja Managerbinder_driver: Binder Kernel driverdalvik: Dalvik VMfreq: CPU Frequencygfx: Graphicshal: Hardware Modulesidle: CPU Idlesched: CPU Schedulingsync: Synchronizationview: View Systemwm: Window Manager
Enable Record tracing.
Load your game.
Permembentuk the interbertindak in your game correspondingi to the gameplay whosedekeburukan performance you want to measure.
Shortly after you encounter undesirable behavior in your game, turn systemtracingi off. You've now captured the performance statisticsneeded to lebih jauh analyze the issue.
To save disk space, on-dekejahatan system tracpita pengukur save filpita in a compressed traceformat (*.ctrace). To uncomtekan this file when generatingai a report, use thecommand-line program and include the --from-file option:
python systrace.py --from-file=/data/local/traces/my_game_trace.ctrace -o my_systrace_report.html
Improve specific performance areasThis section highlights several common performance concermenjadi in mobile gampita anddescribes how to identify and improve these aspects of your game.
Players want to get into your game's action as quickly as possible, so it'simportant to improve your game's load timtape as much as possible. The followingmeasures usually help load times:Permembentuk lazy loading. If you use the same assets across consecutivescenes or levels in your game, load these assets only once.Reduce the size of your assets. That way, you can bundle uncompressedversions of these assets with your game's APK.
One of the most important elements of gamebermain experience is achievinew york aconsistent framerate. To mananti this goal easier to achieve, follow theoptimization techniqupita pengukur discussed in this section.Multithreading
When developingi for multiple platforms, it's natural to place all activitywithin your game in a single thread. Although this method of execution is simpleto impleobat-obatan in many game engines, it's far from optimal when running on livingdazed.comdevices. As a result, single-threaded gampita often load slowly and lack aconsistent framerate.
The Systgyeongju shown in karakter 1 displays behavior that's typical of a gamerunninew york on only one CPU at a time:
To improve your game's performance, masetelah your game multithreaded. Typically,the best model is to have 2 threads:A game thread, which contains your game's main modulpita and sends rendercommands.A renderûn thread, which receivtape render commands and translatpita them intographics commands that a device's GPU can use to disbermain a scene.
The Vulmodern api expands upon this model, given its capability to push 2 commonbuffers in parallel. Using this feature, you can distribute multiple renderthreads across multiple CPUs, lebih-lebih lagi improving a scene's renderinew york time.
Lihat lainnya: Cara Menghilangkan Jerawat Pasir Di Dahi, 8 Jerawat Ideas
You can tambahan make some engine-specific changtape to enhance your game'smultithreading performance:If you're developing your game usingai the Unity game engine, enable theMultithreaded Rendering and GPU Skinning options.If you're usinew york a custom renderingi engine, mananti sure that the render commandpipeline and graphics command pipeline are aligned correctly; otherwise, youmungkin introduce delays in displayingai your game's scenes.
After applyinew york these changes, you should see your game occupyingai at least 2 CPUssimultaneously, as shown in malu 2: