Construct 3 idea- support vector graphics (SVG)

Discussion and feedback on Construct 2

Post » Mon Jul 13, 2015 12:44 am

I could see using vector art for graphics that need to look good on large screens as well as small screens, such as maps. They get rendered to the screen with no expectation of movement after rendering.
B
29
S
16
G
23
Posts: 68
Reputation: 13,723

Post » Mon Jul 13, 2015 5:57 pm

There are a few problems with SVG support in C2:
- as people have mentioned, it can seriously degrade performance. Textured sprites are super fast to draw. Normal sprites are always a box with 4 vertices. A single SVG object could involve hundreds of vertices, having an equivalent performance impact as hundreds of sprites.
- there are not currently any good libraries for drawing SVG in WebGL, the main renderer for C2 games. Even browsers themselves have patchy support for rendering all the many features of SVG in web pages. Writing such a library when none exists is a significant project, and it's hard to justify it when it could take a great deal of work and end up slowing down games.

I think it's possible to render SVGs at a fixed size and then just use them as a WebGL texture, but this could still be slow when scaling objects gradually (every size change requires re-rendering the SVG then uploading a new WebGL texture to the GPU), and it would still use lots of memory (the same as if you just used a normal texture in the first place). I'm not sure that really has any benefits.
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762

Post » Mon Jul 13, 2015 9:27 pm

Ashley wrote:I think it's possible to render SVGs at a fixed size and then just use them as a WebGL texture, but this could still be slow when scaling objects gradually (every size change requires re-rendering the SVG then uploading a new WebGL texture to the GPU), and it would still use lots of memory (the same as if you just used a normal texture in the first place). I'm not sure that really has any benefits.

when thinking about using vector graphics i came to a related idea. One could use svg graphics in the project and when the exported game is loading (or after or before?) a "preloader/svg-to-pngexporter" checks for the resolution of the device where the game is loading and exports the svg's to png's accordingly to this resolution (or multiplied by some factor that you specify in the editor) then it clears storage and loads the game with these png's. Only happens at loading of the game (or before, etc.), not when the window size is changed. That way you could be sure to always have "crisp" graphics, no matter how big the resolution is and wouldnt waste memory on small resolutions. Only loading time should be affected. Does that make sense?
B
38
S
11
G
5
Posts: 485
Reputation: 5,340

Post » Mon Jul 13, 2015 9:34 pm

The engine doesn't know ahead of time what kind of scaling or zooming will be used. If they are only ever used small, it will waste memory preloading images which are too large, and if they are always scaled up a lot, they will still appear pixellated. Also any kind of image processing on startup could make the loading take far longer.
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762

Post » Mon Jul 13, 2015 9:41 pm

yeah i see desktop is a problem but it would still be a super cool feature for mobile export where you have tons of different resolutions and i think 99.9% of games exported for mobile run in fullscreen so you could just take the overall resolution as reference.
B
38
S
11
G
5
Posts: 485
Reputation: 5,340

Post » Tue Jul 14, 2015 12:07 am

Direct manipulation in realtime? Not really practical at this point, IMHO.

Got to say though, having the ability to load an svg and bake it into a sprite would be freaking awesome just for the space savings on certain kinds of graphics (eg., complex gradients). Also for creating 'generative' sprites and textures.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Tue Jul 14, 2015 1:01 am

Imagine interpolating splines in real time.
Kinda blows the wheels off multi object animations, and even sprite deformations.
Image ImageImage
B
169
S
50
G
169
Posts: 8,286
Reputation: 108,216

Post » Tue Jul 14, 2015 10:35 pm

If you want to use SVG, use inkscape to convert SVG to PNG at a middleish resolution. There is a problem, I think, with some phones especially with limited GPU memory. Some other tools get round this by having multiple resolutions of graphics and loading one which is the best fit post scaling to fit the browser space.

It would probably be better to have realtime 3D rendering of a model without any animation or skeleton work or similar - so just render it from a particular viewpoint. WebGL is designed to do this pretty much.
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: unicornspitfire, winsonzhong and 4 guests