• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Graphics Vector Graphics for GMS 2

N

NickCikovic

Guest
Hello. I’m making a video game that’s near completion in terms of programming. It’s a 2D side scroller. My grandma is a graphic designer and says she’ll make the graphics for free. The thing is, she would prefer the game have Vectors instead of the more conventional Pixel graphics. She’s starting them as Pixel but is then converting them to Vector.

I can see why she wants it to be this way. Vectors look nicer when expanded than Pixel and even reduce the memory size (or so I heard) The only problem? I’m not quite sure how to properly export the graphics to GMS 2. I heard something about SWF, which is Flash, but I’m just not sure if it’s still the only way to allow Vectors into the software or if the latest version has other file types to use. Any help on how to get Vectors into GMS 2 would be greatly appreciated. Thank you.
 

Posho

Member
GameMaker: Studio 1+ has the capability to import SWF animations into the game, which are basically Adobe Animate/Flash movies. Since they are using vector graphics instead of raster graphics, they are much more lightweight on the file size department and are arguably faster when it comes to heavy animations.

You can import the SWF file as you normally would import any other sprite into GameMaker and you can use them right away.

You can further improve the quality of the sprite by adjusting the SWF precision on the sprite's properties and by using the Anti-Aliasing functions:
draw_enable_swf_aa(true);
draw_set_swf_aa_level(1);

And you would get results like these:




That being said, in my own experience, SWF sprites are not the way to go in GameMaker.
  • Curvatures are not handled very well (compare the "Anti-Aliasing Enabled" dog with the "PNG Sequence" one, it is very jagged on the curves).
  • You won't be able to do a lot of fancy things with the native GML sprite functions, other than just positioning, scaling, rotating, etc.
  • Compiler will want to parse every SWF sprite in the project EVERY time you run the game, which is really infuriating (at least in GM:S1, apparently GM:S2 solved this).
  • Transparency is handled weirdly.
  • Can't import them using sprite_add(), so you'd have to rely on an extension if you ever want to import SWF sprites through code.

I'm not saying SWF doesn't have its uses in GameMaker, but even though I've been a Flash guy all my life, I think PNG is the way to go. Even if you use big PNG sprite sequences, the file size will go down when joined into the texture maps. And being able to have better looking images and being able to use GML's sprite functions to the fullest is a better trade off... unless all you're going for is efficiency.

As far as I know Animate/Flash is the only one in the Adobe family that can export to SWF, so there's that to consider. It would be neat if GameMaker was able to import SVG files, they seem far more common in the graphics industry than SWF, but I don't know.

Hope this helps! :)
 
N

NickCikovic

Guest
GameMaker: Studio 1+ has the capability to import SWF animations into the game, which are basically Adobe Animate/Flash movies. Since they are using vector graphics instead of raster graphics, they are much more lightweight on the file size department and are arguably faster when it comes to heavy animations.

You can import the SWF file as you normally would import any other sprite into GameMaker and you can use them right away.

You can further improve the quality of the sprite by adjusting the SWF precision on the sprite's properties and by using the Anti-Aliasing functions:
draw_enable_swf_aa(true);
draw_set_swf_aa_level(1);

And you would get results like these:




That being said, in my own experience, SWF sprites are not the way to go in GameMaker.
  • Curvatures are not handled very well (compare the "Anti-Aliasing Enabled" dog with the "PNG Sequence" one, it is very jagged on the curves).
  • You won't be able to do a lot of fancy things with the native GML sprite functions, other than just positioning, scaling, rotating, etc.
  • Compiler will want to parse every SWF sprite in the project EVERY time you run the game, which is really infuriating (at least in GM:S1, apparently GM:S2 solved this).
  • Transparency is handled weirdly.
  • Can't import them using sprite_add(), so you'd have to rely on an extension if you ever want to import SWF sprites through code.

I'm not saying SWF doesn't have its uses in GameMaker, but even though I've been a Flash guy all my life, I think PNG is the way to go. Even if you use big PNG sprite sequences, the file size will go down when joined into the texture maps. And being able to have better looking images and being able to use GML's sprite functions to the fullest is a better trade off... unless all you're going for is efficiency.

