
Adaptation (from the Latin. Adapto - adapt) - the process of adaptation to changing environmental conditions.
In recent years, we have seen rapid evolutionary changes in mobile systems. Brand new ones appear, existing ones change. Productivity is growing, ultrabooks are replacing laptops, which differ from their predecessors not only in appearance, but also in a new form factor, touch screen, touch sensors, etc.
And these changes must be adapted.
In this article I will give a few examples and recommendations that will help make your game more friendly to mobile platforms such as laptops, netbooks, and ultrabooks.
Initially, the computing power of the laptop was not at the forefront, manufacturers were looking for a compromise, sacrificing performance to size and power consumption. But progress did not stand still, processors improved, accelerated, became less “voracious”, which ultimately led to the fact that now you can find a mobile system in the market that is not inferior to the desktop, and even surpassing its performance.
')
With the advent of the second generation of Sandy Bridge for mobile systems, laptops have become even closer to being called gaming systems. Only in recent years, the average number of frames attainable in games (when playing at medium settings) has increased significantly.

So, the forecast of the personal systems market shows that desktop PCs go out of fashion, they are being replaced by mobile ones. The volume of their sales will grow from year to year. There is also a shift in the market towards ultrabooks, as the most mobile among mobiles. According to pessimistic forecasts, their sales by 2015 will amount to more than 50 million units per year. According to optimistic - about 150.

Judge it or not - judge for yourself: most users, thinking about upgrading a home PC, choose a laptop, while getting the same performance, plus mobility. In the near future, preference will be given to ultrabook, as a lighter, more productive platform with, besides, a number of distinctive features - design, sensors.


First experience
The first thing to think about is if you want to create a game that users can appreciate on laptops or ultrabooks, this is the main menu of the game. The first impression can be decisive, it can motivate the user to take further action (start the game), or induce to remove the game and never return to it. The reason can be a negative experience, for example, the user has a mediocre system, and you, when creating a game, decided to hit it with a stunning main menu, where everything is animated, there are a lot of effects, everything is shiny and sparkling. As a result, after the launch, the user will see a “slideshow” and the first impression will be spoiled. It is important in the process of launching the game to determine the capabilities of the system and, if the game is running on a “weak” laptop, sacrifice the beauty of the interface for the sake of performance.

Plus, give the user a simple and intuitive way to enter the game settings, where he himself will be able to adjust the game to the capabilities of his system. Also, one more step towards the user will be confirmation of the use of the selected settings after their application. It may happen that the user accidentally, or unknowingly, selects the maximum settings or unsupported resolution, and only the most persistent can return, just as it was (search and delete the settings file, branches in the registry, etc.).
Determination of system parameters
In some cases, even when defining the settings, there may still be problems with the performance of the game. This happens because the system parameters are determined incorrectly, both for the better and for the worse. The reason may be the incorrect determination of the capabilities of the GPU:
- The amount of memory integrated in the GPU is determined, and on the basis of this, a conclusion is drawn about the performance of the graphics system. It does not take into account the amount of shared memory that is used by integrated graphics.
- Request supported shaders and their use in case of availability, without analyzing how its use may affect the performance of the game as a whole. It can lead to the fact that the "picture" will be beautiful, but very slow.
- Defining GPU parameters based on DeviceString. This string may vary in drivers from version to version.
pFactory->EnumAdapters( FIRST_GFX_ADAPTER, &pAdapter ) ; { DXGI_ADAPTER_DESC adapterDesc; pAdapter->GetDesc( &adapterDesc ); *VendorId = adapterDesc.VendorId; *DeviceId = adapterDesc.DeviceId; }

