Stencyl Games: CPU Resource Hog?

Abigayl

  • Posts: 807
Many of you know me for trying to minimize lag in my games. I have successfully pushed down the ms rendering to acceptable levels for my games, but a new issue has cropped up that I have learned has been there since the beginning :(. Stencyl games seem to be CPU hogs. I have tested this myself and have heard feedback from others that the CPU% can cause major issues for playing games. I've gotten reports of up to 90% CPU usage from my games (for my computer, it ranges from 30 to 50%, and I built a good computer).

Is there any way around this? Is 3.0 going to fix this issue? It's so disappointing to have done all my work in making Stencyl lagless only to have Stencyl ITSELF causing lags  :'(.

EDIT: Here's the start of the forum topic that started my awareness of this issue: http://www.kongregate.com/forums/4-game-programming/topics/284463-gitd-26-voting?page=2 (it continues on for a few pages)
If you need help, please check my tutorials either here or Kongregate (http://www.kongregate.com/accounts/Abigayl) or come over to my stream: http://www.livestream.com/poweredbyflowers

rob1221

  • *
  • Posts: 9419
There's supposed to be a non-Box2d option (universal rather than actor specific) in 3.0 to improve performance.  It's also possible that something besides Flixel will be used, but nothing regarding that has been announced yet.  Joe stated about a week ago that we will be happy with their technology choices though.

SWATLLAMA

  • Posts: 1059
On my computer, Invader Breaker takes up about 10% of CPU usage when I have an FPS and GIMP open.

Most of the people who complain probably have laptop processors. On my old computer, dual core running at 2.66ghz and not overclocked at the time used up about 30% on Invader Breaker after playing for a while. Not sure how else they'd be complaining. Maybe they don't let Flash store enough on their computer.

Quote
Is there any way around this? Is 3.0 going to fix this issue? It's so disappointing to have done all my work in making Stencyl lagless only to have Stencyl ITSELF causing lags  .

You mentioned somewhere that you wanted to get something like Sothink, right? Just open up the AS3 code there and try and do a little editing. :P Though you might have to learn some more AS3 before you can do that. Or you could just open it up in Flashdevelop after the decompiling and just recompile.
Hail The Llama
http://www.kongregate.com/accounts/lSWATLLAMA
"Play the games" ~ The Grand Llama

It's my life goal to rickroll as many people as possible

Joe

  • *
  • Posts: 2480
You should definitely see improvements with the non-Box2D option. Flash itself can be a bit of a resource hog, too, unfortunately.

There's supposed to be a non-Box2d option (universal rather than actor specific) in 3.0 to improve performance.

This sounds good, although would I be right in thinking we'd have to then create blocks that would apply gravity to an actor, for example?

My latest game does not use any physics other than gravity.

rob1221

  • *
  • Posts: 9419
Of course you'd have to create workarounds if you want to simulate things like gravity; that's the tradeoff for the performance gain.

Almakos

  • Posts: 632
Well,...if Abigayl has lag problems, then it is absolutely OK what's happening in my game )))
Seriously though, would be nice to get improved performance in 3.0...
Fishing Fantasy Trailer


Abigayl

  • Posts: 807
Thanks Joe.

Swat: Can you be a bit more specific about what I should look for?

BTW, Rob, implementing gravity is actually among the easiest things to spoof IMO. Just use an attribute for the y-speed and always increment it unless you against an object. I have used that trick many times. If someone needs me to show an example of it let me know.
If you need help, please check my tutorials either here or Kongregate (http://www.kongregate.com/accounts/Abigayl) or come over to my stream: http://www.livestream.com/poweredbyflowers

SWATLLAMA

  • Posts: 1059
On what do you want me to be more specific?
For a SWF decompiler, if that's what I"m thinking, you'd just want a program called Sothink SWF decompiler. You'd need to get the pro version though.
Hail The Llama
http://www.kongregate.com/accounts/lSWATLLAMA
"Play the games" ~ The Grand Llama

It's my life goal to rickroll as many people as possible

Abigayl

  • Posts: 807
Ah, thought you said to search out for a code called "sothink" :P.
If you need help, please check my tutorials either here or Kongregate (http://www.kongregate.com/accounts/Abigayl) or come over to my stream: http://www.livestream.com/poweredbyflowers

You should definitely see improvements with the non-Box2D option. Flash itself can be a bit of a resource hog, too, unfortunately.

Hi Joe,

If you use the non-Box2D option, what capabilities do you lose? For example, do tiles still produce collisions for say the ground? Do actor collisions still work? Or would you have to create behaviours for these things?

coleislazy

  • *
  • Posts: 2607
If you use the non-Box2D option, what capabilities do you lose? For example, do tiles still produce collisions for say the ground? Do actor collisions still work? Or would you have to create behaviours for these things?

Right now, collisions are reported and block movement as expected. You don't get any of the physics simulation, though, like gravity, friction, rotation, etc.

Thanks Cole,

That's perfect. This update is going to make a huge difference to a lot of games' performance.

Ah, thought you said to search out for a code called "sothink" :P.

Hey Abigayl. Sorry I can't help with your lag problem, although it sounds like 3.0 will take care of that for you. On another note... I thought your game, listed in the thread you linked to, was very innovative and a lot of fun to play. Good job.

Abigayl

  • Posts: 807
Thanks Tom, I'm glad you enjoyed it :)
If you need help, please check my tutorials either here or Kongregate (http://www.kongregate.com/accounts/Abigayl) or come over to my stream: http://www.livestream.com/poweredbyflowers