GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 2011-10-31 12:02:35

paul23
Member
Registered: 2007-10-17
Posts: 110

GMOrganizer - Making up for the loss of gmres files.

EDIT: please read the 4th post


Hi,

To accomodate for the new structure of gamemaker I've created a small command line tool to split (and later merge) projects. This should make up for the loss of gmres exporting and importing. I'm not really sure where to post this (it's written in C++), maybe at some day I'll post this at the GMC.

Below you can download the file as well as the source.
Download gmorganizer.zip from Host-A


Currently it only features splitting of gamemaker projects - not very useful  I must admit -. Splitting would be done by the library developer to split his library away from the extra resources used for testing etc.
It is a command line application, so you'll have to either run the command prompt, or invoke the program in some other way. A typical call to split would be:

ExpandGMOrganizer -i "Gregexp.gmx" -o "gregex.gmx" -split "sprites;objects.test.group;extensions.GM Printing;help"

Which would split from Gregexp.gmx (project folder) to gregex.gmx. It would take all sprites, all objects in the folder "group" (under test), the extension GM Printing & the help file.


As I said the current version should be considered proof of concept, I'm going to add a "merge" feature soon. The engine is already capable of it, I just need to write a suitable interface. It should become easily more powerful than the old gmres solution was. An example would be objects: as they are xml files themselves too, I could merge 2 objects with the same name into one, allowing multiple developers to work on a single object. - Or any other resource. (Apart from scripts).

For merging I'm really wondering the approach: if the output file would exist would you expect it to be overwritten? - Or would the new input be appended to the output file? Also what are possible solution for collisions of resources? - Should I default to try merging (in case of objects, rooms), or overwrite?


Also everyone: feel very free to write an UI for the application. Haven't got any experience with window libraries in C++ yet, and leave me some feedback smile.

Last edited by paul23 (2012-01-27 22:57:28)

Offline

#2 2011-11-01 01:36:00

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

Re: GMOrganizer - Making up for the loss of gmres files.

You should follow the file copy philosophy. If it exists, ask if we want to copy (duplicate) or overwrite existing resources. It should also ask if the merge would be a separate branch in the project, if that is the case, you make a group of specified name in each resource type in the tree and assume the action is copy (and duplicate if existing).

On Merge Start
dest = root;
Ask, For Separate Branch, if so ask for name(dest = name), create branch if not root, default on copy (duplicate if exists)
Create branches
State = copy_all;

on merge each resource
if(state == notSet)   if(resource exists) Ask if you want to copy or overwrite, allow Apply to all option in a check, set state to copy_once, merge_once copy all or merge_all
if state = merge_once, merge onto dest, set state to notSet
if state = merge_all, merge onto dest
if state = copy_once, copy onto dest group, set state to notSet
if state = copy_all, copy onto dest

BTW, VB would be perfect for that sort of UI

Last edited by icuurd12b42 (2011-11-01 01:37:14)

Offline

#3 2011-11-01 09:39:24

paul23
Member
Registered: 2007-10-17
Posts: 110

Re: GMOrganizer - Making up for the loss of gmres files.

Not really going to work on an interface - I really dislike making interfaces tongue.


Also I wish to get it working together with subversion, so you can completely automate version control without clicking, many confirmation screens.
Keeping the core a command line interface, as this allows me to run the organizer from within visual studio & other programs (hopefully gamemaker will someday allow pre & post build programs to run).

Offline

#4 2012-01-27 22:54:40

paul23
Member
Registered: 2007-10-17
Posts: 110

Re: GMOrganizer - Making up for the loss of gmres files.

Bumping this, just finished a "nightly build" (well it's night and I finished it, right?)

The functionailty is done now, what's left is writing some more "mergers" & to write a helpfile / GUI. (I've ordered a book for Qt, so once I finish that book you'll start seeing me pestering you with over-the-top annoying graphical interfaces). Anyways, as it's near complete I decided to license GMOrganizer under GPL & upload it for everyone smile.

Download gmorganizer.zip from Host-A

Tomorrow I'll spent some time on writing a formal help file, though for now you'll have to do it with this in-topic help (or use the flag -help <TOPIC>).. I'd tried to implement a root-system.. Though I failed a bit with it, you can now (when mode is set to ask user for input) choose if you wish to merge, copy or skip the resource. And by giving the sign 2 times (ie "mm" instead of "m") the organizer will do so for the rest of the file I forgot that this isn't exactly as expected. You'd expect it to do the action for everything at this level and lower. So that's on the TO-DO list.

Anyways here are the current command line parameters understood:

  • -help <TOPIC> Shows generic help (or about TOPIC if specified).

  • -i <FILE1;FILE2> Sets the input files, that is the files where the resources are copied from

  • -input <FILE1;FILE2> Sets the input files, that is the files where the resources are copied from 

  • -O <FILE> Sets the input file, that is the file where the resources are copied to 

  • -output <FILE> Sets the input file, that is the file where the resources are copied from, when merging the file has to exist. When splitting the file is cleared firest

  • -merge <RESOURCE1;RESOURCE2> Sets the modus to merging  <RESOURCE1;RESOURCE2> are resource links (1)

  • -split<RESOURCE1;RESOURCE2> Sets the modus to splitting, <RESOURCE1;RESOURCE2> are resource links (1)

  • -Ds Sets the action on duplicate resources to skip duplicates

  • -Do Sets the action on duplicate resources to overwrite duplicates

  • -Da Sets the action on duplicate resources to ask user for action on duplicates

  • -Dm <LEVEL> Sets the action on duplicate resources to merge duplicates, notice that when a resource can't be merged, it will try to do another option. LEVEL indicates the level to which a resource is merged. (0 means infinite)

  • -no_opt When splitting into a new project, objects aren't copied

Project Files
The Organizer works over complete projects, so you should specify the project folder. Ie "gregexp.gmx" or "gregex.gmx". Output is similar, always make sure to provide the extension .gmx otherwise GM crashes.

Resource links
A resource link consists of an identifier for the resource type, followed by the "path". If the identifier ends at a whole "folder" (or simply is the identifier) all resources in the folder are considered. Multiple resource "trees" can be given seperated by ;
examples:
sprites.sprite0 - would specify the sprite "sprite0"
objects.test  - would specify every object in the folder "test", thus "object3" & "object2"
sounds.group.sound1 - would specify the sound1 (under the folder group)
datafiles - would specify all datafiles

All identifiers
sprites, sounds, backgrounds, paths, scripts, fonts, timelines, objects, rooms, extensions, triggers, datafiles & help


Some complete example of calling this:
GMOrganizer.exe -i Gregexp.gmx -o test.gmx -split objects;rooms.rmTest;sprites.sprite0 -no_opt
effect: new project is created "test.gmx". From Gregexp.gmx all objects, the room "rmTest" and "sprite0" is exported. The options for the new project are set to the default options

GMOrganizer.exe -i Gregexp.gmx -o gregex.gmx -merge objects.test.object3;scripts -Dm 0 -Da
effect: Resources are merged from "Gregexp.gmx" to "gregex.gmx" - "object3" & all scripts. If possible it tries to merge the resources, up to an infinite depth. If merging isn't possible it asks for confirmation

GMOrganizer.exe -i Gregexp.gmx -o gregex.gmx -merge timelines;extensions;sprites -Dm 1 -Da
effect: Resources are merged from "Gregexp.gmx" to "gregex.gmx" - all timelines, extensions & sprites. It tries to merge all resources. Inside resource for duplicate settings & entries it asks for user action.

GMOrganizer.exe -i Gregexp.gmx -o gregex.gmx -merge  -Do
effect: simply merges EVERYTHING from "Gregexp.gmx" to "gregex.gmx" Overwriting all resources


---------------------------------------------------
I hope this will tool will become useful for the extending gamemaker capabilities. As with this tool it ought to be relatively easy to export whole "engines". (As long as you keep everything from an engine inside a sperate folder). Also importing engines becomes a "breeze" - the last example is probably everything anyone needs in that regard: you "download" an extension. And then overwrite a possible out-dated.
Merging (Dm) can be used when working on the same project with multiple people, it shows quickly where "differences" appear & tries to find the best combination of both. One might wish to keep all merging at level "1". (only merge based on the existance of duplicate resources, inside resources it can only overwrite or skip). As otherwise it will try to merge events, which results in appending the new data to the existing event. (Obviously that MIGHT be wanted, though better is to explicitelly ask for this).



What I need right now is someone to provide me a real "test" for this, to see what's wrong with it. It ought to never crash gamemaker, I've went through great troubles to verify that the resulting gmx files are always working with GM  - but without an independent test it's hard to say for sure.

I'm not really sure what future this project will be, first I'll read up on Qt, and then I'll check what yoyogames has in mind for GM:studio/gm9.
But hey, it's GPL, everyone will extend this, right?

Last edited by paul23 (2012-01-27 22:56:47)

Offline

Board footer

Powered by FluxBB