MPacker : Packer for blitzmax

BlitzMax Forums/BlitzMax Programming/MPacker : Packer for blitzmax

Filax(Posted 2005) [#1]
Hi :)

I'm finishing my new packer for bmax, it's called MPacker

With this utility you can pack all your media in a compressed
and secured archive. Totaly transparent in you app, i have
remake all bmax commands for use image, anim image or sounds.

The data are read directly under ram, there is no temporary file
saved on hard drive !

This software will be free for all bmax user :)

Try a little (Alpha) demo of the packing gui :
http://www.blitz3dfr.com/mpacker_projet/mpacker.zip

First release (tool, module and examples) in one, or two day.

Features : PC, Mac and Linux compatibility




amonite(Posted 2005) [#2]
many thanks Filax :)

nice tool ! i guess you did it with your GUI.


Arcadenut(Posted 2005) [#3]
Looking good so far. Will you allow a Hierachy inside the file?

So it would be:

Level1
|   |____ Graphics
|   |          |___Image1.png
|   |          |___Image2.png
|   |____ Sounds
|   |____ Data
|
Level2
    |____ Graphics
    |____ Sounds
    |____ Data



Even if it wasn't stored that way, if I could say:

LoadImage("\Level1\Graphics\Image1.png")

that would be very useful.

The only reason I ask is because you have "Pack a Directory (non-recursively)." which to me implies that everything is flat.

I like to keep evreryhing neatly organized in a directory structure and would like that maintained (even if by illusion) in a packed file.

Thanks


Filax(Posted 2005) [#4]
Its not very easy to make pak with structur ! :) the reponse is no :)

But you can keep your directory structur in your code with a pak !

Example :

You have a LoadImAge("C:\Tmp\iMg\Toto.bmp")

With the packer you can keep "C:\Tmp\iMg\" because i
strip dir :) when i'm reading media files from pak.

Example :

MPK_LoadImage("C:\Tmp\iMg\Toto.bmp")

Note :

The packing is the last operation before release, don't use it
while creating you software, you keep you directory !

But to make the pak, copy all your media in the same dir.
And in your code you can keep your directory :)

Happy ? :)


Arcadenut(Posted 2005) [#5]
Ok, I understand that. However, could you make it so that it saves the full directory name with it and have it do sub directories?

The main reason is that I might have two files named the same thing in two different directories and they would have different information.

So for example:

You would store both files like you do now, but with different names like:

c:\temp\level1\levelinfo.dat
c:\temp\level2\levelinfo.dat

I don't care how it's stored in the PAK file as long as I could have it read a directory (and sub directories) and pack them with the full names.

Hope I'm clear on what I am looking for...


Filax(Posted 2005) [#6]
I will try :) But i think that to have two or more media with the same name is dangerous !


Jeroen(Posted 2005) [#7]
Hi Filax. Good stuff!

I disagree on your comment "two or more media with the same name is dangerous". If you have several game levels, then usually I create a filename protocol.

E.g:

levels\1\level.dat
levels\1\items\
levels\1\sfx\
levels\1\scripts\

levels\2\level.dat
levels\2\items\
levels\2\sfx\
levels\2\scripts\


Here, same filenames and folder names are essential for the level load procedure, and is good practice. Meshes loaded fromout level.dat may be different each level, but the base files/folders are always the same...


Filax(Posted 2005) [#8]
Of course ! i agree ! but with mpacker you can use easily multipack
with for example :

MPK_Initpack("C:\Filou\Test1.mpk")
Local img2:TImage=MPK_LoadImage("45898_1094230593.jpg")
Local img3:TPixmap=MPK_LoadPixmap("58284_11456465431.jpg")
MPK_Closepack()


MPK_Initpack("C:\Filou\Test2.mpk")
Local img3:TImage=MPK_LoadImage("45898_1094230593.jpg")
Local img4:TPixmap=MPK_LoadPixmap("58284_11456465431.jpg")
MPK_Closepack()

You can simply make one directory for each game level and pack it


Filax(Posted 2005) [#9]
First release ! :) re download the file and try the examples :)

PS : Copy the mpacker.mod in your blitzmax pub.mod

Enjoy and report me error !


bregors(Posted 2005) [#10]
.


Filax(Posted 2005) [#11]
Hi SRB :)

I will try to copy your system, for use directory structur.
but i hope that will be compatible with my stream system.

Cheers :)


bregors(Posted 2005) [#12]
.


Filax(Posted 2005) [#13]
Many thanks :)


Grisu(Posted 2005) [#14]
Looking good! :)


Murilo(Posted 2005) [#15]
This looks great! Nice, clean interface too.


coffeedotbean(Posted 2005) [#16]
hey, is that voice computer generated? what program did ya use?

Nice tool btw, a good replacemrnt for the terabit packer.


Filax(Posted 2005) [#17]
Thanks :)


Warren(Posted 2005) [#18]
What's the advantage of using this over incbin? Am I missing something obvious?


Filax(Posted 2005) [#19]
:) imagine :) you have 100 images * 1 mb to include in your EXE file :)
You obtain an exe file size of 105 mb ! in your ram :)

With a pak you read only that you want to use :)

:) imagine :) you want distribute a level of your fantastic game
via web file download :) What do you do ?

