O'Reilly logo

Building a 3D Game with LibGDX by Elmar van Rijnswou, Andreas Krühlmann, Sebastián Di Giuseppe

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Performance improvements on the enemy model

We now want to work a bit on performance. Though there's quite a lot of performance work we can do for our game, there's one big improvement we can do with the enemy model, and another small improvement that can be useful for bigger games, frustum culling.

Fire up EntityFactory: public class EntityFactory { private static Model playerModel, enemyModel; private static Texture playerTexture; private static ModelBuilder modelBuilder; private static ModelData enemyModelData; private static ModelComponent enemyModelComponent; ... public static Entity createEnemy(BulletSystem bulletSystem, float x, float y, float z) { Entity entity = new Entity(); ModelLoader<?> modelLoader = new G3dModelLoader(new JsonReader()); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required