[Solved] Memory Issue with Obscenely Large Actor

Voswyn

  • Posts: 28
I have a very large actor (896 x 864) that has a 60 frame animation. Obviously this causes some issues with the engine's memory. I have inserted some scripts in the installation directory to improve the memory but this has only gotten me so far. I have tried to use different scales as I am importing the frames but this greatly affects size and collisions in the scene. I have also tried to go without every other frame in the animation but I still run into issues with the memory. I have been able to successfully save it but attempting to edit the actor immediately uses all of the memory.
If you have any suggestions, ideas, or solutions, any help is much appreciated!

« Last Edit: September 05, 2016, 02:19:05 pm by Voswyn »

JeffreyDriver

  • Posts: 2262
Why do you need such a large actor? Can you not achieve the same results in a different way? Can you post it here?

Voswyn

  • Posts: 28
What I am trying to make is a wooden tower (which is the large actor) that will fall when the player touches it, thus creating a bridge across a chasm. The animation is the tower falling down and a script changes its collisions to a bridge when that animation is finished. Originally I had made it physics-based but this was very unreliable and degraded the framerate to a nearly unplayable level. The player would also fall through the fallen tower into the chasm below.
Attached I have some pictures to help you visualize. Thanks again!

jexadox

  • Posts: 35
I'm not sure how to do it, but i know there are ways to edit and change the images and backgrounds instead of using actors. i found my own way how having too many or too large actors *really* eats up memory. I hope that points you in a new way to expiriment?

try starting here:
 http://www.stencyl.com/help/view/image-api
http://www.stencyl.com/help/viewArticle/52

Voswyn

  • Posts: 28
It doesn't seem like this image drawing idea would have any collisions...? I will look into it more when I get the chance.

DeckBlack

  • Posts: 159
Need to do it using physics and joints. If fps = 60 no matter how much it eats memory.
http://community.stencyl.com/index.php/topic,31947.0.html
And if you have a low framerate then you are certainly doing something wrong. Maybe you have somewhere a memory leak or poorly optimized code. If anything throw here your example with low framerates. Without  example to point you at your mistakes, is difficult.

p.s. can try to use standard joints in the scene (left menu).

« Last Edit: September 04, 2016, 02:31:22 pm by DeckBlack »

Voswyn

  • Posts: 28
Would you include collisions with tiles? I don't want the tower to appear as though it's falling through the ground but all of the collisions with the tiles is what (I think) kills the framerate so much.

DeckBlack

  • Posts: 159
Collision with tiles is almost not affect framrate.

You remove actors from the scene when they are outside of the screen? Even a small number of actors (50 pieces), can severely degrade performance.

JeffreyDriver

  • Posts: 2262
Couldn't you use tweening to fake the physics effect of it falling? Also, this would do away with the use of joints.

How complicated is your collision shape? That can also affect things.

Voswyn

  • Posts: 28
My collision shape consists of two long boxes that outline the lighter vertical supports (as can be seen in the pictures above).
The tweening idea seems like it could work. My only concern is if the tower can still be securely anchored. I don't want it to be able to move after it has fallen as the player is running acrossed it between the supports.

jexadox

  • Posts: 35
can you use regions for collisions?

JeffreyDriver

  • Posts: 2262
If you set it to 'cannot be pushed' that should solve your problem.

Voswyn

  • Posts: 28
Thanks for all of your help and ideas everyone!
The tweening idea is working out pretty well:
https://www.youtube.com/watch?v=vZvR1wfxK5U&feature=youtu.be
I was able to make a behavior that turns and moves the tower to make it look like it's falling over. It's not 100% polished yet but it's definitely getting there.