1. Hey! Guest! The 32nd GMC Jam will take place between Feb 22nd, 12:00 UTC (Friday noon) and Feb 25th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

How does GM compile and create a .exe out of a project?

Discussion in 'Programming' started by ZombieSquirrel, Feb 10, 2019.

  1. ZombieSquirrel

    ZombieSquirrel Member

    Joined:
    Oct 18, 2018
    Posts:
    13
    Hi everyone,
    I'm asking this because well, I'm kind of amazed. I've been making graphics for 3500+ hours now (actually longer, but this is just for 1 2D top down RPG style, basically as much as I could think of) and for the past week I've been importing and importing, and then even more importing and importing. There's quite a lot of assets in my project, and I've decided to make a full character creation menu, just to test my coding skills as a starter. It.... works great, I'm kind of amazed. Yet for the character alone, there's quite A LOT of sprites in the project.

    To give an idea, there are sprites for each of the following: 4 skin colors, 2 eye types, 4 facial hair types, 10 head hair types, 19 shirts, 14 pants, 9 shoes, 9 hats…. And all of that times 2 because I made it 2 genders. Oh and all of that times 20 because that's how many "actions" (or animations) the character can have.

    It 's not skeletal animated, it's all done with pixel art in sprite sheets, carefully placing for example a shirt at the exact position for EACH player animation type. Carefully drawing each frame so it looks good animated. You can imagine the possibilities. Also: tons of actual exterior world tilesets, some of them 1024x1024 in size (still some empty squares spaces, but for a 16x16 based tile sprite game...). Not even to mention the enemies, items, buildings,....
    The amount of files is way over my head, but i loved every second of it while drawing it all. It took a lot out of me.

    Soooooo...

    Making a backup of the GM project, including a ton of these files already, actually takes around 8 minutes, even though the total size is about 30 mb max. It has to copy literally thousands of small files to my external harddrive for a backup. (A single file character animation tilesheet is split up in separate sprites in the engine, not in the file itself; so in GM 1 large file can become like 20 or 40 easily).


    I got a bit worried that I was "doing it wrong", because of the amount of files and the time for backing it all up. Yet, when I export the project as an executable… It installs immediately, and the map in which the "game" is installed only contains a few files. When running it, it runs great, no lag or slowdown. I'm just baffled. I'm really new to programming, not at all new to drawing as I've been doing that for quite a while now, but still :p


    So out of curiosity: how does GM does this? Does it compile and export all those sprites (remember: thousands) into something much more compact? Does it put everything into that single "optimized" .exe? Just a "kind of" detailed explanation is enough, I don't need a full college level lecture, but I'd still like to know the basics of how it's done.

    I really want to know because in the long run, if i ever actually finish making a game, exporting and compiling is something I'd like to think about, but if GM handles it so smoothly… Yeah I might not have to worry :D



    Sorry for the long post, I'm just really curious as to how the engine handles a very large amounts of small files when exporting it into an executable. I was almost sure there would be problems. Yet: buttersmooth, 60 fps no sweat. Installing? Few seconds. What? :D
     
  2. obscene

    obscene Member

    Joined:
    Jun 21, 2016
    Posts:
    2,294
    Long story short, GM makes texture pages with all of your sprites crammed onto it.

    Example from Google:
    [​IMG]

    The smaller your sprites and the bigger the texture page size you allow (2048x2048 is the default) the fewer pages it will require. GM only has to store the location of your sprites on the pages and draw that part when you need it.

    I know you said it was running smoothly, but you still might want to learn about texture page management and how to reduce the number of "texture swaps" when drawing as you can probably improve performance even further by making sure images that are drawn together are on the same pages.
     
    ZombieSquirrel likes this.
  3. ZombieSquirrel

    ZombieSquirrel Member

    Joined:
    Oct 18, 2018
    Posts:
    13
    holy hell that's amazing! And thanks for the reply.
    And yeah, i'm just starting out, so sprite management is something I will learn. (I kind of have to).
    Still, as a "beginning test" (been coding for 2 months now, learning from scratch, GM is the first engine i really want to try) I'm kind of amazed at what GM can do for simple sprite based games even when the sprites themselves are a huuuuuge chunk of what's actually "in the game".

    So just to have some more info: can you change the texture page size to more, so it becomes easier for the game to handle it? Or is there a "sweet spot", like 1024x1024, or 2048x2048,...
     
  4. obscene

    obscene Member

    Joined:
    Jun 21, 2016
    Posts:
    2,294
    Depends on what platform you are developing for. I don't do mobile but I understand it's smaller. I did 4096x4096 for my game because after I broke up my texture groups the way I wanted them that was the smallest they would fit on. However GM will make smaller pages than your specified size for groups that might be smaller, so it's always optimal.

    Although you might think graphics are the major part of your project, typically it's audio that takes up more file size and requires more management. There are audio group functions you will come across eventually that allow you to load/unload them as needed to manage memory. Graphics probably won't bloat your project very much, though they can have a much bigger performance impact if you don't keep your swaps down.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice