[Request] Canvas snapshot whole layout

Discussion and feedback on Construct 2

Post » Mon Dec 24, 2012 7:04 pm

Was just playing with the canvas snapshot, and found that it only grabs the viewport.
The request would be to grab the whole layout.
You could, for example create a mask of a bunch of tiles, then delete those tiles, and then load the snapshot into a sprite via load by url.
It would be quite useful if say you had hundreds of tiles that eat up fps.
Image ImageImage
B
164
S
49
G
140
Posts: 7,972
Reputation: 92,910

Post » Mon Dec 24, 2012 7:26 pm

You already can do that with the canvas plugin. Grabbing the whole layout could be a problem if someone with a large layout tried it.

There's a chance the reason fps are getting eaten up is more to do with collision detection than rendering anyway, unless you're talking about mobile, in which case it could be both.
Moderator
B
91
S
32
G
33
Posts: 3,005
Reputation: 27,552

Post » Mon Dec 24, 2012 8:56 pm

Perhaps if we had the option to get the layout, or just the viewport...?
As you can imagine a layout of just 1024x1024 with 16X16 tiles would get you thousands of objects. Even without collision detection that is guaranteed to go slow.
Creating a mask, and destroying the tiles that are for visual purposes solves all of those woes.


Im actually using Rojo's canvas now, however a large canvas kills performance when in webgl.
Image ImageImage
B
164
S
49
G
140
Posts: 7,972
Reputation: 92,910

Post » Mon Dec 24, 2012 9:12 pm

Well, you could stitch a larger snapshot of smaller viewport snapshots, just reposition the viewport each time. But for what you're trying to do, wouldn't it be better to put those tiles in a family, then plot a dot/smaller object onto canvas for each object in the family?
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Mon Dec 24, 2012 9:16 pm

Since that would functionally destroy tiles, wouldn't some sort of portal rendering to disable/enable collisions or destroy/load tiles be better? I specifically remember asking this question (but for CC) and everyone shot down the idea because VRAM usage would skyrocket..among other things I can't recall right now.
Image
B
234
S
27
G
13
Posts: 1,784
Reputation: 18,274

Post » Tue Dec 25, 2012 3:17 am

@Mipey
I don't think stitching portions together would be fast enough, so timing would be an issue, especially since you have to move the camera, and then take the snapshot. It needs to happen at start of layout, plus you wouldn't want anything else like an animation to get into the picture.
Not sure what you mean about plot a dot. I need to preserve the texture.

@Tokinsom

Yeah, I don't think "portal" rendering would work well either. Generating hundreds of tiles when ever the view point changed would bog down the system.
Image ImageImage
B
164
S
49
G
140
Posts: 7,972
Reputation: 92,910

Post » Tue Dec 25, 2012 4:25 pm

If your willing to make your game be spastic for a frame, you can resize your viewport to the layout size, take a snapshot, and put it back. This is probably your fastest method, but could be onoying the the user.
Good luck!
B
7
S
2
G
1
Posts: 44
Reputation: 1,415

Post » Tue Dec 25, 2012 5:15 pm

Yes that does work, but like you said, it would be a bit annoying.

I have found a method where I paste into the Canvas plug, and then get the url from it and load that into a sprite.
Then destroy the Canvas, and frame rates go back up.
Image ImageImage
B
164
S
49
G
140
Posts: 7,972
Reputation: 92,910


Return to Construct 2 General

Who is online

Users browsing this forum: celstrider and 7 guests