Design Creating an executable from within a gamemaker game/project

Discussion in 'Game Design, Development And Publishing' started by fishfern, Sep 17, 2019.

  1. fishfern

    fishfern Member

    Joined:
    Sep 17, 2019
    Posts:
    10
    Hi Everyone!

    I'm new here, so I'm not entirely sure if this is the ideal place to pose this query (I was tossing up between posting this query here or on the programming forum), however I was wondering if it was possible to create a gamemaker game/project that had the ability to create a .exe file (or other form of executable) when it was running?

    I found this thread, which made me hopeful, however I don't have the slightest clue how I would actually go about doing it.

    My general concept was to have a project that functioned a little like a glorified level editor, however had the ability to export the player/users creation to a standalone project/executable. The exported project's functionality would be exactly the same as the original game/program, however it wouldn't contain the ability to edit the level at all.

    I'm basically looking for a way to create a super simple game maker within a gamemaker project, I guess!

    Anyway, nice to meet you all, I hope you have a great day!

    Kind regards,
    fishfern.
     
  2. YellowAfterlife

    YellowAfterlife ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    2,404
    In a simple case scenario your game shall make a copy of itself (look into >=2.2.3 non-sandboxed mode, or non-sandboxed extensions on marketplace) with extra file(s) for user-defined assets, and show those instead of a level editor if it detects them on startup.
     
    fishfern and Yal like this.
  3. fishfern

    fishfern Member

    Joined:
    Sep 17, 2019
    Posts:
    10
    Oh sweet! Thanks for the reply! I looked into the non-sandboxed extensions, and they seem super helpful! I'll certainly be picking yours up! (Slightly cheeky question here, which marketplace suits you better/gives you the best kickback?)

    Just to clarify, do you mean to say it would be something as simple as using 'file_copy_ns()' where the source .exe was the 'old path' used in the first argument?

    As for the extra files, would there be any theoretical way of compiling them within a .exe in some form to make the output more neatly portable? This is more of a theory check, because I know plenty of projects are held as a compressed/'zipped' file, but I wondered if there was a way of keeping everything as neat as possible.

    EDIT: I should have specified I'm working within GM:S1.4 for now, so extensions are my way to go, it seems.

    Thanks so much for your help so far!
     
  4. curato

    curato Member

    Joined:
    Jun 30, 2016
    Posts:
    414
    It would be a lot easier to store the level data in a data file that is separate from the exe.
     
    fishfern likes this.
  5. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,525
    If you just want to be able to have a "game" and a "level editor" mode in your game, you could have a single exe and build the level editor portion of the game in a seperate room, meaning it would still have easy access to all the resources (graphics, sounds objects) for the players to use when building levels.

    Then create a shortcut of your main exe called "editor" which has commandline parameters set (ie. -editor) and have code in your game which reads these at startup using parameter_string and if found then go to the "editor mode" room allowing level editing, and if not then you'd go to the regular game room as normal which would contain no editor functionality.

    Essentially you have a single exe which contains both the game and the editor, and load one or the other depending on if the exe is run with the -editor parameter or not.
     
    fishfern likes this.
  6. fishfern

    fishfern Member

    Joined:
    Sep 17, 2019
    Posts:
    10
    Ah okay, that makes sense. I guess distributing a .zip or similar isn't a massive drawback, and it would also include scope for READMEs and licenses and so on, thanks for the advice!


    This is a good point! I'd have to look into setting parameters with regards to shortcuts and such, but that sounds like a potentially viable choice!


    As a final query (somewhat related) is it possible to change/edit lines of code on run time? For example, could I create a script to 'comment out' certain lines of code when a project is running? If so, would there be any benefit to doing this over using some kind of Boolean check?

    Thanks for your help everyone, I really appreciate it!
     
  7. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,525
    Just export your game as normal, then make a shortcut manually, set the the parameters and distribute it in your final game package along with the actual exe.

    However there is nothing wrong with it being a menu option in the game called "Editor" which the player could choose along with "New Game", "Load Game" etc on the main menu, and personally I would prefer this method as it removes the requirement of having to quit the game and load another program, then quit that and go back to the game etc.

    You can't make code comment itself itself no, you control execution of code using logic checks to decide whether certain parts of your code are executed or not at a certain time.
     
    fishfern likes this.
  8. fishfern

    fishfern Member

    Joined:
    Sep 17, 2019
    Posts:
    10
    Ah thanks! I figured logic checks would be the way to go, but though I would double check!

    You have a good point about including the editor as an option, I was originally aiming for portability and 'lean' distribution, but if external files are a simpler way to go full stop, there's no real reason why I couldn't include a more complete 'suite' with a player and editor in one.

    Thanks so much for your help everyone! I feel like I have a better grasp of things now, it's surprisingly a great deal simpler/more intuitive than I thought (for now). Have a great day!

    Kind regards,
    Fishfern.
     

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