# How to make clone creation faster

Context, I guess…
So ever since I started to make the scenarios of my (unreleased) games with clones, I’ve always struggled to make clone creation faster.
The best I could do was to add each block with stuff like width and position to different

``````When object is cloned
``````

Blocks.

The main part
So as mentioned earlier I struggle with accelerating clone creation and I would like to know a way to make it faster. So if you know any way, PLEASE tell me as it would be very useful.

How it would help me
So I need a reason for people to help me (xD). Well I’ll use it in pretty much any game as I prefer using clones than using separate objects to build scenarios.

Here is an ugly blue brick I made in 3 minutes

5 Likes

to clone faster, do (@/ThinBuffalo showed me this, it’s a good method):

``````when game starts {
set self(numberOfClones) to ___ // total clones you want
ABILITY clone {
if self(total clones) <= originalObject(numberOfClones) {
create a clone of this object
ABILITY clone
}
}
}

when object is cloned {
ABILITY clone
// clone index code next
}
``````
7 Likes

It accelerated the process but it’s creating extra clones

Edit: nvm it worked

2 Likes

I also have a way, I do:

When self total clones < (number of clones you want +1)
Create a clone

2 Likes

this is the fastest way in Hopscotch to create clones (i think), @GalaxyBoi

@Cutelittlekittycat a little modification:

``````When (Total Clones <= “Number of Clones you want to create”)
Create a Clone of This Object
End
``````

you won’t need +1 if you use <=

5 Likes

Both methods shown double the number of clones each frame. So both create clones exponentially (2^n clones in n frames) so the they’re equivalent from that point of view.

The method with a recursive ability has several advantages

• allowing synchronized initialization after the clones are created
• assuming both options utilize a When Game Starts and a When Cloned to initialize the clones, the objects don’t have to evaluate the When <= after the cloning is done (more efficient)
• clones can be destroyed (if/when desired for optimization). Whereas the When <= method would automatically recreate clones if they’re destroyed

Does that make the use of the recursive ability better? Not necessarily. The above points may not matter for many projects. So sometimes simpler is better or even just a personal preference.

1 Like

If you use AE’s blocks, you can add a block called Clone Object Times, which will clone a certain number of objects all in one frame (not recommended though).

1 Like

I used that block to create like 3000 clones and it was lagging very badly.

Although the create a clone times is very useful in my opinion

1 Like

I use the method NTh3R uses too

3 Likes

This topic was automatically closed after 17 hours. New replies are no longer allowed.