As far as I know Animate/Flash is the only one in the Adobe family that can export to SWF, so there's that to consider. It would be neat if GameMaker was able to import SVG files, they seem far more common in the graphics industry than SWF, but I don't know.

Hope this helps! :)
Well here’s the thing. My grandma wants to go the extra step and apply the Illustrator designs to 3D models in Blender. That’s something I forgot to mention. Is there any real good way to export those as Vectors (sorry, I must sound really stupid right now.)
 

Posho

Member
Well here’s the thing. My grandma wants to go the extra step and apply the Illustrator designs to 3D models in Blender. That’s something I forgot to mention. Is there any real good way to export those as Vectors (sorry, I must sound really stupid right now.)
Don't worry. I'm not exactly sure what it means to import a 2D Adobe Illustrator design into a 3D editing tool like Blender. Don't know what you could achieve with that.

However, if you want to start using 3D models into GameMaker, you need to start reading into what projections, vertex matrices and buffers are, and learn how to read a 3D object's file and transform its data into vertices and whatnot. You can't just import models into a scene like you would in a 3D-oriented engine like Unity. So be aware of that.
 
N

NickCikovic

Guest
Don't worry. I'm not exactly sure what it means to import a 2D Adobe Illustrator design into a 3D editing tool like Blender. Don't know what you could achieve with that.

However, if you want to start using 3D models into GameMaker, you need to start reading into what projections, vertex matrices and buffers are, and learn how to read a 3D object's file and transform its data into vertices and whatnot. You can't just import models into a scene like you would in a 3D-oriented engine like Unity. So be aware of that.
Okay, it seems I have to bite the bullet and settle with Pixel then. Thanks for trying to help. But it just seems Vectors aren’t that practical in GMS 2 yet due to the only supported format being SWF. Again, thanks for clarifying that stuff.
 

Posho

Member
Hey, I know this thread is done, but I wanted to correct myself in case anyone finds it. The dimensions of the dogs I was showing above were of 550x400, so I experimented using bigger images and was surprised with the results:
Runner_2020-09-07_13-14-48.png

Turns out that when you use larger SWF files the image ends up looking much better than PNGs of the same size, specially when re-scaled. They don't look jagged like in my previous post. Also found out that the larger scaled-down SFW sprite looks almost identical to the non-scaled 550x400 PNG while still having a much smaller file size (2.94 KB vs. 14.8 KB).

Also, just to confirm, in GM:S2 the SWF sprites aren't parsed on every compile (unless you clean the target). I still need to figure out how much the performance differs between SWF and PNG but so far SWF files are much better-looking for GameMaker than PNGs.
 
I started a project once with the intention of using swf vector files for some parts of the project. I found the implementation to be kind of lacking and there were some weird results. Can't remember exactly what was going on off the top of my head (it was a few years ago now) but I did end up simply importing high resolution pngs when I needed variable sizing and scaling them down for my purposes. Luckily, the concept only involved a few images needing to be scaled to various degrees, so I could get away with the texture swaps required for the larger resolution images. Was it due to my inexperience with GMS' handling of swf's? Could I have found implementations that worked? I'm not sure, the answer is probably yes to both, but I will say that if you are used to handling "normal" images within GMS, moving over to vector images can be a PITA.
 

Posho

Member
I will say that if you are used to handling "normal" images within GMS, moving over to vector images can be a PITA.
I know that feel. I remember being in a game jam and using SWF sprites all the way through and then I got to a part where the game was supposed to adjust the image's vertices and I hit a roadblock, so I had to spend an hour of the event re-exporting, re-importing and re-adjusting images to PNGs. Not much fun.
Also had a project where I wanted to have 3D models but with SWF textures, in the end I had made up a whole system that would transform SWF's into textures using surfaces, and as you can probably tell, it wasn't efficient at all.
I think the whole takeaway of all this is that you should only use SWF sprites in GameMaker if you really know what you're doing or if you only want to do normal stuff like positioning, scaling, rotation, blending, etc.
1593570473907.jpg
 
Top