Large sprites, tiled backgrounds, and performance

Discussion and feedback on Construct 2

Post » Tue Aug 07, 2012 3:32 pm

@superkew
Try to design your levels using modular parts that can be re-used and combined to construct the scene. By using instances instead of new objects the memory usage can be significantly reduced.

You can also upscale low detail images in the editor (like background gradients) to fill a big area without compromising memory usage or quality. The key is to find the balance between re-usability and variation.
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Post » Tue Aug 07, 2012 4:44 pm

Don't forget in hardware accelerated platforms (most desktop browsers, and CocoonJS/directCanvas on mobile), scale and rotation of objects can be rendered virtually the same speed as unrotated unscaled objects. This means you can use loads of scaling and rotation to keep the same few sprites looking interesting. It's one of the technique Braid and Aquaria also use to make a visually interesting level out of a handful of sprites.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Tue Aug 07, 2012 4:59 pm

Thanks for all the helpful feedback guys. I re-use a lot of assets with scale and rotation, but there are some things that I can't seem to really reduce.

I'll chat to the designer and see if she has some ideas.
B
22
S
7
G
3
Posts: 189
Reputation: 4,270

Post » Tue Aug 07, 2012 8:23 pm

Would it be possible, do you think, in future releases to have a tile compiler of some sort.

I've only just started using C2 so forgive me if this is already in there. But I do have a lot of experience of tile based systems from working on GBA games.

Currently C2 is good at large areas made out of repeating tiles. What it doesn't seem to be able to do is to cope with a level made out of a small tileset like the one in tiles.png in the Jungle Platformer example - which I think is 64*64 tiles. I could make a huge and very varied image out of that which could then be stored in memory as the tileset and a map referencing it. Do we have that? Could we have that? It is the best way to make 2D games of this sort.
B
11
S
4
G
3
Posts: 70
Reputation: 3,071

Post » Tue Aug 07, 2012 8:51 pm

Hm, I've been considering to make a plugin that would allow one to freely render a given texture. It'd work kinda like this:

- single texture / image
- you have full control over how you want to render it; fully, partially, whatever
- every tick, the plugin would collect instructions and then execute them in one go

So it could be used as a tileset, texture atlas, etc. Control animations, tiling and such yourself. However, those would be textures only, not objects like individual sprites. They won't have any UID, variables, properties, behaviors etc. They're just textures and it is up to you how you draw them.

I'm not sure if there'd be much performance boost, as Construct 2 already optimizes rendering routine. It would just be an alternative to sprites and tiled backgrounds, if all you need is a texture that you can abuse.

Would there be an interest?
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Tue Aug 07, 2012 9:56 pm

What I would be interested in knowing, is the performance cost of a sprite/tiledbackground that is doing absolutely nothing (aesthetic) versus an active sprite that is doing something?

I much prefer the concept of using a modular approach however if overhead (notorious in editors like C2) is added with each sprite, it makes me worry.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Tue Aug 07, 2012 10:09 pm

[QUOTE=sqiddster]What I would be interested in knowing, is the performance cost of a sprite/tiledbackground that is doing absolutely nothing (aesthetic) versus an active sprite that is doing something?[/QUOTE]
It depends on what it is doing. But if you mean controlling with events, that means it's running on the CPU. Most games are bottlenecked by rendering, so chances are those events finish before rendering anyway, meaning there's no impact to the framerate.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Tue Aug 07, 2012 10:56 pm

I'll just jump in here with a quick question.

Earlier i noticed that when inserting large sprites (directly from folder to the editor), no warning or anything appears.

But if i double click a sprite (animation editor etc), and import a new sprite there, a warning appears if the image is too large, and slicing them is advised. Does it really help to slice it up? As mentioned in this thread, slicing up a huge image does not help performance wise.
B
34
S
11
G
9
Posts: 189
Reputation: 8,595

Post » Wed Aug 08, 2012 12:24 am

the maximum size is 2048x2048 pixels, up to this, think in slicing it.
ImageImageImageImageImageImage
B
93
S
20
G
12
Posts: 1,212
Reputation: 18,482

Post » Wed Aug 08, 2012 2:27 am

The problem with doing 'modular parts' or using heaps of sprites to make areas is that it can push up the objectcount to thousands, and I think the objectcount impacts the performance quite a bit from my experience. So I think I'm going to do my levels with unique sprites with a size of 1000x1000 (and invisible solid objects for collisions).alspal2012-08-08 02:28:10
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 14 guests