Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8340485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:11:26+00:00 2026-06-09T05:11:26+00:00

I am trying to get my game running smoothly on android using PlayN, everything

  • 0

I am trying to get my game running smoothly on android using PlayN, everything works as expected but I have a verry low framerate.
I think i might be doing it the wrong way so it’d be great if someone could give me some help :D.

So I’m currently creating an ImmediateLayer and cleaning it and drawing every objet at every frame, images are loaded once using graphics.getImage(…). I get around 10 fps on a HTC Desire (connected in debug mode) while drawing around 100 images. It gets slower as I add objetcs.
What makes me think I am doing something really wrong is that PlayN is spamming the log (I use DDMS to check the log) with these messages.

X Textures remaining

Y Textures created

It appears around 20 times per second.

So basically i am doing something like this:

public void draw(Surface s){
for (Drawable d : toDraw) {
        surface.drawImage(d.getImage(), d.x, d.y, d.w, d.h); }}

Where draw is called in the renderer of an immediateLayer.

thank you for your time!

Lucas

Edit:
I found a possible answer reading that thread on playn mailing list.
https://groups.google.com/forum/?fromgroups#!topic/playn/XJTlBgmfzaQ

especially that message

Most of the tiles share the same image, but different parts of it (atteined
by subImage, which to my knowledge doesn’t copy but rather only creates a
reference to a sub part to the image?). Would different sub parts cause a
texture change?

Sub-images will share the same texture, but you have to be sure to
render all the images that share the same texture together. If you
have a bunch of sub images from image A and a bunch from image B and
you render A, B, A, B, A, B, A, B, you are getting same performance as
if you rendered eight different images. You need to render A, A, A, A,
B, B, B, B.

It seems I am in a worst case scenario.

I have many different textures (say 50), They’re all part of a different image and all rendered randomly. I may end up with something close to N texture switch where N is the number of objet i render.

I’ll update this when i get something to work :).

Edit 2:

I am now rendering 100 objet pointing to the same Image (so no texture swap?). I still get about 10 fps on android and the debug log is still saying in each frame:

1 textures remain
2 textures created

I feel like i’m missing something important… help :).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T05:11:29+00:00Added an answer on June 9, 2026 at 5:11 am

    After some deeper testing I found that :

    1) The htc desire cannot be expected to get 60 fps drawing hundreds of objects even sharing the same image.

    2) imageLayer attached to a group layer seems to provide better performance on android

    3) Calling surface.clear() at the beginning of the renderer callback (using immediate layer) greatly improved the performance of the draw and removed the “textures created” debug log.

    4) Finally sorting the object by texture and reducing the number of texture swap (drawing A A A A B B B istead of A B A B A B) gave me better results.

    The app is now runnig at 30 fps on the desire and 60 fps on a galaxy S2 drawing around 500 object on screen.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a game engine in Android, but I don't have much
I have a game running on the iPad that I'm trying to get running
I'm trying to get background music going for my XNA game, but the options
Creating a simple RPG game, first time using XNA. Trying to get my character
I have a rather confusing problem in running our game. I am trying to
I'm trying to get the following Mongoid relationships to work, but the game field
I am an experienced programmer with C++/C# trying to get into the android game
I'm trying to create a game loop using this tutorial . I have tried
We have an idea for a game running under Android and I've been playing
I've been trying to get this Sudoku game working, and I am still failing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.