Packaging game in ZIP files
by Philip Mansfield · in Torque Game Builder · 09/23/2005 (2:53 am) · 10 replies
I've finished the first version of my little helicopter game, and I want to zip up various files and have T2D run them from within the zip.
I'm having a few problems though, and am not sure why. The game works just fine when I have all the files sitting in their proper directories, but it all falls apart when I begin zipping them up.
If I zip up the common directory, the game crashes and I get the following in the console.log:
The data directory is where all the scripts/sounds etc for my game are located, and in this test, that directory is unzipped.
I'm sure I've had stuff running in zip files before, so maybe I've just forgotten a step. A little light shining wouldn't go amiss :)
I'm having a few problems though, and am not sure why. The game works just fine when I have all the files sitting in their proper directories, but it all falls apart when I begin zipping them up.
If I zip up the common directory, the game crashes and I get the following in the console.log:
--------- Loading MODS --------- Loading compiled script data/main.cs. Missing file: common/main.cs! Loading compiled script data/defaults.cs. Compiling data/client/prefs.cs... Loading compiled script data/client/prefs.cs. --------- Parsing Arguments --------- --------- Initializing Cargo --------- Loading compiled script data/client/client.cs. data/client/client.cs (5): Unable to find function initBaseClient data/client/client.cs (12): Unable to find function initCanvas Loading compiled script data/client/execs.cs. Loading compiled script data/client/profileoverrides.cs. Loading compiled script data/client/T2Dsplash.gui. Loading compiled script data/client/menugui.gui. Loading compiled script data/client/gamegui.gui.
The data directory is where all the scripts/sounds etc for my game are located, and in this test, that directory is unzipped.
I'm sure I've had stuff running in zip files before, so maybe I've just forgotten a step. A little light shining wouldn't go amiss :)
#2
09/23/2005 (6:59 am)
I think the zip file is just for packaging - every file needs to be unzipped to a directory on the end-users computer. Probably most of the paths in your scripts are like ~/images/image.png which are relative paths and basically need to be in the same directory format as those on your own computer.
#3
Graphic:
Sound:
Effect:
So there's no real difference between them, and the images load and animate just fine. If it was a pathing problem, I would expect the graphics to fail as well.
The console log shows:
There's probably something blindingly obvious that I'm just missing...
09/23/2005 (7:23 am)
Well, as far as pathing goes, it's like this:Graphic:
textureName = "~/client/images/helicopter";
Sound:
filename = "~/client/sounds/explode3.ogg";
Effect:
%missiletrail.loadEffect("~/client/effects/jet2.eff");So there's no real difference between them, and the images load and animate just fine. If it was a pathing problem, I would expect the graphics to fail as well.
The console log shows:
fxParticleEffect2D::loadEffect() - Could not Open File 'data/client/effects/jet2.eff' for Effect Load.
There's probably something blindingly obvious that I'm just missing...
#4
09/23/2005 (8:01 am)
Consider me dense on the subject. What are the capabilities of the zipped files? My guess would have been file size, but you allude to it having encryption advantages. Can you expand on that a bit?
#5
I used the resource here: http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7787
09/23/2005 (8:17 am)
I have a modified version of T2D that will read encrypted zip files. So once I'm ready for release, I zip all the files, encrypt the files, and then hey presto, protected art and sound assets :)I used the resource here: http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7787
#6
I think Melv has mentioned that all T2D assets were already using the resource manager in the coming 1.1 release, so this problem should go away with that.
09/23/2005 (9:32 am)
I vaguely recall some time back that some T2D assets were not yet using the resource manager to its fullest and therefore would not be findable in a zip archive. I came across this myself and found tilemaps and particle effects weren't being found and I attributed it to this.I think Melv has mentioned that all T2D assets were already using the resource manager in the coming 1.1 release, so this problem should go away with that.
#7
09/23/2005 (9:55 am)
I know that map files don't work in zips, but I've had sound and particles running from zip files before, and so have others on this forum. I just can't think what I've done differently this time to make it not work :(
#8
09/23/2005 (1:56 pm)
I've had sound working from zips but never particle effects for some reason. When you find out what's wrong let us know, maybe it'll be the same problem. :)
#9
10/10/2005 (5:39 pm)
How about bitmaps? They could be packed?
#10
"pack" or something of the like. With a bit more granular control over security and access.
One could allow some modding.. or totally disable any modding. But a tool that keeps prying hands out of the game
as required.
10/23/2005 (11:14 pm)
What we need and has been talking about before. I think for all 3 engines GG needs some kind of encryption / protection "pack" or something of the like. With a bit more granular control over security and access.
One could allow some modding.. or totally disable any modding. But a tool that keeps prying hands out of the game
as required.
Torque Owner Philip Mansfield
Default Studio Name
So that's working fine :)
The only problem now is that my particle effects and sound effect (a single non preloaded, non streaming ogg file) won't play from the zip. The effects I'm not too worried about, but the sound effect *must* go in the zip file so I can encrypt it.
I *know* I've had this working before as well, but with the current state of my brain, there's probably something else I've forgotten. Once again, any hints appreciated.