[Disscussion] Which is better for mobile games, PNG or SVG?
I want to make several 2D games for mobile platforms, mainly using Qt for iOS, Android, Symbian, MeeGo and whatever supported by Qt (WP7?).
I've made one game already using PNGs. (Card game : Dewan of kout )
I'm thinking of making a game similar to that one, and also another game similar to "battleheart":http://www.youtube.com/watch?v=0VqlJ_AvFS8
What do you think is the best option, PNG files or SVG files or other formats? Which is better for mobile games, PNG or SVG?
and BTW, I'm using QGraphicsView with bunch of QGraphicsPixmapItem
PNG is the way to go. You can use SVG internally to get good quality, but the resulting game should be using PNGs. Reason is quite simple: displaying (parsing and drawing) SVG files takes a lot more time (IIRC, time is a few orders of magnitude longer).
[quote author="sierdzio" date="1328868566"]PNG is the way to go. You can use SVG internally to get good quality, but the resulting game should be using PNGs. Reason is quite simple: displaying (parsing and drawing) SVG files takes a lot more time (IIRC, time is a few orders of magnitude longer).[/quote]
The thing is I liked the way how you can make Sprite sheets easliy in SVG
Also, the rumor about the new screen res of the iPad 3, am creating screen res independent games :)
I know, it would be nice and easy to go with SVG, but it seems that the choice is this:
- either go with PNG and go through pain of generating separate files for various resolutions
- or try SVG and suffer from performance loses (or, if the amount of SVG content is not too large, the battery might get hit even though performance would stay decent)
Anyway, you can try benchmarking both approaches to see what is the real difference. I've seen comparison somewhere, but can't seem to be able to find it now.
Ok, let's ask another question,
In both cases, I'm scaling my images!
In PNGs, I scale images to a percentage where it looks good on screen.
So I will do in SVGs
BTW, I'm searching the internet for SVG Files to do comparison
take any Linux icon pack, they're full of SVGs, and usually come with prerendered PNGs, too.
You can have images saved as SVG and when you start your game, you resize them to desired resolution and save them ( only to RAM) as png or bmp ( preferably to bmp for better performance) with which your work with.
Thank you that's a great idea
[quote author="Jake007" date="1328980764"]You can have images saved as SVG and when you start your game, you resize them to desired resolution and save them ( only to RAM) as png or bmp ( preferably to bmp for better performance) with which your work with. [/quote]
Anyways I have made a comparison if anyone want source code let me know.
Can anyone give me hints on how to resize the an svg and then convert it
I will appreciate a code snippet
You can multiply the size to any size you like for the SVG Item or set the size customly in the QPixmap constructor
@ QSvgRenderer renderer;
QGraphicsPixmapItem item = new QGraphicsPixmapItem(image);
I read this discussion, and I like the hybrid approach to load the .svg and convert them to pixmap and then render it.
Because, it is seems a very good approach for get a perfect balance between the resolution independence of .svg with the speed of drawing of a pixmap...
I'm wondering if the QML Image item use this approach when you set a .svg image as source ...
anyone know the performances of QML Image item on .svg images ??