Zip and Packing Assets for Minib3d

BlitzMax Forums/BlitzMax Programming/Zip and Packing Assets for Minib3d

RustyKristi(Posted 2016) [#1]
I'm currently playing around with incbin and it's really cool to have an embedded solution for a game/app.

I was thinking if there is an existing zipped solution or mod, as I would like to separate my asset files and don't want my exe to be one big file.


Endive(Posted 2016) [#2]
Can you explain a little more?


RustyKristi(Posted 2016) [#3]
Hey Endive, this is related to packing and publishing your files. So when you distribute your game/app, you can structure it like this:

/MyGame.exe
/Textures.zip
/Data.zip
/Assets.zip


I'm also looking for Cower's PhysFs mod but I can't find any working link :(


therevills(Posted 2016) [#4]
Maybe this will help:

http://www.blitzmax.com/codearcs/codearcs.php?code=2559


dw817(Posted 2016) [#5]
Rusty, if you are referring to doing your own compressions inside BlitzMAX, there are three commands built directly inside the language called:

Compress, Compress2, and Uncompress.

To my knowledge, the data it compresses is just as small as PKZIP/WinZIP will do.

Let me know if this is something you want to pursue and I'll try to help you if I can as I'm quite familiar with how these commands work.


dw817(Posted 2016) [#6]
Rusty, if you are referring to doing your own compressions inside BlitzMAX, there are three commands built directly inside the language called:

Compress, Compress2, and Uncompress.

To my knowledge, the data it compresses is just as small as PKZIP/WinZIP will do.

Let me know if this is something you want to pursue and I'll try to help you if I can as I'm quite familiar with how these commands work.


xlsior(Posted 2016) [#7]
Koriolis' zipstream module lets you load assets from a zip file. (It's also compatible with incbin, so you can incbin the zip file into your blitzmax program if you so choose)


RustyKristi(Posted 2016) [#8]
Thanks dw817. I'm trying to use minib3d so this will include models and textures. Can you give a simple example or where can I find one?

@xlsior
Reading this old thread response from Kippykip, is it compatible with minib3d?

ZipStream appears not to work with minib3d when using loadMesh etc..


http://www.blitzbasic.com/Community/post.php?topic=71734&post=1211775


dw817(Posted 2016) [#9]
I can't help you with 3D graphics, that is definitely something I can say, "I don't know."

As there is still quite a bit about BlitzMAX I have yet to understand.

But compression of data, like you are zipping it, I can do fairly easily. Here are some functions I wrote to get you started.







Also, here is the FROGGY image if you want to use it and compare byte size before and after compression. It is a JPEG so to be able to compress a JPEG even smaller is a pretty amazing feat, and this code does that.


RustyKristi(Posted 2016) [#10]
@therevills

will that work with loading 3d models in minib3d? I should have made the subject more clear.

thanks dw87. Yes, I'm more particular in packing up my assets so they are more organized not all over the place, but I also have some interests in having good compression so it will be faster to download.

Edit: Subject Updated


dw817(Posted 2016) [#11]
Glad to help. And yes, it does seem like the average game these days has many MANY files. Quite a bit different then when I was growing up - it was essential it seemed for game authors to cram everything down into one encrypted and compressed EXE.

That was the merit badge.

Those days are gone now it seems. Ah well. :)


therevills(Posted 2016) [#12]
@therevills

will that work with loading 3d models in minib3d? I should have made the subject more clear.


Looking at the code it should work for any file.


RustyKristi(Posted 2016) [#13]
Thanks therevills. I have tested that the code and it works well, with Filax's version it's more efficient but the point of zipping assets for a game is not to unpack and write in file. I was thinking more of unpack and load directly to the game, without any cache or file writes. This is similar using incbin (i think), without the exe attachment.


therevills(Posted 2016) [#14]
So streaming into memory then...

Maybe this module then:
http://www.blitzmax.com/Community/posts.php?topic=71734


dw817(Posted 2016) [#15]
Therevills, the site: "http://www.koriolis-fx.com/" is not even active anymore. Because what you are saying is of interest to me too.


therevills(Posted 2016) [#16]
Further down that thread is another link:
http://retroremakes-framework.googlecode.com/svn/trunk/modules/koriolis.mod/

(I've never used this mod - I think I would be paranoid with the amount of RAM it would use - LOL!)


dw817(Posted 2016) [#17]
Thanks Therevills, I'm going to look this over.


xlsior(Posted 2016) [#18]
Therevills, the site: "http://www.koriolis-fx.com/" is not even active anymore. Because what you are saying is of interest to me too.


Brucey adapted a version of Koriolis' module that's compatible with blitzmax-NG, which can be found here: https://github.com/maxmods/


dw817(Posted 2016) [#19]
Also good to know, Xlsior. Brucey is a coding genius, I'm poring over his work - exceptionally good, but also complex to understand.


Midimaster(Posted 2016) [#20]
I suggest to use KORIOLIS ZIPSTREAM. I use KORIOLIS in all my commercial projects to have only one file . And it always works reliable and as expexted.


RustyKristi(Posted 2016) [#21]
Thanks guys. I was wondering how would you go about and use zipstream and minib3d to load a mesh and sound in a zip file?

I'm only seeing that it only works with textures in minib3d..


RustyKristi(Posted 2016) [#22]
I was hoping that there's probably something similar with Blitzmax like this one:

http://www.blitzmax.com/Community/posts.php?topic=69315


Midimaster(Posted 2016) [#23]
Koriolis zipstream works perfect with minib3d.
from one of my projects:
SuperStrict
Import koriolis.zipstream 
Import sidesign.minib3d

?Win32
	Import "icon.o"
?

Incbin "tt1.zip"
DatenPfad$="ZIP::Incbin::tt1.zip//"

Global ImagePfad$=DatenPfad
Global SoundPfad$=DatenPfad 
.....
		Tisch=CreateCube()
		ScaleMesh Tisch, 7.5,0.6,7
		PositionEntity Tisch,-0.5,-1.1+0.45,5
		Local Holz:TTexture=LoadTexture(ImagePfad + "buche.png")
		EntityTexture Tisch,Holz


Global Sounds:TSound[25]
....
		Sounds[2] = LoadSound(SoundPfad + "bing.png")



Yue(Posted 2016) [#24]
Where download mod zipstream?


xlsior(Posted 2016) [#25]
Brucey has a port that's fixed bot Blitzmax NG on his githug page:

https://github.com/maxmods

(Koriolis.mod)


Yue(Posted 2016) [#26]
@XLSIOR
Thanks :) I have a question if it works with version 1.50 of BlitzMax ?


RustyKristi(Posted 2016) [#27]
I have checked this again, it works and doesn't throw errors but it does not work with meshes only textures and probably sounds as Midimaster pointed out.