Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Fri 10/03/2006 16:27:38

Title: How can I hide video files from players?
Post by: on Fri 10/03/2006 16:27:38
Does anyone know if it is possible to hide video files in the directory? I mean I don't want the player see the video files because that could spoil the game if he or she choose to play it without playing the game.

I know I can mark all video files as "hidden files" but that would be too easy for the player to get to know if there is a video file in game directory right?

So do you have any other suggestions what to do else with it.

(Sorry about my bad English).

 
Title: Re: How can I hide video files from players?
Post by: Ishmael on Fri 10/03/2006 16:36:05
You could rename them to something obscure and have the game play that specific filename...
Title: Re: How can I hide video files from players?
Post by: strazer on Fri 10/03/2006 16:40:57
If you activate the "Resources split every Mb" option in General settings, the game exe will be split up into several parts, like this:
  gamename.exe
  gamename.001
  gamename.002
  gamename.003
and so on. Now you could rename the videos gamename.004 and so on and hide them among the other files.

I think this approach is good enough to avoid casual players finding the videos too easily. If they find them, decide to watch them and get spoiled, it's their loss.
Title: Re: How can I hide video files from players?
Post by: Ishmael on Fri 10/03/2006 17:05:42
Damn you strazer, stop stealing my refined ideas :=
Title: Re: How can I hide video files from players?
Post by: on Fri 10/03/2006 17:22:57
How can I hide it among others file? Some tutorial could be useful here. I can still see the images of the file when I have select "View" "small image" in windows browser even after I have renamed that videofile.
Title: Re: How can I hide video files from players?
Post by: Khris on Fri 10/03/2006 20:23:20
If Windows displays a preview icon even if the extension isn't recognized, you'd have to alter the file itself. Adding a zero byte at the start of the file should do the trick.

I believe there's a thread somewhere in the depths of the technical archive about how to achieve this using AGS's file commands.
File* hiddenfile=File.Open("hidden.00x", eFileRead);
File* videofile=File.Open("video1.mpg", eFileWrite);
hiddenfile.ReadRawChar(); // read the first byte to advance index
while (!hiddenfile.EOF) {
Ã,  videofile.WriteRawChar(hiddenfile.ReadRawChar());
}
hiddenfile.Close();
videofile.Close();
PlayVideo("video1.mpg", ...);

Another way would be using the encryption module. The relating thread should be there, too.
Title: Re: How can I hide video files from players?
Post by: HeirOfNorton on Sun 12/03/2006 16:01:06
If you do use the encryption module, bear in mind that it is meant for files accessed with the File* commands, so you would still have to do the whole copy thing like in the example above. (This seems rather much to me, honestly)

On the other hand, it seems unusual that Windows still recognizes the file as a video file even after renaming it. Are you sure that you renamed the whole thing? Go into windows Explorer or My Computer, and open the Tools -> Folder Options menu, go to the View tab and make sure "Hide extensions for known file types" is UNchecked. If it WAS checked, you might have just renamed the file to "gamename.005.mpg" (or whatever), so it would still be recognized that way.

Hope this helps,
HoN
Title: Re: How can I hide video files from players?
Post by: on Mon 13/03/2006 17:18:29
I changed my mind having video included in my game. I mean it was not really necessary for the game, anyway I tried that code and suddenly the video file was just empty. It has no mb inside. And the video file didn't work in the game.

I did what bykhrismuc said and renamed the video file from video1.vmw into "Thewronggame3.003" but the small image of the file could still be displayed. So I think it is still best for me to let it be in hidden files so people will not notice it.

So yes I had no clue why that happened but it destroyed the video file after I tried that code bykhrismuc . (That is very strange username eh! )

Maybe I just wait for it when Chris Jones make something new changes for those video files.Ã,  But as you all know we can store all music in one vox file so I will wait for it if he is ever going to build something new wich can store video files in one file like the vox file.

So yes no videos will be included in my game. It will just be plain and great game.

I have already left a demo in demo page. It is called Vitlausi Leikurinn. Unfortunatly for you all it is still with icelandic language.
Title: Re: How can I hide video files from players?
Post by: Khris on Mon 13/03/2006 19:22:57
I didn't test that code, but it looks o.k. to me. And it shouldn't have touched the original file, as all it does to it is open, read, close.

Just don't hide them then, I don't look at included videos before playing the game, and there are enough people who don't spoil their gaming experience on purpose.

(btw: my username isn't that strange considering that I'm called Christian and live in Munich -> airport's name: MUC ;))

EDIT: I've tested the code, due to the insane amount of while-iterations, AGS will crash after writing ~146k (=150.000 bytes). Since 2.71 beta 4, this while-check can be disabled, I'll report back when I've successfully tested it.