Android Question full screen sprite gaming animation

peacemaker

Expert
Licensed User
Longtime User
Hi, All

Who tried to make 2D-games :) please, suggest.
My fishing game uses the full screen sprites: rod with the line are made by the designer as single pictures, that require full screen :-(

And controlling the rod by swipes over the line - is hard task, as needs always reload the fullscreen sprites of rods - line cannot be separated for smaller pictures.
And it's rather slow and hunging process even on modern phones with 1GB RAM and fast processor.

Sprites are pre-loaded into Bitmap array at Activity start. But i guess much time is used for transparent drawing when i do
B4X:
pnl.SetBackgroundImage(Sprite(ix))
If to comment this loading line - all works fast, sure.

Question - if to preload these fullscreen sprites into panels and just makes one visible - will it be faster ?
Or the same speed issue, as panel must be shown and made transparent ?
 

sorex

Expert
Licensed User
Longtime User
What do you mean with that last sentence? That libGDX is the only way to go for any project that contains an image?


Wonder: it's also the way how you contruct things. if that is wrong from the start it's normal that you will have issues. and why does libGDX solve that issue? prolly because it caches it in the GPU to prevent reloads. (just guessing here tho :) )
 
Upvote 0

wonder

Expert
Licensed User
Longtime User
sorex said:
What do you mean with that last sentence? That libGDX is the only way to go for any project that contains an image?
I'm not sure if the question was aimed at me, but I'll answer it anyway:

It's not the only way to go, like you correctly pointed out, as long as the images are properly cached in the GPU, the performance should be optimal. All I'm saying it that GDX is a great tool to achieve that result. :)
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
I'm not sure if the question was aimed at me, but I'll answer it anyway:

It's not the only way to go, like you correctly pointed out, as long as the images are properly cached in the GPU, the performance should be optimal. All I'm saying it that GDX is a great tool to achieve that result. :)
libGDX has two main advantages over a Canvas based solution: it does not store the graphical resources in the Java memory space so you can use all the memory of the device if you want, and it is based directly on OpenGL, a graphical library that delivers the best performance on our devices. When you display 10 sprites at 60 fps with a Canvas based lib, you can display 300 of them with libGDX. You can do a lot of things with my Accelerated Surface lib, but for most games, libGDX will be far superior.
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
no, sorry. that was meant for Informatix but you post came inbetween ;)
My sentence was just meaning that when you need performance (e.g. your game is too slow with Accelerated Surface), you have no other choice than using libGDX. So the question of the library to choose has a clear answer according to the project needs.
And a thing is clear too: if you want to do a game, forget the Canvas class. It's the worst solution. I wrote a tutorial about that to explain why (in case someone didn't notice the horrible performance of this class).
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
in what way is the accelerated surface accelerated? is it also GPU based?
It is accelerated because it is based on OpenGL (but not directly) and benefits from the hardware acceleration (once enabled in the manifest). It uses the same draw event that is raised to draw your views in hardware acceleration mode, so it can be used to draw new views for example.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
The comparison post is not the "how to make a game" thread wonder indirectly pointed me to I guess?
 
Upvote 0

wonder

Expert
Licensed User
Longtime User
The comparison post is not the "how to make a game" thread wonder indirectly pointed me to I guess?

I'm sorry Sorex, but I couldn't really understand this last post of yours. o_O
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
I was refering to this

And a thing is clear too: if you want to do a game, forget the Canvas class. It's the worst solution. I wrote a tutorial about that to explain why (in case someone didn't notice the horrible performance of this class).
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
I was refering to this
The tutorial is "How to make games".
I see many people here trying to do games with the Canvas class and usually they post to say : I have a memory problem or I have a performance problem. It's not surprising. I wrote the tutorial, among other things, to give them more choices and explain the differences between the available libs. The Canvas class is pretty slow and cannot be accelerated. It has other drawbacks (e.g its limited set of functions) so it is not suitable for games (in fact, to speak frankly, I see no use for it at all).
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
ok, I guess I interpret it wrong. I thought/hoped it was more of a benchmarking report. :)
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
interesting...

if that chart is correct then most stuff in that test runs faster without hardware accelleration?
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
alright, my bad. I thought it were results based on hardware acc. setting on the same device.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Great discussion. I checked available gaming libs before, and decided that it is simpler to code all myself. But for games, finally, indeed better to use an engine.
 
Upvote 0
Top