Giter Site home page Giter Site logo

bscotch / stitch Goto Github PK

View Code? Open in Web Editor NEW
102.0 6.0 11.0 7.85 MB

Tools and apps for GameMaker development: a CLI for pipeline development, a VSCode extension for coding, and more.

License: Other

JavaScript 3.08% Game Maker Language 4.13% TypeScript 90.08% HTML 0.76% Svelte 1.79% Rust 0.07% GLSL 0.03% CSS 0.07%
gms2 gamemaker game-development game-development-workflow gamedev gamemaker-studio-2 gamemaker-studio sprites audio

stitch's People

Contributors

acedward avatar adam-coster avatar agentender avatar christopherwk210 avatar liaronce avatar rendadongdong avatar shichen85 avatar

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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

stitch's Issues

Cannot import l10n if the l10n file is in the root directory of the project's included files

const directoryRelative = `datafiles/${paths.asPosixPath(subdirectory||'NEW')}`;

When there is no subdirectory, directoryRelative is set to datafiles/NEW, but there might be a file at datafiles. This will trigger the error because matchingFile.directoryRelative != directoryRelative, which effectively causes any file at the root level of the project's included files to always trigger conflicts.

I think we should just stop checking the subdirectory mismatch and overwrite the destination file. The change will show up in the git history anyways so the end-user can discern whether this is a mistake that requires renaming or that it is fine.

Add local config that importers can refer to for correct contents.

While the Stitch CLI provides lots of options to fine-tune exactly what gets imported from a project, this always has to be done at the CLI level. Even the simplest imports require a pretty verbose command, so it is not easy to use. Also, project authors have no way of indicating which subset of the project should be imported.

Some sort of config file could be used on both the imported and importing projects to control the parameters in a stable, simpler way. That way an import command without options could default to the config file.

The first step of this would be a config file that a project author can specify to make it easier for that project to be imported into other projects.

Something like:

# @file stitch-import.yml

project:
  name: My Rad Project
  path: relative/path/to/project/folder
  options:
    # The non-default CLI options that would allow for proper import of this project...

Then the Stitch importer would be updated to allow for CLI args to be absent if such a file exists.

Documentation for addObject is unclear

I'm currently trying to use addObject to add an object. I'm not sure exactly how to format said object, though. Sprites, sounds etc are fairly self-explanatory, but objects are trickier. The current documentation just uses "your/object/name".
Important Facts

  • The function is currently successfully creating a folder inside the asset browser called NEW, but it appears empty in the IDE.
  • The function is also successfully creating an empty folder with the desired object name and a .yy file inside said folder, but it lacks the .gml files
  • I attempted to add my own .gml files to the object folder and then run the function in the hopes this would trigger the object to be visible in the asset folder. This did not work.
  • I assume I need to somehow communicate to the function that the GML files are meant to be attached to the object but I am unsure how to do this and the Intellisense documentation is not clear to me on this front.
  • I am currently attempting to reverse engineer it via the class definitions and trial-and-error but I am new to TypeScript and would greatly appreciate the help!

Current code:

import { StitchProject } from '@bscotch/stitch';

const projectPath = '../';
const myProject = await StitchProject.load({projectPath});

await myProject.addObject('oThree')

Provide parameter hints

In VSCode, Ctrl+Shift+Space is supposed to provide parameter hints within a function parameter list, but this isn't happening with Stitch.

`runtime_feeds.json` does not exist

Error: Files does not exists: c:/ProgramData/GameMakerStudio2/runtime_feeds.json after clicking on "Open in GameMaker"

This may have something to do with the case where a user has never installed a stable GameMaker version, so that the assumption that that file exists is no longer true. It could be due to something else though, so this will require some investigation.

Replace the janky GML parser with a good one

The current GML parser used by the VSCode extension can only handle globals. It isn't smart enough to fully parse a project, and can't do any advanced things like scope analysis.

For full Intellisense support we really need scope analysis, so we also need a new parser.

The MVP needs to include at least the functionality we currently have.

