Custom Clone Efficiency Test

I’ve made a sort of custom cloning system and for me at least it works much better at mass cloning than the regular clone. I’d like your help to test both of these and reply with how well it work so that I can know if it might be something that I should work some more on.

Slower one (for me) also this is the built in clone function
CustomObjCloneTest(MoreLag).wick (149.3 KB)
Faster one (for me) this is my custom one
CustomObjCloneTest(LessLag).wick (149.3 KB)

It uses some fps code from Fps test (lag into account) to get the fps

For testing this maybe reply with about the number of clones by the time it reaches about 15 fps and also maybe the fps it started with

If your wanting to use this right now it uses Paper.js for the positioning and stuff (I mean it does really only change the position)

How it works

In short, the fast one works by using a single clip to store each image or single path object. When it clones the object it breaks the clip apart because clips can start to cause lots of lag with a lot of them. Then it randomly positions each object.
The slow one does all the same stuff except it doesn’t break apart the clips

2 Likes

I’ll be looking at this later… I have a related issue that this workaround could solve it…

When I tested them both to 1,000 clones this were my results

Fast one (custom)
Duration of frame: 740ms
Fps: 10
Clones: 1002

Slow one (built in)
Duration of frame: 150865
Fps: 4
Clones: 1003

Also, I do have to note that after stopping the slow project at the 1000ish clones it took a few minutes for the page to unfreeze

1 Like

could you try to clone a clip that has a subclip?

The use case is:
clone it from a frame or layer, not from the object itself, then at the same frame of cloning try to access the subclip… example:

newClone = clip2Clone.clone();
newClone.subClipName.x = 5;
newClone.subClipName.y = 5;

I haven’t tested this in a while, but I think that the subClipName goes undefined at that frame… My workaround was to wait a frame after cloning so I can access the subClipName.

I’ll try but it kind of gets rid of the point of using less clips

Although I was thinking making it so that it could work with multiple images/paths and then it just gets the offsets and acts like a clip, just without being a clip. I also got a way to have images swap their image with code which could be used for animations

I tried to do it but it gave me an error saying that it couldn’t set the properties of undefined

Although there might be another way to do it

Oh, but having clips inside clips has a good benefit, specially in games where you need to set a collisions (as subclips) in certain areas of the parentClip, so you could use something like:

bullet.hits(boss.weekArea)

I want to fix that one… It drove me crazy in some of my previous game devs… (I’m currently playing with the sound capabilities, but after that, I’ll work on that one…). (or you find a way to fix it first) :)

I mean yes they would be good in that kind of situation but that is why I was thinking of making it so that it could have multiple images/paths and then you could hit test certain pieces

Although I’d have to look into Paper.js hit test since there wouldn’t be any clips

That could work as well. Wee need to see how user friendly the solution is but yes. That is good.

Cause there is a lot of useful things that Paper.js uses that if wick used could make some really interesting stuff

Like color tweening http://paperjs.org/reference/path/#tween-from-to-options

Oh, yes. Since this Editor is built on top of paper, we could bring almost anything from it.

I did something similar here…
When you play it for a while it would change the background color… (I think you helped me with providing the code to change it, I just added the tween programmatically…)

I think this game work in 1.19.4.(test version) only because is using the subclip collision pattern that I wrote in the post above… 1.19.3 doesn’t have that capability.

HotAirFlashy10-11-2021_18-14-54.wick (1.1 MB)

At this point I’m just working on sort of custom making things in wick so that I have more functionality provided by paper

At some point I might also make a bit of a simplified reference for people who don’t know a lot about paper so that people can use/understand some things that paper can do… until they possibly get added into the actual editor

1 Like

Here are my results:

Slower one (first file)

Faster one (second file)

I tested it on a chromebook, & the FPS difference between the two files is well significant :+1:

1 Like

Also when I tested it with only a single image it had a fps of 27 at around 500 copies compared to when I did it with only a single path object which had a framerate of around 9 with about 500 copies… so it definitely works much better with images.

Cause the test that I put the download for was technically just randomly putting down either 1 of two images or a path object