The Best Way To Handle A Game With Multiple Animated Objects!


(Zouhair Elamrani Abou Elassad) #1

Hi guys, First of all i want to thank you for all the help you’ve been giving me so far.

I’ve been working on this game for a while now, it’s a flappy bird like game, but with more graphics and obstacles, i’m supposed to put the game platform before the starting of the game, and the player moves and at the same time the camera is following him, all the way to the end.

I have to add like more than 500 entities to my world, i already created them, most of the entities have spritemaps as their graphics, so i decided to use pixelmask and calling the render method so can the mask change with the spritemap.

I also used the Greensock library in some entities, cuz i needed the tween movement, and i’m using a few parallaxes for the background as well.

I was think about a way to put all the entities in my world, so i put all the coordinates in a script and i read the script when the world starts, so when the user starts the game, all the entities are in the world, updating and waiting for the player to come.

I thought about removing the entities when the player overpass the object and it’s no longer in the screen.

I’m waiting for more permissions so i can show you guys the game so far, but i need and advice about handling memory , entities, my game … i’ve been reading the documentation frequently, but i can use to help of the experts.


(Darrin) #2

I thought we answered part of this question here. 500 is a lot for on screen. Most games only have 20-100. I don’t think we have enough information. I’m also not sure why you would need Greensock for tween movement as Flashpunk handles movement quite well. Anyway more specific code questions would help.


(Zachary Lewis) #3

Can any of the 500 sprites be converted to particles? You should definitely recycle unused entities, like coins or enemies that the player has already passed and won’t ever interact with again.

Awhile back, I made Tappy Plane. Tappy Plane is a recreation of Flappy Bird designed to showcase just how little is needed to make an endless runner game. Many features of FlashPunk are used in this game, including:

  • Entity recycling
  • Animated sprites
  • Repeating backdrops
  • Collision detection
  • Input handling
  • Graphic lists
  • Mask lists

Maybe you could examine this source to see some ways to optimize performance in your game and reduce those numbers!


(Zouhair Elamrani Abou Elassad) #4

Actually that’s what i already did, i’ve seen the way you handled every features and that helped me a lot thank you, i don’t know how to use recycle in my case because all the elements are in the stage before game start, and once a player overpass an object i remove it from my world, i decided to split the script to a few parts so i can add only a few entities on the stage, and the others later, also i’ve been noticing that even when my stage has only a few elements, when the camera moves there is a shaking effect on them, if you could see chat possibly can be wrong that would be great, i’ve already posted the issue :

Shaking Objects

Once again thank you so much.


(Zouhair Elamrani Abou Elassad) #5

I see what you mean, i decided to split the script to a few parts so i can add only a few entities on the stage, and the others later, and that’s exactly what i’m doing, i have two choices, either the player is fixed and everything comes to him, or the camera follows the player, i decided that the camera follows the player might be a better idea cuz i have like more the 500 entities