First of all let me take the time to thank BatVink for his wonderful demonstration in the latest NewsLetter of how to encrypt our media using memblocks. I wish I could offer a real one, but I cant so here you go
I just got done encrypting all my current used media in Age of Knights.
It was a slow process but after a few hours of tinkering around I got it all done.
I created a new file inside the project and called it
LoadMedia
Heres what it looks like....
#include "encryption"
Function LoadMedia()
////////////////////////////////Load PlatForm Images//////////////////////////////////////////////////////////
decryptFile("Platform-01.png.enc", "Platform-01.png")
LoadImage ( 1,"Platform-01.png" )
DeleteFile("Platform-01.png")
decryptFile("Platform-02.png.enc", "Platform-02.png")
LoadImage ( 2,"Platform-02.png" )
DeleteFile("Platform-02.png")
decryptFile("Platform-03.png.enc", "Platform-03.png")
LoadImage ( 3,"Platform-03.png" )
DeleteFile("Platform-03.png")
decryptFile("Platform-04.png.enc", "Platform-04.png")
LoadImage ( 4,"Platform-04.png" )
DeleteFile("Platform-04.png")
decryptFile("Platform-05.png.enc", "Platform-05.png")
LoadImage ( 5,"Platform-05.png" )
DeleteFile("Platform-05.png")
decryptFile("Platform-06.png.enc", "Platform-06.png")
LoadImage ( 6,"Platform-06.png" )
DeleteFile("Platform-06.png")
decryptFile("Platform-07.png.enc", "Platform-07.png")
LoadImage ( 7,"Platform-07.png" )
DeleteFile("Platform-07.png")
decryptFile("Platform-08.png.enc", "Platform-08.png")
LoadImage ( 8,"Platform-08.png" )
DeleteFile("Platform-08.png")
decryptFile("Platform-09.png.enc", "Platform-09.png")
LoadImage ( 9,"Platform-09.png" )
DeleteFile("Platform-09.png")
decryptFile("Platform-10.png.enc", "Platform-10.png")
LoadImage ( 10,"Platform-10.png" )
DeleteFile("Platform-10.png")
decryptFile("Platform-11.png.enc", "Platform-11.png")
LoadImage ( 11,"Platform-11.png" )
DeleteFile("Platform-11.png")
decryptFile("Platform-12.png.enc", "Platform-12.png")
LoadImage ( 12,"Platform-12.png" )
DeleteFile("Platform-12.png")
decryptFile("Platform-13.png.enc", "Platform-13.png")
LoadImage ( 13,"Platform-13.png" )
DeleteFile("Platform-13.png")
/////////////////////////////////////////////////////////////////////////////////////////////////
//Level Cleared Menu
decryptFile("LevelClearedMenu.png.enc", "LevelClearedMenu.png")
LoadImage (32,"LevelClearedMenu.png")
DeleteFile("LevelClearedMenu.png")
////Game Over Menu
decryptFile("GameOverMenu.png.enc", "GameOverMenu.png")
LoadImage (33,"GameOverMenu.png")
DeleteFile("GameOverMenu.png")
////////////////////FLY TRAP Images//////////////////////
decryptFile("FlyTrap1.png.enc", "FlyTrap1.png")
FlyTrapFrame1 = LoadImage ("FlyTrap1.png")
DeleteFile("FlyTrap1.png")
decryptFile("FlyTrap2.png.enc", "FlyTrap2.png")
FlyTrapFrame2 = LoadImage ("FlyTrap2.png")
DeleteFile("FlyTrap2.png")
decryptFile("FlyTrap3.png.enc", "FlyTrap3.png")
FlyTrapFrame3 = LoadImage ("FlyTrap3.png")
DeleteFile("FlyTrap3.png")
decryptFile("FlyTrap4.png.enc", "FlyTrap4.png")
FlyTrapFrame4 = LoadImage ("FlyTrap4.png")
DeleteFile("FlyTrap4.png")
////Direction Button////
decryptFile("DirectionButton.png.enc", "DirectionButton.png")
LoadImage (36,"DirectionButton.png")
DeleteFile("DirectionButton.png")
////Load Image Direction Sign/////
decryptFile("Elements-43.png.enc", "Elements-43.png")
LoadImage(37,"Elements-43.png")
DeleteFile("Elements-43.png")
///Load Image Tree1
decryptFile("Elements-04.png.enc", "Elements-04.png")
LoadImage(38,"Elements-04.png")
DeleteFile("Elements-04.png")
///Load Image Tree2
decryptFile("Elements-07.png.enc", "Elements-07.png")
LoadImage(39,"Elements-07.png")
DeleteFile("Elements-07.png")
///Load Jump Button
decryptFile("UpButton.png.enc", "UpButton.png")
LoadImage(40,"UpButton.png")
DeleteFile("UpButton.png")
//////////////////////////////Load Sounds//////////////////////////////////////////
decryptFile("EndLevelSound.wav.enc", "EndLevelSound.wav")
EndLevelSound = LoadSound ("EndLevelSound.wav")
DeleteFile("EndLevelSound.wav")
decryptFile("Coin-2.wav.enc", "Coin-2.wav")
Coin2 = LoadSound ("Coin-2.wav")
DeleteFile("Coin-2.wav")
decryptFile("game_over.wav.enc", "game_over.wav")
GameOverSound = LoadSound ("game_over.wav")
DeleteFile("game_over.wav")
decryptFile("PlayerHurtSound.wav.enc", "PlayerHurtSound.wav")
PlayerHurtSound = LoadSound ("PlayerHurtSound.wav")
DeleteFile("PlayerHurtSound.wav")
decryptFile("EnemyHurt.wav.enc", "EnemyHurt.wav")
EnemyHurt = LoadSound ("EnemyHurt.wav")
DeleteFile("EnemyHurt.wav")
decryptFile("PlayerPowerUp.wav.enc", "PlayerPowerUp.wav")
PlayerPowerUp = LoadSound("PlayerPowerUp.wav")
DeleteFile("PlayerPowerUp.wav")
//////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////Load Character Images///////////////////////////////////////
decryptFile("skeleton-idle_0.png.enc", "skeleton-idle_0.png")
LoadImage (14,"skeleton-idle_0.png")
DeleteFile("skeleton-idle_0.png")
decryptFile("skeleton-run1_0.png.enc", "skeleton-run1_0.png")
CharacterFrame1 = LoadImage("skeleton-run1_0.png")
DeleteFile("skeleton-run1_0.png")
decryptFile("skeleton-run1_1.png.enc", "skeleton-run1_1.png")
CharacterFrame2 = LoadImage("skeleton-run1_1.png")
DeleteFile("skeleton-run1_1.png")
decryptFile("skeleton-run1_2.png.enc", "skeleton-run1_2.png")
CharacterFrame3 = LoadImage("skeleton-run1_2.png")
DeleteFile("skeleton-run1_2.png")
decryptFile("skeleton-run1_3.png.enc", "skeleton-run1_3.png")
CharacterFrame4 = LoadImage("skeleton-run1_3.png")
DeleteFile("skeleton-run1_3.png")
decryptFile("skeleton-run1_4.png.enc", "skeleton-run1_4.png")
CharacterFrame5 = LoadImage("skeleton-run1_4.png")
DeleteFile("skeleton-run1_4.png")
decryptFile("skeleton-run1_5.png.enc", "skeleton-run1_5.png")
CharacterFrame6 = LoadImage("skeleton-run1_5.png")
DeleteFile("skeleton-run1_5.png")
decryptFile("skeleton-run1_6.png.enc", "skeleton-run1_6.png")
CharacterFrame7 = LoadImage("skeleton-run1_6.png")
DeleteFile("skeleton-run1_6.png")
///////////////////////////////////////////////////////////////////////////////////////////////////////////
//Load Coin Image
decryptFile("Elements-30.png.enc", "Elements-30.png")
LoadImage (15,"Elements-30.png")
DeleteFile ("Elements-30.png")
//Load Spikes
decryptFile("Elements-25.png.enc", "Elements-25.png")
LoadImage (16,"Elements-25.png")
DeleteFile ("Elements-25.png")
//Load Heart
decryptFile("Elements-42.png.enc", "Elements-42.png")
LoadImage(17,"Elements-42.png")
DeleteFile ("Elements-42.png")
////////////////////////////////Load Monkey Images////////////////////////////////
decryptFile("Monkey1.png.enc", "Monkey1.png")
LoadImage(18,"Monkey1.png")
DeleteFile("Monkey1.png")
decryptFile("Monkey2.png.enc", "Monkey2.png")
MonkeyFrame1 = LoadImage("Monkey2.png")
DeleteFile("Monkey2.png")
decryptFile("Monkey3.png.enc", "Monkey3.png")
MonkeyFrame2 = LoadImage ("Monkey3.png")
DeleteFile("Monkey3.png")
decryptFile("Monkey4.png.enc", "Monkey4.png")
MonkeyFrame3 = LoadImage ("Monkey4.png")
DeleteFile("Monkey4.png")
decryptFile("Monkey5.png.enc", "Monkey5.png")
MonkeyFrame4 = LoadImage ("Monkey5.png")
DeleteFile("Monkey5.png")
decryptFile("Monkey6.png.enc", "Monkey6.png")
MonkeyFrame5 = LoadImage ("Monkey6.png")
DeleteFile("Monkey6.png")
decryptFile("Monkey7.png.enc", "Monkey7.png")
MonkeyFrame6 = LoadImage ("Monkey7.png")
DeleteFile("Monkey7.png")
decryptFile("Monkey8.png.enc", "Monkey8.png")
MonkeyFrame7 = LoadImage ("Monkey8.png")
DeleteFile("Monkey8.png")
////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////Load Bird////////////////////////////////
decryptFile("Bird1.png.enc", "Bird1.png")
BirdFrame1 = LoadImage ("Bird1.png")
DeleteFile ("Bird1.png")
decryptFile("Bird2.png.enc", "Bird2.png")
BirdFrame2 = LoadImage ("Bird2.png")
DeleteFile ("Bird2.png")
decryptFile("Bird3.png.enc", "Bird3.png")
BirdFrame3 = LoadImage ("Bird3.png")
DeleteFile ("Bird3.png")
decryptFile("Bird4.png.enc", "Bird4.png")
BirdFrame4 = LoadImage ("Bird4.png")
DeleteFile ("Bird4.png")
/////////////////////////////////////////////////////////////////////
//Load Image Health Display
decryptFile("HealthDisplayBar.png.enc", "HealthDisplayBar.png")
LoadImage (20,"HealthDisplayBar.png")
DeleteFile("HealthDisplaybar.png")
//Load Star for Endgame
decryptFile("Elements-29.png.enc", "Elements-29.png")
LoadImage(21,"Elements-29.png")
DeleteFile("Elements-29.png")
//Load Coin Display Bar
decryptFile("CoinDisplayBar.png.enc", "CoinDisplayBar.png")
LoadImage (22,"CoinDisplayBar.png")
DeleteFile("CoinDisplayBar.png")
/////////////////////////////Load Menu Images///////////////////////////
decryptFile("MenuBackGround2.png.enc", "MenuBackGround2.png")
LoadImage(24,"MenuBackGround2.png")
DeleteFile("MenuBackGround2.png")
decryptFile("SettingsButton.png.enc", "SettingsButton.png")
LoadImage (25,"SettingsButton.png")
DeleteFile("SettingsButton.png")
decryptFile("InfoButton.png.enc", "InfoButton.png")
LoadImage (26,"InfoButton.png")
DeleteFIle("InfoButton.png")
decryptFile("AchievmentsButton.png.enc", "AchievmentsButton.png")
LoadImage (27,"AchievmentsButton.png")
DeleteFIle("AchievmentsButton.png")
decryptFile("FaceBookButton.png.enc", "FaceBookButton.png")
LoadImage (28,"FaceBookButton.png")
DeleteFile("FaceBookButton.png")
decryptFile("TwitterButton.png.enc", "TwitterButton.png")
LoadImage (29,"TwitterButton.png")
DeleteFile("TwitterButton.png")
//////////////////////////////////////////////////////////////////////////////
///////////Load Level Select Images//////////
decryptFile("LevelSelectMenu.png.enc", "LevelSelectMenu.png")
LoadImage (30,"LevelSelectMenu.png")
DeleteFile("LevelSelectMenu.png")
decryptFile("LevelButton1.png.enc", "LevelButton1.png")
LoadImage (31,"LevelButton1.png")
DeleteFIle("LevelButton1.png")
decryptFile("LevelLock.png.enc", "LevelLock.png")
LoadImage (34,"LevelLock.png")
DeleteFile("LevelLock.png")
/////////////////////////////////////////////////////
///////////////Title screen background//////////////////
decryptFile("TitleScreenBackGround1.png.enc", "TitleScreenBackGround1.png")
TitleScreenBackGround = LoadImage ( "TitleScreenBackGround1.png" )
DeleteFile("TitleScreenBackGround1.png")
//////////Settings Background menu/////////////
decryptFile("SettingsMenu.png.enc", "SettingsMenu.png")
MenuBackGround = LoadImage("SettingsMenu.png")
DeleteFile("SettingsMenu.png")
//////////////Achievments Images////////////
decryptFile("AchievmentsMenu.png.enc", "AchievmentsMenu.png")
AchievmentsBackGroundMenu = LoadImage("AchievmentsMenu.png")
DeleteFile("AchievmentsMenu.png")
decryptFile("AchievmentDisplayBar.png.enc", "AchievmentDisplayBar.png")
AchievmentDisplayBar = LoadImage ("AchievmentDisplayBar.png")
DeleteFile("AchievmentDisplayBar.png")
/////////////////////////////////////////////////////
/////////Loading Image/////////
decryptFile("LoadingImage.png.enc", "LoadingImage.png")
Loading = LoadImage("LoadingImage.png")
DeleteFile("LoadingImage.png")
EndFunction
Its not a big issue, but when I'm loading the game on pc. I'm counting 6-7 fast Mississippi(Seconds)
Also watching the appdata folder I can catch 1 or 2 media flash up and delete faster than I can click one...I'm sure if I wanted to I could catch it fast enough...If I tried 100000 times...which if someone wants it that bad they can have it.
The thing I'm worried about is load times on phones. 6 seconds isn't a big deal on a computer for startup times. That 6 seconds may be FOREVER on a phone.
Should I be decrypting a different way or is slow loading the cost of security ?
I have also thought about decrypting the media as it is needed instead of all at once and spreading the time out ....Just looking for options as I'm new to this and wondering about other ways
Thanks for any advice in advance!
For anyone who is intrested in the tutorial you may find it here.
http://www.thegamecreators.com/pages/newsletters/newsletter_issue_151.html
Beta Test Age of Knights:https://play.google.com/apps/testing/com.CrazyProgrammerProductions.my_AgeOfKnights
Download JellyFish Dive:https://play.google.com/store/apps/details?id=com.CrazyProgrammerProductions.my_JellyFishSwim