Bug: Animations lag

Discussions about game War of Colors. Support. Features requests. Proposals.
Post Reply
User avatar
demoix
Posts: 39
Joined: 06 May 2015, 19:15
Location: Lithuania
Contact:

Bug: Animations lag

Post by demoix »

I really have no idea why when animations turned on game got high lag and every more take like 1-2 second, when with animations off move goes instantly. My phone is Samsung galaxy s5 and no games laging at all, but in this way yes
sva
Администратор
Posts: 125
Joined: 01 May 2015, 19:56

Re: Bug: Animations lag

Post by sva »

I know about it. That's why added option for animation on/off. Now I'm trying to find solution of animation lag...
PLAYER_CHAR
Posts: 35
Joined: 19 Mar 2016, 11:32

Re: Bug: Animations lag

Post by PLAYER_CHAR »

In my opinion, that happens because the game redraws numbers every tick and uses text font for this. It will be less laggy if the game render the text into a temporary canvas for the first time and then redraw this canvas to game screen. When the particle effect disappears, you can destroy this canvas.

(Я так думаю, это происходит по той причине, что игра каждый раз отрисовывает цифры и использует при этом шрифт. Когда шрифт огромный, рендерить его долго (вроде как там проверяется для каждого пикселя, закрашивать его или нет), поэтому и лагает. Вместо этого лучше отрисовать на временное изображение сам текст, а потом рисовать уже это изображение на экран. Когда эффект исчезает, можно удалить изображение из памяти. Как вариант, если продолжает тормозить, то можно рисовать среднего размера шрифт на среднего размера изображение, а потом рисовать это изображение, растягивая его до нужного размера)
sva
Администратор
Posts: 125
Joined: 01 May 2015, 19:56

Re: Bug: Animations lag

Post by sva »

Thanks for advice. I'm using SurfaceView object for drawing game situation. And unfortunately it has not instruments for displaying such kind animations as this. I think that using frameworks like libGDX will solve animation problem. :)
Post Reply