Recycle problem in 1.3

1MrPaul1

  • *
  • Posts: 1285
I have 2 blocks. One - create recycled actor, second recycle it after some delay. Problem. Each recycle increase number of actors created by "create recycled" block. I mean, first time, created one actor, but in second cycle, "create recycled" block create two same actors in the same place, than 3 than 4 etc... And when I changing recycle block on kill self block, created only one actor as I want. So problem in recycling.  I like to use recycled actors, it makes game faster, but now it's impossible. In SW 1.1. everything was fine with it.

Ceric

  • *
  • Posts: 610
I just tried this out with 1.3 and it worked fine for me. How are you creating the actors? Are they being created automatically, or are they like bullets and the player fires them?

I'm wondering whether there is something else going on here other than a change to recycled actors (mainly because there hasn't been any change to recycled actors in a while).

1MrPaul1

  • *
  • Posts: 1285
Here is behavior. May be I do something wrong. But why this behavior works well in 1.1 and do not working 1.3...

Ceric

  • *
  • Posts: 610
Hmm...still looking this over. Have you tried playing with the timing for recycling at all?


« Last Edit: December 09, 2011, 10:16:58 pm by Ceric »

1MrPaul1

  • *
  • Posts: 1285
Yes. I tried different values, but always the same result. I know my behavior is little long but in fact it's very simple, and I do not see where mistake can be. And last check was replacing recycle block on kill block. When actor killed everything works as it must work. And i use this behavior several days in 1.1 and do not saw any mistakes.

Ceric

  • *
  • Posts: 610
Are there any behaviors attached to your actors?

Edit: As far as I know recycling actors hasn't changed, but there have been some changes to how timed tasks (do after, do every, etc.) are handled.

« Last Edit: December 09, 2011, 10:40:42 pm by Ceric »

1MrPaul1

  • *
  • Posts: 1285
this behavior allows to create 3 different types of actors in 13 different positions on scene. So, now i make just tests and use two type of objects in 3 places. two objects of the first type and one object of second type. If object of first type was recycled in first position, even if in second cycle it created in the next position it's already in two copies, but if in the second cycle creating object of the second type, it is in one copy as it must be but after this second object will be recycled, in next time it will be created also in several copies. So, it was two different objects of different groups and with absolutly different behaviors, and do not contain any kill or recycle blocks. And print states show that all actions works as it must and in necessary time.

Ceric

  • *
  • Posts: 610
If I had to guess, I would say there is a problem with the boolean "not on screen" that you're setting. I just created a behavior that creates a recycled actor every 5 seconds, sets it to an attribute called "Actor to Recycle" and then recycles it 2 seconds later. It works without any problems. The actor appears and gets recycled. I don't end up with multiple recycled actors on screen anywhere. It can't be the recycling blocks by themselves that are causing the problems, otherwise I would have ended up with multiple actors on screen.

Technically you don't need to have separate logic for an actor that's created off screen. Just give each actor a behavior with the "make self always simulate" block and then use the timer to recycle each actor normally (in the "do after 7 seconds" wrapper block).


 

1MrPaul1

  • *
  • Posts: 1285
I removed those boolean, also tried to recycle actors by means of separate behavior but still have the same problem. So, i just will use kill block instead of recycle, anyway this behavior helps me easy to place on the scene as many actors as i want and use just 1-3 fps. Early, when i just placed in scene designer even 5 actors of this type it cuts 20 fps, so, even with kill block this behavior is very usefull.
Thank you Ceric for your help. I will use this information when next time will make behaviors with recycled actors.

Ceric

  • *
  • Posts: 610
Glad I was able to help a little at least.

I'll keep testing the recycling blocks to see if I can reproduce the issue you were experiencing.

coleislazy

  • *
  • Posts: 2607
FYI, I am getting the same issue.

I have a behavior which creates a bunch of recycled actors in a grid to represent movement range. After the move, they are recycled. The next time it creates them, it creates many of them for each "create" call. I only noticed this because they have a low alpha value, and many of them stacking makes them brighter. I had to switch them to regular actors, but I can repro it and send it to someone if they need to see it.

JamesGames

  • Posts: 15
I noticed the same thing with alphas stacking up, my fps went from about 45 to a solid 60 when I switched out all the recycled actors with standard ones. There were also a few issues with collisions involving recycled actors that went away when using standard actors. I thought that was fairly odd.

On a semi-related note, is there an obvious reason that anyone knows of which would explain why a game that runs with no errors/warnings at 60fps eventually (after about 3-4 hours) begins to degrade until the fps hits 20 and eventually freezes up completely?


Aasimar

  • *
  • Posts: 605
FYI, I am getting the same issue.

I have a behavior which creates a bunch of recycled actors in a grid to represent movement range. After the move, they are recycled. The next time it creates them, it creates many of them for each "create" call. I only noticed this because they have a low alpha value, and many of them stacking makes them brighter. I had to switch them to regular actors, but I can repro it and send it to someone if they need to see it.

I have experienced the same problem, with Alpha but the performances of my game weren't affected, maybe because I not recycle a big number of actors.

Jon

  • *
  • Posts: 17533
I noticed the same thing with alphas stacking up, my fps went from about 45 to a solid 60 when I switched out all the recycled actors with standard ones. There were also a few issues with collisions involving recycled actors that went away when using standard actors. I thought that was fairly odd.

On a semi-related note, is there an obvious reason that anyone knows of which would explain why a game that runs with no errors/warnings at 60fps eventually (after about 3-4 hours) begins to degrade until the fps hits 20 and eventually freezes up completely?



There's a bug in the current version where a common operation was leaking memory over time and would cause performance to erode. This has been fixed for the next version and can be found in the nightly builds.