Re-upload your full 300 mb game ? or only the level pack ?

Incbin is perfect for little demo or programs with less than
10 mb of media files.

And, for the end :) files are compressed :)


Warren(Posted 2005) [#20]
It seems to me that if you're incbin'ing a file, you intend to use it. So the bloat really isn't a big concern.

Who patches a part of a game? Most people just release new versions.

As for compression ... UPX?

Anyway, was just wondering. Doesn't seem worth it for me...


Koriolis(Posted 2005) [#21]
I'd just like to point that intending to use all you game data over the course of the program execution is quite different from using all your game data *all the time*. Whatever smart a virtual memory system can be, it would be interesting to look at how well on demand paging and such mecanisms perform compared to explicitely loading and unloading the data you need. [edit]simply put: no, such a packer is probably not useless[/edit]


Filax(Posted 2005) [#22]
Made as you want:) I deliver just my opinion on packing:)


Arcadenut(Posted 2005) [#23]
I plan on using it to create "Level Packs". There will be a Demo Level pack, then a Full Game Level Pack, then if everything goes well, I can do add-on level packs. All I have to do is ship a .PAK file and the game stays the same.

It could also alow for 3rd Party Level Packs or User Generated Level Packs.

If everything is in the EXE, it makes the EXE bigger for no gain (for what I am doing).

In the Pack File, it will have everything needed for the game. The EXE is just going to be the Engine that uses the info to run.


TartanTangerine (was Indiepath)(Posted 2005) [#24]

But you can keep your directory structur in your code with a pak !

Example :

You have a LoadImAge("C:TmpiMgToto.bmp")

With the packer you can keep "C:TmpiMg\" because i
strip dir :) when i'm reading media files from pak.

Example :

MPK_LoadImage("C:\Tmp\iMg\Toto.bmp")


I take it that you have to use the full path for this to work.

Example :-

MPK_LoadImage("gfx/cartoon_cursor.png")

Does not work.


Filax(Posted 2005) [#25]
Arrghh ! it must be a problem with my strip saved name.

Thanks for report.


TartanTangerine (was Indiepath)(Posted 2005) [#26]
Did you fix it?


TartanTangerine (was Indiepath)(Posted 2005) [#27]
I also noticed that the random serial generator is not very random and that I can not unpack encrypted packs.


Filax(Posted 2005) [#28]
do you use the same number generated to uncrypt pak data ?


TartanTangerine (was Indiepath)(Posted 2005) [#29]
Yes filax :D


Filax(Posted 2005) [#30]
I have made a little update with new encrypting method.
Older MPK file are not compatible.


TartanTangerine (was Indiepath)(Posted 2005) [#31]
Did you fix the stripped directory name?


Filax(Posted 2005) [#32]
Not yet


lonnieh(Posted 2005) [#33]
Nice work! Is there a way to list the contents of a pack, besides on the output window?


Filax(Posted 2005) [#34]
Not for the moment :)


lonnieh(Posted 2005) [#35]
No biggie, its excellent as is :-D


Filax(Posted 2005) [#36]
MPacker released for blitzmax 1.14 ! update it :)

Note : Remove the old module version!


Tachyon(Posted 2005) [#37]
Huge thanks!


Cartman(Posted 2005) [#38]
Filax, Have you added support for the Mac for this? I love this tool, but I need it to fully work on the Mac as well. Last time I checked it only worked on Windows. Thanks


Filax(Posted 2005) [#39]
I have not compiled MPacker for mac because (there is a long
time) Mac version of Blitzmax was very bugged, but if you want
i'll try ! :)


Filax(Posted 2005) [#40]
Its good :) but i have not time to test the mac version !

http://www.blitzbasic.com/toolbox/toolbox.php?tool=136


Filax(Posted 2005) [#41]
I have tested ... It's the hell !!! Mac version
compile correctly but crash during execution ...

Blitzmax multi plaform ? hum :/ I don't know ...


Cartman(Posted 2005) [#42]
Thanks for trying. It's a great tool but since my game has to be cross platform I'll have to pass. It's too difficult to write separate code for encrypted and non-encrypted images.


Filax(Posted 2005) [#43]
I think recoding from 0 a new packer because blitzmax mac
seem to have problem with ZLib and the bank !

I have try :
To make the pak with PC version (work well) and read it with
mac version... Failed.

To make the pak with mac... Failed the pak is empty ...

Filax tired ...


nkertes(Posted 2009) [#44]
Hello ,

I am new to BlizMax ...
Can not Download mpacker.zip :-(
Have someone this again ...

Or other to pack all in one file ....

Have a nice day
nkertes


Nate the Great(Posted 2009) [#45]
if the link is dead try emaling the author.. but just incbin stuff if you can't contact him. its a whole lot easier


Grisu(Posted 2009) [#46]
You could also use a zip compression (with password).


nkertes(Posted 2009) [#47]
Now I have it !! Thanks for the tip of IncBin

Have a nice day
nkertes