• Hey! Guest! The 37th GMC Jam will take place between May 28th, 12:00 UTC and June 1st, 12:00 UTC. Why not join in! Click here to find out more!
  • 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.

Discussion Is this possible in Game Maker Studio 2

Would it be possible to allow a user to modify the sprite that a game I make uses, to represent them, better? I am of course talking about the end result game. Are files accessible to the end user, or does the whole game compile to some form of compressed files that are uneditable to the end user?

If it is unaccessable to them, is it possible to code it, so that it uses a png or pngs that they have access to?
 

rIKmAN

Member
Would it be possible to allow a user to modify the sprite that a game I make uses, to represent them, better? I am of course talking about the end result game. Are files accessible to the end user, or does the whole game compile to some form of compressed files that are uneditable to the end user?

If it is unaccessable to them, is it possible to code it, so that it uses a png or pngs that they have access to?
Include the sprite(s) you want to be accesible to the players as an "Included File" and it will be inside a regular folder when you export your game.
They can ten edit this using a regular paint program and you would then load this into your game using sprite_add() and it will then be used like a regular sprite.

Be aware that sprite_add() creates a new texture page for each sprite, although with just a few sprites this shouldn't be an issue.
 

kroart

Member
Would it be possible to allow a user to modify the sprite that a game I make uses, to represent them, better? I am of course talking about the end result game. Are files accessible to the end user, or does the whole game compile to some form of compressed files that are uneditable to the end user?

If it is unaccessable to them, is it possible to code it, so that it uses a png or pngs that they have access to?
GameMaker packs all sprites into it's data.win file (at least on Windown and Android). In any case all sprites are packed into game's archive and not accessible for users.
 

rIKmAN

Member
In any case all sprites are packed into game's archive and not accessible for users.
No, as I said in my previous post - if you put sprites (or any other files) into Included Files they are exported as regular image files along with the executable and data.win when you compile.

You can then load them into the game using sprite_add(), which means players would be able to edit them, save them and have them loaded into the game.
 
Last edited:

Homunculus

Member
No, as I said in my previous post - if you put sprites (or any other files) into Included Files they are exported as regular image files along with the executable and data.win when you compile.

You can then load them into the game using sprite_add(), which means players would be able to edit them, save them and have them loaded into the game.
Note that simply adding them as included files is not enough if you want the players to edit them, since as far as I know included files are overwritten with the original ones every time the game is run (at least on desktop platforms, unless something has been changed recently in that regard). Ideally you should copy them to the writable sandbox directory and point the player to that location.


edit: not the case anymore
 
Last edited:

rIKmAN

Member
Note that simply adding them as included files is not enough if you want the players to edit them, since as far as I know included files are overwritten with the original ones every time the game is run (at least on desktop platforms, unless something has been changed recently in that regard). Ideally you should copy them to the writable sandbox directory and point the player to that location.
No, you can freely edit images from Included Files when exported with the exe and the game will load the new edited images without any issue.
Unless you mean when "running" from the IDE rather then when exporting as a final exe?

I just tested this and the png file from Included Files was exported along with the exe and data.win.
I then edited that png, saved it, and re-ran the exe and the edited sprite loaded and worked fine.

This is a simple use case just to show the functionality of course, and in real world use you'd want to run checks on the edited image to make sure it was within acceptable width/height, reset any sprite origins and/or masks etc based on the requirements of your game.

I'm talking about Windows here too, not sure when on mobile as I have not tested it so it may well work differently there.
 
Last edited:

Homunculus

Member
Weird, I tested this specific behavior some time ago and had different results, but you are right @rIKmAN , both on windows and mac I don't see this anymore (or maybe I was running the wrong tests from the beginning).
 

rIKmAN

Member
Weird, I tested this specific behavior some time ago and had different results, but you are right @rIKmAN , both on windows and mac I don't see this anymore (or maybe I was running the wrong tests from the beginning).
Were you exporting to a final exe, or running from the IDE?

It's make sense that it wouldn't work running from the IDE as it would be creating / exporting new files each time you ran it, but for exported executables it's been like this for at least 18mths or so as I used to use this method when making changes to Spine skeletons so that I didn't have to keep re-importing the json files into the IDE each time I made changes to it in Spine and exported new json.

It meant I could just export from Spine into the game folder and run the exe file to have it use the new skeleton json loaded in via sprite_add().

I'd assume it would be the same for regular sprites too, but again I can only confirm this for Windows.
 

Mike

nobody important
GMC Elder
Worth remembering that if you change the root files and you release using Steam or something, any update will wipe the files.

If you put them in the "save" location, then these will be loaded instead of the included file version. This was to allow changing of the root files without corrupting the base install - and because you obviously couldn't save to an install folder every time.

by default, the game saves to %localappdata%\GameName, although you can change this in the options.
 

Homunculus

Member
Regardless of the assumptions above about included files being overwritten, it is probably a good idea to copy those to the save location anyways if you want the user to edit them manually, so you always keep a copy of the original. I'm thinking about an accidental deletion of a file or corruption for example, but even a feature to "reset" the changes made by the player.
 
Top