• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - IDE GMS2 Real-Time resource creation

A

Alexander123

Guest
Hello,

I'm not sure if this is the right place to post this topic but I do believe that it shouldn't be an issue.
I was wondering if it would be possible to create .yyc resources in real time? What I mean by that is if it would be possible to import an image inside your game and create a .yyc resource (sprite in this example) inside the core game folder? For example I'd import an image "test.img" while the game is running and I'd convert it to a .yyc resource in the background and implement it into the project folder. Next time I run the game the image would be indexed inside the editor and would be "read" as a sprite.

Is something like this possible with GMS functions?

Thanks in advance, Alex
 

TsukaYuriko

☄️
Forum Staff
Moderator
Not the way you're imagining, but you can dynamically load resources via functions such as sprite_add at run time.
 
A

Alexander123

Guest
So it's not possible to create a gms2 resource file directly from the game and "keep it/use it" as any other resource afterwards in the project folder?
 

TsukaYuriko

☄️
Forum Staff
Moderator
That's correct, unless you create it manually. You'd need to know the format specifications of the corresponding format for that, though, and as far as I'm aware, those are not public.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
You can use the new non-sandboxed file access features to have your game read your YYP file, add a resource to it, and write it back into project directory, but this will involve some investigative work on format of each respective YY file.
 
A

Alexander123

Guest
You can use the new non-sandboxed file access features to have your game read your YYP file, add a resource to it, and write it back into project directory, but this will involve some investigative work on format of each respective YY file.
Can you provide any links or documentation? It'd be appreciated, thanks.
 
A

Alexander123

Guest
@YellowAfterlife Deconstructing the .yy file was pretty easy to be honest, since it was in plain text and it was a JSON object, it also does work very well with my idea of implementing the files inside the project itself through the game. Thanks a lot, you were quite helpful. I was wondering though if there was a way to get the current project directory from the game itself? Knowing that the game isn't restricted to save files inside the sandbox anymore I'd like to be able to dynamically get the current project path which as far as I can see isn't possible? I can only get the "working_directory" and the temporary directory.
 

TsukaYuriko

☄️
Forum Staff
Moderator
If by project path, you mean the path of the source files: That's not possible, as compiled games do not keep track of this. You can, however, save this in a constant manually.

If you're talking about the folder the compiled .exe resides in, you're looking for program_directory.
 
Top