|
Post by andymc on May 6, 2016 8:59:26 GMT 1
MY main game loop right now which runs for every frame of the game, is around 500 lines of code, there's plenty of loops in there to look through game objects too, but the game still runs very smooth without any hiccups, so I've not done any optimization yet. I expect the final game loop to be around 2000 lines of code, with a few more loops for additional game objects.
What's your main game loop size right now? And have you hit any performance problems yet? I'm using B4A with Libgdx and finding it blazing fast.
|
|
|
Post by ilan on May 6, 2016 11:02:10 GMT 1
i think the code size is not the main factor. more important is how many loops you have inside your code and what size of lists (arrays) are those loops using. if you will use big lists (like 2k items in it) you will start see performance problems.
|
|
|
Post by wonder on May 9, 2016 11:35:01 GMT 1
Here's mine:
#Region Main Cycle Sub MainCycle As Boolean 'DesignerMode DesignerModeControl 'Prepare cache variables for function results Dim inMap As Boolean 'Player - The following operations order must be kept: 'Control, Physics, Collisions, Update inMap = isInMap(player.actor, True) PlayerControl PlayerWorldInteraction(inMap) AnimationControlMainCharacter ApplyPhysicsToTheMainCharacter(inMap) PlayerCollisionDetector(inMap) ContentUpdate(player.actor) 'Objects - The following operations order must be kept: 'Control, Physics, Collisions, Update For Each obj As GameObject In ObjectList For Each actor As Actor In obj.actor If actor.active Then inMap = isInMap(actor, True) ObjectControl(obj, actor) ApplyPhysicsToObject(obj, actor, inMap) ObjectCollisionDetector(obj, actor, inMap) ContentUpdate(actor) End If Next Next
'Characters - The following operations order must be kept: 'Control, Physics, Collisions, Update For Each character As GameCharacter In CharacterList For Each actor As Actor In character.actor If actor.active Then inMap = isInMap(actor, True) ApplyCharacterAI(actor) AnimationControl(actor) ApplyPhysicsToCharacter(character, actor, inMap) CharacterCollisionDetector(character, actor, inMap) ContentUpdate(actor) End If Next Next 'Destructables ApplyPhysicsToDestructables
'Camera CameraUpdate(player.actor) Return True End Sub #End Region
|
|