Jump to content


Photo

Resource Encrypter


  • Please log in to reply
13 replies to this topic

#1 NicholasJames2378

NicholasJames2378

    GMC Member

  • New Member
  • 23 posts
  • Version:GM8

Posted 28 May 2012 - 08:37 PM

I have recently discovered that you can decrease the size of your game and make it load faster if you put your resources in a separate folder, then have your game load them whenever they are needed. Could someone please tell me how to do this? Also, is it possible to encrypt them so that nobody can steal my resources after I produce the game? Note: I'm not very good with GML, but I will give it a try if it is vital.
  • 0

#2 Jack Indie Box

Jack Indie Box

    GMC Member

  • GMC Member
  • 1460 posts
  • Version:GM:Studio

Posted 28 May 2012 - 09:03 PM

from expierence of other people asking(and reading other answers), the only way to encrypt external files(that was suggested) is to use a dll and they came one such does not exist at the moment. the alternative they game was to just use the export sprite files(not png or whateva) and import them with sprite_add_sprite(fname); for eg. i expect there is the same for the other resource types this would make only people with game maker could open them... asuming they knew it was from game maker.

there may be a way to unencrypt files and load them but i am unaware, you can encrypt anything but reversing it ingame is another matter :) . im sure a dll could work but then someone would have to make it. btw what platform are you developing for and what version of game maker(my sprite_add_sprite sugestion is based on modern versions of game maker, else use the 100% unsecure metod and slower way of just importing pngs)
  • 0

#3 NicholasJames2378

NicholasJames2378

    GMC Member

  • New Member
  • 23 posts
  • Version:GM8

Posted 28 May 2012 - 09:08 PM

I am using Game Maker 8.0 Pro. What do you mean by platform?
  • 0

#4 Jack Indie Box

Jack Indie Box

    GMC Member

  • GMC Member
  • 1460 posts
  • Version:GM:Studio

Posted 28 May 2012 - 09:10 PM

that answers both questions, 8.0 only exports to windows. i am not sure if sprite_add_sprite is in 8.0 (i have 8.1 installed atm and its in this one) but as i said its not perfect for this situation but its the easiest "solution", least coding and such
  • 0

#5 NicholasJames2378

NicholasJames2378

    GMC Member

  • New Member
  • 23 posts
  • Version:GM8

Posted 28 May 2012 - 09:16 PM

8.0 has sprite_add_sprite(fname). I'm trying it out on one sprite to see if it works.

Ok. it has that function, but I'm not quite sure how to assign an object the sprite. Below is the info for the stuff. Could you make a code sample for me?

The object is called: title
The directory of the gmspr is: C:\Users\Nicholas\Desktop\123.gmspr


If there is anything else you need to know to help me, just let me know.

Edited by NicholasJames2378, 28 May 2012 - 09:24 PM.

  • 0

#6 Jack Indie Box

Jack Indie Box

    GMC Member

  • GMC Member
  • 1460 posts
  • Version:GM:Studio

Posted 28 May 2012 - 09:44 PM

i either havent used it myself or in a long while(as i said old versions of game makre didnt have it, so ive imported images not sprites many times before) but im pretty sure i know how it works.

all you need to do is set up a sprite like you do normally in game maker, lets say its called spr_player and has collision masks and animation set up thats all lovely and has the origin. when you export the sprite to a file all this info is stored like the name(used ingame) and origin. so you would just have your object set its sprite to spr_player(make sure this happens after you have added the sprite/ loaded)

if for some reason i am wrong try saving the id to a variable like spr=sprite_add_sprite.
"As this file contains all sprite settings, no further arguments are required. The function returns the index of the new sprite that you can then use to draw it or to assign it to the variable sprite_index of an instance. When an error occurs -1 is returned." i think i was wrong the first time, try both

or have an empty sprite(in game maker) witht he right name(ie one with no image assigned, but the sprite exists) and use sprite_replace_sprite(ind,fname) which would then mean you dont require to store the ind in a variable(if my first statement was wrong)
  • 0

#7 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14395 posts
  • Version:GM:Studio

Posted 28 May 2012 - 11:45 PM

you can add sprites and sounds and other things in the resource, name them, set up the properties but leave it empty.

then you use the _replace function passing along the index that you created and also the properties you specified for the resource

AKA sprite_replace sprite0 passing along sprite_get_precision(sprite0) and so on.


You cannot decrypt while reading the external file. you have to use a DLL to encrypt, decrypt the file to a temporary file readable by a GM function...

GMBinFile in my tools allows password protection and encryption/decryption and file bundling.
  • 0

#8 jflorek

jflorek

    GMC Member

  • GMC Member
  • 40 posts
  • Version:GM8

Posted 30 May 2012 - 02:09 PM

Is it faster (compared to normal) if the scripts are in a separate file?
</question>
EDIT: i suppose having resources separate from the game increases modding support

Edited by jflorek, 30 May 2012 - 02:11 PM.

  • 0

#9 Jack Indie Box

Jack Indie Box

    GMC Member

  • GMC Member
  • 1460 posts
  • Version:GM:Studio

Posted 30 May 2012 - 02:25 PM

im not sure about your script question

it does if you design appropriately
  • 0

#10 jflorek

jflorek

    GMC Member

  • GMC Member
  • 40 posts
  • Version:GM8

Posted 30 May 2012 - 07:55 PM

As in using file_execute or whatever it is on files instead of in game
  • 0

#11 Jack Indie Box

Jack Indie Box

    GMC Member

  • GMC Member
  • 1460 posts
  • Version:GM:Studio

Posted 31 May 2012 - 12:23 AM

i expect that is vastly slower, and harder for you to maintain maybe, probably other down falls too
  • 0

#12 epicpiedude

epicpiedude

    Artist/GameDeveloper

  • GMC Member
  • 362 posts
  • Version:GM8

Posted 28 July 2012 - 05:09 PM

A great way to encrypt is to use an ecryption program on the name, such as changing
player_sprite.png
to
<your encrypted string>.png
But someone can still open it.
Now change it to
<your encrypted string>.<random three letters>
Before you load the sprites, have your game change the name correctly. Once you have loaded them change the names back.
  • 0

#13 Fragment

Fragment

    GMC Member

  • GMC Member
  • 176 posts

Posted 31 July 2012 - 02:07 AM

A great way to encrypt is to use an ecryption program on the name, such as changing
player_sprite.png
to
<your encrypted string>.png
But someone can still open it.
Now change it to
<your encrypted string>.<random three letters>
Before you load the sprites, have your game change the name correctly. Once you have loaded them change the names back.


Well then it isnt encrypted...
So that is not "a great way to encrypt"
I would suggest using a dll such as ultracrypt
http://gmc.yoyogames.com/index.php?showtopic=245305
or
tarc if you can find a mirror
http://gmc.yoyogames.com/index.php?showtopic=280427

Also, it would be pointless changing the name of the file then changing it back; that is just unneccessary resource usage (albiet small).

Edited by Fragment, 31 July 2012 - 02:08 AM.

  • 0

#14 epicpiedude

epicpiedude

    Artist/GameDeveloper

  • GMC Member
  • 362 posts
  • Version:GM8

Posted 31 July 2012 - 12:40 PM

@Fragment: Well, it may not truly be encrypting, but no one is going to look at a
.tal
file and think "I found the images used in this game! Yes!"
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users