MVP Features

  • Generate concrete syntax tree from GML
  • Track all project global declarations
    • macros
    • enums
    • globalvars
    • script-functions
    • assets
  • Track all project global references
    • macros
    • enums
    • globalvars
    • script-functions
    • built-ins
    • asset IDs
  • Global function signatures
  • 🆕 Track all localvar declarations
  • 🆕 Track all localvar references
  • 🆕 Track all enum member references
  • Watch files for changes (e.g. for catching external changes)
  • Force a virtual file-change (e.g. for current, unsaved edits)
  • 🆕 Fault-tolerant parsing
  • Re-parse a single file on change
  • List all symbol locations and types in a given file (for semantic highlighting)
    • 🆕 vars
    • built-in functions
    • built-in constants
    • 🆕 enum members
  • For a given file and position, list all in-scope (for autocomplete)
    • 🆕 vars
    • globals
    • 🆕 enum members
    • built-ins
  • For a given file and position, get the symbol at that position if there is one (for hovers etc)
  • 🆕 Create diagnostics based on parser errors
  • 🆕 Create diagnostics based on unknown variables

Add link to GitHub Issues

Stitch Desktop should have an easy mechanism to go from the app to GitHub Issues, in a way that collects environment info (app version in particular).

Allow comma-separated patterns for folder filters when merging

It's more likely that someone will want to list a set of folders, than that they'd want to provide a regex, when filtering on merge.

For example, if a user wanted to import two modules, "TestSuite" and "MyRadModule", they'd currently have to use:

stitch merge --if-folder-matches "(TestSuite|MyRadModule)"

Since most people are not very familiar with regex, it would make more sense to have it not behave has a regex pattern by default, and to also allow comma-separated values. For example:

stitch merge --if-folder-matches TestSuite,MyRadModule

If the user wants to use a regex, we can either:

  • Switch modes when a non-varname character appears (e.g. if []()$^*+ appear in the filter string).
  • Have a separate option flag for regex-based matching.

Deleting a project breaks the UI

Removing a project puts the app into a state where it is unable to set any remaining project as the current one.

No errors are shown, and rebooting the app doesn't help.

Temporary workaround:

  1. Open Stitch Desktop
  2. Go to Settings (bottom left)
  3. Click the configuration file link at the top
  4. Manually edit the JSON file to change the current project from null to an existing id from one of the projects
  5. Restart Stitch Desktop

Save last selection of GameMaker Releases

As a developer that's mostly interested in "stable" GameMaker releases during active development, I would like my previous selection of release types to be saved.

When going to the GameMaker Releases page, lts, stable, and beta are all selected every time.

GameMaker runner in VSCode

The Stitch extension can currently run a project via VSCode "tasks", but this is a pretty janky and cumbersome process. It should be overhauled to work really well.

  • Implement a command for running the current project
    • Have it infer the correct runtime based on the IDE
    • Have it use a config setting to determine which config to use
    • Have it use a config setting to determine YYC vs VM
    • Have it dump the output into a terminal
  • Make available via the command pallete
  • Make available via a button in the sidebar
  • Make hotkey-able

Add GLSL features to Stitch for VSCode

The shader-editing experience in the GameMaker IDE is... MEDIUM.

GameMaker recommends using GLSL ES for shaders, since that has the broadest support (particularly on mobile). Unfortunately, GLSL does not seem to have a lot of options for decently-featured editors.

The best VSCode extension I could find is one for WebGL, but it of course doesn't know about the GameMaker built-ins.

Given the relative simplicity of the GLSL language, and the fact that GLSL shaders can only consist of two files (the vertex and fragment shaders), it wouldn't be too large of a project to write a GLSL ES language server and use that in Stitch for VSCode.

Notes and refs:

README samples use legacy synchronous API

As far as I can tell, the sample code in the documentation is all for the pre-async versions, but in the latest releases (>10.0), everything has been changed to be async, so the sample code no longer works. Any chance of getting an update?

Improve syntax highlighting

There is still too much load when using Stitch for VSCode due to limited color differentiation. This is a context problem -- we can't use the grammar file to e.g. highlight sprite identifiers because we can't use a regex to unambiguously identify them.

The current GML parser is very limited, but it does locate most global identifiers. We can therefore use it for semantic syntax highlighting via the extension logic to improve things significantly.

Initially we can (and should) have semantic highlighting of the following:

  • macro identifiers
  • globalvars
  • global (script) functions
  • global enums
  • asset identifiers

Object inspector

In VSCode we lose too much information about objects due to only thinking of things as code.

One solution to this that is consistent with the GameMaker IDE is to add an "Inspector" widget to the sidebar. The first draft of this could simply be a TreeView listing:

  • Parent object
  • Children objects
  • Associated Sprite
  • Events

GameMaker cache-cleaning in VSCode

To minimize switching between VSCode and the GameMaker IDE, we need an easy way to clean the GameMaker Runner cache from the Stitch extension.

