[Optimization] Overriding or сreating objects

Get help using Construct 2

Post » Fri Jan 23, 2015 11:45 pm

Hi. I would like to hear advice from you ... There are infinite levels, which are generated by objects in the environment. Will the game run faster if you create objects in advance and simply change their position, and not to create each time new and delete old ones? After creating objects also takes performance and change the position of old objects correctly?

P.S. Sorry for my english ...
B
4
G
1
Posts: 11
Reputation: 447

Post » Sat Jan 24, 2015 12:28 am

Creating/destoying objects gives you better performance. Could you rephrase your last question.

Cheers
Sophia
Current Mission: improve design skills
B
8
S
1
Posts: 57
Reputation: 1,003

Post » Sat Jan 24, 2015 12:29 am

marsep wrote:Hi. I would like to hear advice from you ... There are infinite levels, which are generated by objects in the environment. Will the game run faster if you create objects in advance and simply change their position, and not to create each time new and delete old ones? After creating objects also takes performance and change the position of old objects correctly?

P.S. Sorry for my english ...


When you load a layout with all the objects already, the performance is better than creating in a runtime. I think you only need to have them outside the layout and, on start of layout, destroy it if necessary. So, in your case, I'd keep all objects at the moment of layouts loading and then let the events do the rest.

See:
https://www.scirra.com/manual/134/performance-tips
Not placing all used objects in the layout
If objects are not placed in a layout but are created by events, Construct 2 will load the textures for those objects the moment you create them. This can cause a momentary pause or "jank" and make the game feel less responsive. This can be avoided by placing any used objects in the layout. They can be placed off-screen and destroyed on startup to avoid interfering with the gameplay. Then Construct 2 will preload all their textures when the layout starts, avoiding any "jank" as they are created and destroyed at runtime.
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Sat Jan 24, 2015 12:30 pm

kossglobal, thanks!
B
4
G
1
Posts: 11
Reputation: 447

Post » Sat Jan 24, 2015 2:20 pm

@marsep If you have your objects just off screen on the first level ( be careful not to place all in your game if you have a big game ) Construct 2 will load these ( even if you right away destroy them ( on start of layout: Destroy ) ) so the next time you use the create object command and use one of those objects its already loaded it so the slow down will be minimal. It does however mean that it loads them all in as the level starts so maybe have a fade in screen or a slight load screen when the level first begins to give it time before they start playing.

Regards
Joel
B
7
Posts: 61
Reputation: 417


Return to How do I....?

Who is online

Users browsing this forum: Hardty, SputnikCZ and 1 guest