Android Tutorial My LibGDX / Game Creation advice

Creating your own games can be a lot of fun, but it's important to get things right from the beginning.

Here's what I've learned the hard way:
  • Use an Asset Manager, it's a bliss compared to initializing and disposing everything manually!
  • Hardcode for performance, use variables and a scene loader for flexibility. Ex: AM.Load("player.png") vs. AM.Load(playerTexture).
  • Multiple LGScreens will keep everything tidy and it will help you manage the memory more efficiently.
  • Avoid at all costs using a CallSubUI() in the Render event.
  • Prefer the LibGDX sound engine instead to the default Audio lib.
  • Writing your own collision detection/solver will bring you down to your knees. Unless you're a masochist like me, use Box2D.
  • Maximum texture size: 2048x2048. No, 4096x1024 doesn't work.
  • Less than 60 FPS (engine) nowadays isn't acceptable.
  • Less than 24 FPS (sprite animation) isn't acceptable.
Last, but not least:
  • Coding the AI is the funnest part!
  • Play games! Play your favorite games! Play Mario, Sonic and Megaman. Play Street Fighter and Mortal Kombat. Play Warcraft and Command & Conquer. Play Civilization and SimCity. Play Tetris, Angry Birds and Candy Crush. Try to understand what makes a game fun to play and gives the player a pure sense of joy, take notes if necessary.
  • Read, re-read and read again Informatix's Games Tutorial. It's one of the best pieces of advice, not only on this forum, but on the entire web!
 
Last edited:

Informatix

Expert
Licensed User
Longtime User
Using CallSubUI in a Render event does not hurt. You can use it to warn the player with a message box for example. Using it every frame is a bit strange and not excellent for performance (I can't see a reason to run something in the main thread every frame).
 

wonder

Expert
Licensed User
Longtime User
Testing your game:

1. Even if you have a high-end tablet or phone, you should ALWAYS try your game in the lowest-end device you have access to.
In my case I use my old, battery damaged Sony Xperia P (2012) to see if I can still achieve those sweet 60fps.

2. Just because it runs well on your device it doesn't mean it will run the same way in every device.
You should always test it on a lot of different devices, screen sizes and android versions.
As an example, here's where I've been testing my projects:
B4X:
System               Hardware           Screen
---------------------------------------------------------

Andy Emulator        Dual-core PC       1280x1024
Windows 7  32bit     2GB RAM            4:3 aspect ratio

Chrome ARC Welder    Dual-core PC       1280x1024
Windows 7  32bit     2GB RAM            4:3 aspect ratio

Andy Emulator        Core i7 PC         1920x1080 Full-HD
Windows 10 64bit     8GB RAM            16:9 aspect ratio

Chrome ARC Welder    Core i7 PC         1920x1080 Full-HD
Windows 10 64bit     8GB RAM            16:9 aspect ratio

---------------------------------------------------------

Android 2.3          HTC Wildfire       480x320
Gingerbread          512 MB RAM         3:2 aspect ratio

Android 4.3          Sony Xperia P      1920x1080 FullHD
Jelly-Bean           + HDMI Out         16:9 aspect ratio

Android 4.3          ASUS ME173X        1280x720
Jelly-Bean           Tablet             16:9 aspect ratio

Android 4.4          Nvidia Shield      1920x1080 FullHD
Kit-Kat              Tablet             16:9 aspect ratio

---------------------------------------------------------
 
Last edited:
Top