Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have found that Stencyl doesn't seem to be very good at handling very many actors in a game. I had been trying to implement some basic AI at the moment all the behaviours were: wander (pick a random point and move directly to it) and wrap around screen (if it goes off the top of the screen it appears at the bottom). Even with these simple behaviours and calculations the frame rate dropped dramatically when there were more then 50 actors on screen:

10 actors: 60fps

50 actors: 30-50fps

75 actors: ~30fps

100 actors: 15-20fps

200 actors: 8-10fps

I had planned on having a maximum of around 200 actors but I see that's no longer an option and implementing a more complicated AI system with flocking behaviour, looking at creating a game in a similar vein to flOw.

I understand that a game is perfectly playable at 30fps but this is a super simple test with ultra simple graphics, no animations and no sounds is child's play in terms of calculations to be made.

Is this a limitation with Stencyl or is it flash? Should I simply scale the scope of the game down or is there a better game engine that exports to .swf that I should look into?

share|improve this question
add comment

1 Answer 1

I crunched the numbers you posted to see where the bottleneck is. To do this I converted FPS to frame time (the time in milliseconds that it takes to render one frame) then I divided the frame time by the number of actors drawn.

Actors  Time per actor
10      0.001666667
50      0.0005
75      0.000444444
100     0.0005
200     0.0005

It turns out that it doesn't matter if you're drawing 50 or 200 actors, each actor takes roughly 0.0005 seconds to render so there isn't a hardware/software bottleneck that you're running in to, apparently the way you (or stencyl) draws/updates actors at this moment takes that amount of time. So the only option you have is making drawing of actors more efficient. Either by trying to optimize your code, use tricks that Stencyl provides (unfortunately I don't know anything about Stencyl) or by using a more efficient framework.

(note that the 'time per actor' for 10 actors is much higher, probably because the game is limited at 60fps)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.