But this solution is incomplete. For the latest Intel HD Graphics models, the base frequency is different, it can be 350 MHz or 650 MHz (depending on the model) in normal mode and 1100 MHz and 1300 MHz in turbo mode. For a more complete picture, it is also necessary to take into account the frequency.
pDevice->CheckCounter( &Description, &Type, &SlotsRequired, sName, ……) ; if ( strcmp(sName ,"Intel Device Information“) == 0 ) { ……… pImmediateContext->GetData(pCounter, pData, sizeof(SQueryDeviceInfo), NULL); *pGPUMinFrequency = (SQueryDeviceInfo*)pData[0]->GPUMinFreq; }

A more detailed example with source codes can be found on the
GPU Detect page.
Dynamic resolution rendering
Screen resolution can be the next bottleneck. The higher the resolution, the more resources the system will need to display on the screen. For example, the ratio of the number of pixels on a screen between WXGA and WQHD is four. Those. You will need to render a four times larger scene, you will need four times more memory. The solution could be a dynamic resolution rendering. In general, the essence of the method consists in rendering a scene with a lower resolution with the subsequent scaling of the image to the required resolution.

You can read more about this method here -
software.intel.com/ru-ru/articles/dynamic-resolution-rendering-articleSpecific tips on optimizing 3D graphics on an Intel GPU, as well as a story about the features, performance and development of Intel HD Graphics can be found in this article -
habrahabr.ru/company/intel/blog/144486Battery life
The developer took into account all the techniques of optimizing and adapting the game for mobile platforms, and the user received a game that you could and would like to play. What's next? Allow to play as long as possible, because This can be interesting not only to the player, but also to the developer. Now many games offer the purchase of game objects for real money. In such cases, the expression “time is money” takes on a literal meaning for the developer.
In order to find a solution, you need to understand the causes of the problems. If we consider the components of the system in terms of energy consumption, we have built the following picture:

The leader is the screen, followed by the processor, memory, etc. On the screen, it seems, it is impossible to influence in any way, let's try to deal with the CPU.
The processor can be in different states, which can be divided into active and idle state. The main energy consumption falls on active states, plus the transition from one state to another. The logic prompts - in order to minimize the consumption of the processor, as long as possible, be in an idle state and switch from one to another as rarely as possible. You can achieve this by following two rules:
Do as fast as possible
- Using extended instruction sets (SSE, SSE2, AVX)
- Using parallelism
Do as little as possible
- Combining periodic tasks
- Reducing the frequency of tasks
If the first one is more or less clear, then I would like to explain the second point a little. The picture below vividly demonstrates what a combination of tasks (activities) can bring.

Tasks are performed during the transition to the active state, then the threads fall asleep and do not interfere with the transition of the processor to a more energy-efficient state.
The second subtask can be solved by switching to an event-dependent model. The working task does not check any conditions in the loop, but sleeps until any event puts it into an active state.
Bad example
while(1) { if(bDoSomething == TRUE) { DoSomething(); } Sleep(100); }
How to
while(1) { WaitForSingleObject(someEvent); DoSomething(); }
More details about energy efficiency and optimization can be found in this article -
habrahabr.ru/post/134559 .
Unreasonably high FPS
Increasing FPS in games is nothing more than an increase in the frequency of tasks performed - frequent screen updates result in the fact that the system is practically not idle and consumes the battery much faster. One optimization technique is limiting the number of FPS. The optimal value of FPS does not exist, it all depends on the genre of the game, here you need, so to speak, a personal approach. What can be achieved by limiting FPS can be seen in the pictures below. These results were obtained when analyzing the operation of the application using
Microsoft GPUView .
Before the limit

After

If the genre of your game allows (for example, not a 3D shooter) - try to experiment with FPS, the user may not notice the difference, and in return will receive a longer game time when the laptop is running on battery.
Mobility adaptation
When developing games aimed at work, including on mobile systems, it is also necessary to consider:
- Laptop may be unplugged
- During the game, a power scheme can be applied, implying worse performance in exchange for extending battery life
- The user can close the screen, or put the system into hibernation or sleep
The last point is particularly important. There are games and programs that ignore the transitions of the system from one state to another and as a result simply “freeze” or “fall” after the system has been put into sleep mode (the user has closed the lid of the laptop, or pressed the power button) and left it . Such behavior of programs can put an end to the game, especially if the player has already spent a lot of time on the game and after such a transition the game “fell out” without saving its current progress.
To track such power-related events, on Windows, you can track the WM_POWERBROADCAST event. You can also subscribe to change notifications by calling the RegisterPowerSettingNotification () function. After calling the function, the application will be aware of the events that occurred and will be able to process them correctly.
Everything's under control
In order to facilitate the acquisition of various information specific to mobile platforms, Intel offers free Intel Laptop Gaming TDK. Using a simple API, you can get information about:
- current power circuit
- battery condition
- wireless connection
- and much more...
More details about what Intel Laptop Gaming TDK offers can be found here:
Intel Laptop Gaming TDKHow can this be applied in games? Just imagine that the following elements appeared in the game interface.

The game (and not the system dialog box that unexpectedly collapses the game) notifies the player about the low battery charge and the estimated time that he can still spend in the game. In online games, the player will be able to see the current state and signal level of the wireless network in the game interface, he will not have to turn off the game to understand what happens to the connection, from which the delays appeared. Simply, visually, conveniently.
Conclusion
To make your game more mobile friendly:
- Test your games not only on the desktop, but also on mobile platforms
- Lay adaptation from the start
- Use tools to measure performance and energy efficiency.
- Consider battery life
- Do not forget about the specifics of mobility
That's all, I wish you good luck and creative success!