MVP:

  • A new command that runs the clean process
  • Made available in the command palette
  • Made available as as button in the sidebar
  • Made hotkey-able

GameMaker Releases summary download URL breaks

Now that the GameMaker Releases summary and the Stitch Desktop builds are both created as "GitHub Releases" in this same repo, the download URLs that use "latest" for them no longer work consistently.

The obvious thing to do is to post the GameMaker Releases artifact to some other location. Maybe using GitHub Pages?

The tree view should display sprites as dropdowns

Sprites are currently shown as individual resources, linking to their yy files. They should instead drop-down to the list of subimages. Showing them by index number instead of by ID would be a preferable UX.

I'm having a cursed issue when trying to run Stitch. Any idea what this could be?

It was running fine before, but then it broke

Stitch ERROR 07:50:39 "git" �� ���� ����७��� ��� ���譥�
��������, �ᯮ��塞�� �ணࠬ��� ��� ������ 䠩���.
 >
StitchError: "git" �� ���� ����७��� ��� ���譥�

    at Gms2Storage.get workingDirIsClean [as workingDirIsClean] (C:\Users\evolu\Documents\Projects\Actual projects\GMS 2.3 Projects\UnnamedPlatformer\ImportingPipeline\node_modules\@bscotch\stitch\src\lib\Gms2Storage.ts:37:13)                                                                                                                                                                        src\lib\Gms2Storage.ts:37:13)
    at new Gms2Storage (C:\Users\evolu\Documents\Projects\Actual projects\GMS 2.3 Projects\UnnamedPlatformer\ImportingPipeline\node_modules\@bscotch\stitch\src\lib\Gms2Storage.ts:17:13)
    at new Gms2Project (C:\Users\evolu\Documents\Projects\Actual projects\GMS 2.3 Projects\UnnamedPlatformer\ImportingPipeline\node_modules\@bscotch\stitch\src\lib\Gms2Project.ts:159:22)
    at Object.<anonymous> (C:\Users\evolu\Documents\Projects\Actual projects\GMS 2.3 Projects\UnnamedPlatformer\ImportingPipeline\load.js:5:19)
    at Module._compile (node:internal/modules/cjs/loader:1095:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at run (C:\Users\evolu\Documents\Projects\Actual projects\GMS 2.3 Projects\UnnamedPlatformer\ImportingPipeline\index.js:5:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Hide error about the update process already running

If the Stitch Desktop updater is already running and then the user manually requests an update check, a horrifying error is plastered onto the screen despite there not being a problem:

Unhandled error. ('AutoUpdater process with arguments --checkForUpdate,https://github.com/bscotch/stitch/releases/latest/download is already running')

So... that should stop happening!

Add yymps support for merges

While Stitch's merge capabilities remove the need for manual creation of yymps files (generated by GameMaker for bundling up assets), you would still have to know what you're supposed to be importing in order to craft the correct Stitch CLI command. If Stitch becomes widely used that won't be a problem, but it is currently not widely used and so many of the open-source libraries out there use yymps format.

It looks like yymps is just a zip file, so in principle this would be easy to do. However, yymps files do not necessarily contain YYP files, and so Stitch cannot load them without the addition of new features.

Texture and audio groups should not allow root as a folder.

private addGroupAssignement(type:Gms2ProjectConfigAssignmentField,folder:string,group:string){
this.data[type][folder] = group;
return this.save();
}

GMS2 handles root-level folder designations completely differently from all others, making them frustrating to deal with. There is no strict need for being able to assign texture/audio groups at the root level, since this is what default groups do.

Add assets to the token provider

Using Ctrl+P to find GameMaker stuff is a little unpleasant, since we usually don't care about YY files but also filenames in general aren't very useful (e.g. we often want to find a function defined in a script, but don't really care about the script).

The VSCode extension implements a token provider for globals (via Ctrl+T), but this doesn't include assets since they aren't defined in code. This makes it really annoying to quickly open up an object, for example.

To resolve this, we need to add assets to the token provider:

  • For objects, add one entry per event where the location is the event's GML file
  • For scripts, add one entry to the start of the GML file
  • For everything else, add one entry to the YY file

On merge, GameMaker crashes due to large numbers of file rewrites.

There's no way to fix the GameMaker side of this, but we can dramatically reduce the number of file writes. Currently a merge simply replaces the resource folder in the target with that on the source, without comparing file contents and only replacing things that have changed. It's more costly to check for changes first, and requires more code, so things might slow down on large merges. But the benefit is that GameMaker may get to keep running.

Stitch should skip an invalid spine file with a warning, instead of skipping the whole folder

It regularly happens that when rigging a new skin, my rigger creates a new temporary skeleton, that's not supposed to be used by the game and so will have no atlases, and be considered an invalid file by stitch. This will cause the whole import batch to fail even though the other spine files are perfectly fine.

For me the expected behaviour would be to have a warning printed, the file skipped and carry on to the next file.

.yyp

when gamemaker creates a new project from an old project (ie from the pre 2.3 days.) It will save that project as a project_name.yyp
That .ypp causes stitch add to not be able to find the .git file and gives a "StitchError: fatal: not a git repository"
I don't know if this is a real issue or not, but I got stuck on it for a bit till I worked it out.

Function parameter hints get offset if a string argument has a comma in it.

The parameter hint helper seems to be using all commas in your function arguments, including commas in strings. This causes the hint helper to get offset. Example:

function do_stuff(a, b, c) {}

do_stuff("What, me?", "No!", 2);

If you click into the second argument slot, it will show that you're in the third (because there is a comma in the first argument).

Resource folder setters should not allow root-level assets.

set folder(folderName:string){
if (folderName.match(/\.yyp/g)){
//This means the resource should be at the root level of the project, such as
// "parent": {
// "name": "sample-project",
// "path": "sample-project.yyp",
// },
this.yyData.parent.name = folderName.replace(/\.yyp/g, "");
this.yyData.parent.path = folderName;
}
else{
this.yyData.parent.name = folderName;
this.yyData.parent.path = `folders/${folderName}.yy`;
}
this.save();
}

The resource folder setter does not take into account root-level resources, which use a totally different system for naming parents. For now we should throw an error when there is an attempt to use root-level folders, since they'll make everything more complicated and aren't strictly required.

Static code analysis does not catch everything

In the absence of full IntelliSense in the GMS2 IDE, I've added some VERY rudimentary static analysis features to Stitch. These are in draft form. In particular, I have a feature for finding global functions and their references, to allow discovery of references to non-existent functions with some helpful features for versioning functions by name. However, the current draft parser does not seem to catch everything. Stitch will need more test cases and some additional rework to make this feature more useful.

No constructor for resource "particles"

The latest GameMaker versions include a new "Particle" resource type, which is currently not implemented in Stitch.

Two options for resolving this issue:

  1. Add the Particle type to Stitch
  2. Add a fallback type to Stitch for unknown resource types (more future-compatible)

Reported in IDE v2023.2.1.75 Runtime v2023.2.1.90

stitch add sprites --source=\sprite_root --flatten --debug
Running in debug mode

loading project with options
    projectPath: g:/GameMakerStudio2/Shredders_2/Shredders_2.yyp

file:///{...path}/node_modules/@bscotch/stitch/dist/lib/components/Gms2ResourceArray.js:240
            throw new StitchError(`No constructor for resource ${resourceType} exists.`);
                  ^

StitchError: No constructor for resource particles exists.
    at Function.hydrateResource (file:///{...path}/node_modules/@bscotch/stitch/dist/lib/components/Gms2ResourceArray.js:240:19)
    at file:///{...path}/node_modules/@bscotch/stitch/dist/lib/components/Gms2ResourceArray.js:31:59
    at Array.map (<anonymous>)
    at new Gms2ResourceArray (file:///{...path}/node_modules/@bscotch/stitch/dist/lib/components/Gms2ResourceArray.js:31:27)
    at StitchProject.reload (file:///{...path}/node_modules/@bscotch/stitch/dist/lib/StitchProject.js:539:24)
    at async Function.load (file:///{...path}/node_modules/@bscotch/stitch/dist/lib/StitchProject.js:66:9)
    at async default (file:///{...path}/node_modules/@bscotch/stitch/dist/cli/lib/add-sprites.js:7:27)

GameMaker project asset browser in VSCode

Currently the Stitch extension does not provide an asset browser, so users are left with the regular file browser. This isn't great, since the file structure has no relationship to how assets are organized in the project. Potentially worse, .yy files are mixed in and object event files are hard to pull up.

We need an actual asset browser to resolve all of this.

Minimum requirements:

  • Use the existing folder structure
  • Order everything alphabetically (?)
  • List object events under the object, with friendly names
  • Implement asset deletion
  • Implement asset creation

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.