Code Monkey home page Code Monkey logo

rubber's Introduction

Rubber

Wrapper for IGOR.exe, aka compile gamemaker projects via command line.

This tool is called from the command line, takes in a yyz/yyp and output a zip, installer, or just run the game. For now, this only runs on windows, compiling to windows. Alternativly there is an api that you can call from javascript. Running this program requires that you have a valid GameMaker Studio 2 installation and have purchased the selected module (you cannot compile to Windows if you only own HTML Exporting)

Maintained by: dave caruso

Notes

I would like some of these untested features to be confirmed to work or fail, so that it can be resolved.

  • Project using shaders might not work Works
  • Using steam is not tested
  • Running on mac not supported.
  • Using configurations not tested

Setup

You will need installed

  1. GameMaker Studio 2 Desktop (inside it's default install directory).
  2. Node.js with npm installed.

To install rubber globally, run npm i -g gamemaker-rubber, and you should be all good.

To use rubber as a dependency, you would use npm i gamemaker-rubber

Usage

rubber [options] path/to/project.yyp [output file]

Options

Option Actions
-Z, --zip Creates a zip archive
-I, --installer Creates a installer package
-y, --yyc Compiles with YYC
-v, --version Display the current version
-c, --config Sets the configuration
-h, --help Display help and usage details

Examples

  • rubber project_folder Launch the yyp file in %cd%/project_folder as if you pressed F5 in gamemaker
  • rubber . Launch the yyp file in the current folder as if you pressed F5 in gamemaker
  • rubber --yyc --zip . Compile the yyp file in the current folder to a zip file with yyc
  • rubber --yyc --zip project.yyp Compile %cd%/project.yyp in the current folder to a zip file with yyc
  • rubber --yyc -I project.yyp Compile %cd%/project.yyp in the current folder to an installer with yyc

Nodejs API Usage

To use Rubber as a dependency, install it to your project with npm i gamemaker-rubber, it includes type definitions.

Basic Compile

const build = rubber.windows({
    projectPath: "path/to/game.yyp",
    build: "run"
});
build.on("compileStatus", (data) => {
    process.stdout.write(data);
});
build.on("gameStatus", (data) => {
    process.stdout.write(data);
});
build.on("allFinished", () => {
    console.log("Compile Finished");
});

Rubber uses an asyncronous EventEmitter to give out status updates, so you can listen to certain events, but not others, and use it to stream the entire output of IGOR (the compiler) to somewhere like the standard output (shown above).

Events

compileStarted

Emitted when the compile process starts

compileFinished

Emitted when the compile process is finished, the game might be launched at this point. Sends an array of all errors in the compile process.

compileStatus

Emitted with a data paramater, containing a string of output data. When displaying this data do not manually add a newline (console.log does it)

gameStarted

Emitted when the game starts, not always emitted.

gameStatus

Emitted with a data paramater, containing a string of output data from the game process.

gameFinished

Emitted when the game closes, not always emitted.

allFinished

Emitted when everything is finished, always emitted at the end. Sends an array of all errors in the compile process, exactly the same array as from the compileFinished message.

rawStdout

Emitted with a data paramater, containing a chunk of raw output data from IGOR.

error

Emitted when some kind of error happens.

rubber's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rubber's Issues

Cannot compile game as a zip file

When I try rubber --zip . to compile game, it doesn't output any zip files but runs the game directly:

X:\WINDOWS\system32\cmd.exe DONE (0)
DoSteam
Igor complete.
[Run] Run game
Options: X:\Users\LiarOnce.DESKTOP-NRV42PI\AppData\Local\Temp\rubber-build-677\GMCache\MainOptions.json
X:\ProgramData/GameMakerStudio2/Cache/runtimes\runtime-2.1.5.246\windows\Runner.exe  -game "X:\Users\LiarOnce.DESKTOP-NRV42PI\AppData\Local\Temp\rubber-build-677\Output\SwordQuest-AirWorld-GM.win"
Attempting to set gamepadcount to 12
DirectX11: Using hardware device
Total memory used = 4548036(0x004565c4) bytes
Attempting to set gamepadcount to 0
---------------------------------------------------------------
minFPS, maxFPS, avgFPS
30, 30, 30
---------------------------------------------------------------
---------------------------------------------------------------
minFPS, maxFPS, avgFPS
30, 30, 30
---------------------------------------------------------------


X:\ProgramData/GameMakerStudio2/Cache/runtimes\runtime-2.1.5.246\windows\Runner.exe DONE (0)
Igor complete.
Compile Finished

SyntaxError: Unexpected token

I output this error when I am ready to test after installation.

$ rubber -v
X:\Users\LiarOnce.DESKTOP-NRV42PI\AppData\Roaming\npm\node_modules\gamemaker-rubber\out\rubber.js:20
    const asyncRun = async () => {
                           ^
SyntaxError: Unexpected token (
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:513:28)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (X:\Users\LiarOnce.DESKTOP-NRV42PI\AppData\Roaming\npm\node_modules\gamemaker-rubber\out\cli.js:8:16)
    at Module._compile (module.js:541:32)

Can it clear the cache?

If we do get iterative compiles, as per #6 , it would be really nice to also get the ability to do a fresh compile if we wanted. It would also be nice to just be able to clear the cache on its own.

Thanks Dave!

7 Files we need to create?

Hello!

Do we need to create all 7 files?

        * a. build.bff
        * b. macros.json
        * c. preferences.json
        * d. steam_options.yy (json)
        * e. targetoptions.json
        * f. MainOptions.json
        * g. PlatformOptions.json

In my experience, having 3 of them is enough to run Igor.exe for Android and PC:
* a. build.bff
* b. macros.json
* e. targetoptions.json

And these files will be generated automatically:
* f. MainOptions.json
* g. PlatformOptions.json
* c. preferences.json
* d. steam_options.yy (json)

Concurrent build support

Hi there

First off, I wanted to say that I LOVE this tool. It was the last missing piece to start adding cicd to my games and it's been super easy to use

We're planning to release our game to multiple platforms. I have every commit triggering the build server, and the server is building all platforms in parallel (for now I'm just testing for Windows + Linux, but there will be more later)

I get the following error when doing this

System.IO.IOException: The process cannot access the file 'C:\Users\Administrator\AppData\Local\Temp\2\gamemaker-rubber\107df35d-7b57-421b-a352-a1911c2eb0a4\GMCache\PlatformOptions.json' because it is being used by another process.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)

   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)

   at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)

   at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)

   at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost)

   at GMAssetCompiler.GMOptions.WriteToJson(String pathname, GMAssets _assets)

   at GMAssetCompiler.Program.�(String[] �)

So it looks like rubber only supports 1 build at a time? I was wondering how hard it would be to fix this? If you point me in the right direction I could also try making a pull request

Cannot install 2.4.0

npm install [email protected] works just fine, but npm install [email protected] (or leaving off the version) results in an error that prevents install. The error looks like this:

npm ERR! path {project_dir}/node_modules/gamemaker-rubber/out/cli.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '{project_dir}/node_modules/gamemaker-rubber/out/cli.js'
npm ERR! enoent This is related to npm not being able to find a file.

Where {project_dir} is the absolute path to my project.

I went through a git diff of those two versions, but couldn't find anything that would explain it. I don't use typescript in my day-to-day though.

getting a list of errors

i noticed that igor outputs "Error: (error description)", which the ide places into a Compile errors section. this should exist on the .on("error") but doing that could trip out some other systems, maybe a .on("compileError"), or emitting a on("error") at the end with an array.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.