Main Menu

PlayPackager (WIP THREAD)

Started by kevin, May 04, 2010, 04:21:51 PM

Previous topic - Next topic

kevin




 Visit www.PlayBasic.com


PlayPackager (WIP THREAD)



  This thread will contain update information/ideas/changes etc that are being made to PlayPackager application.  


What is PlayPackager?

     It's tool to help PlayBASIC developers bundle their PlayBASIC games or tools  into a self extracting executables for single file distribution.    The created packaged game will then automatically decompress the games media and execute upon being launched by the end user (the player).   Allowing the end user to run the game without needing to install,  or unzip/unrar it.  



Will It Packager protect my games media ?

     No.   If you're interested in this, then I strongly recommended reading the Improving Media Security (login required) article in the Developers Blog.



Features

    * Fast In memory & in place De-Compression
    * Very low memory foot print
    * Virtually zero execution overhead
    * Compatible with PlayBASIC
    * FREE FOR PLAYBASIC RETAIL users .




Beta (Work In Progress) Downloads


     None.



Related Articles


     * PlayBASIC V1.64O Includes Media Binding (loading media from memory)


kevin

#1
 
PlayPackager V0.03 - Building A GUI Console


     While this application has only been under development for a few days now,  the core functionality is already in place and would appear to be stable.  All that stands in the way of a release now (as always) is setting up a simple user interface and building a version of the package.    

     Like all in house PlayBASIC helper tools, the PlayPackager compiler is being built in PlayBASIC.    While there's various custom & windows gui  options for PB, I tend to prefer building everything in PB wherever possible.  It just removes external dependencies.   For this tool, we really don't need too much in the way of GUI.   A menu and a console window.     The menu stuff is easily covered as is the console really, but i've always wanted to build little console library with some simple hyper text support.  So that's what I thought i'd have a little go at.

    The library is pretty simple  and at this point it just allows the user to create various consoles then output text to them.    The library itself handles the data management.  You just create a console, the  use cprint("Text")  to drop something into it.   In the current version rendering is separated from the printing.   This is helpful when drawing to a surface with backdrop picture for example.

     The only interesting thing about the lib at this point, is that the render console supports some simple hyper text tags in the output text.   While there's only a few of them currently  (Ink,Shadow,HR, UnderLine, it should help the making the displayed text copy (when in PlayPackager) be both a little more visually appealing, and easier to notice any ERROR messages.  

      Anyway, bellow is piccy of console view with some various overlaps tidbits..   Since it's really just some text on the screen.. real 1980's stuff :)

   
    This is the demo code, without the console library.   The demo code mainly cut and pasted from source code board examples.

PlayBASIC Code: [Select]
   loadfont Path$+"Fonts\Arial20.crf",1,0,0
FontDrawMode 1,1

loadfont Path$+"\Fonts\Arial36.crf",2,0,0
FontDrawMode 2,1

Tempimage =LoadNewAfxImage(path$+"gfx\PlayBasicSig.png")
ScaleImage TempImage,0.75,0.75,2
Global Image_PBLogo_original =Make_Mirror_Image(TEmpImage,60)
Global Image_PBLogo =GetFreeImage()
CopyImage Image_PBLogo_original,Image_PBLogo


global Screen =Newfximage(800,600)
global BackDrop =Newfximage(800,600)

w=792

// Colours
c1 =rgb(51,53,74)
c2 =rgb(50,100,150)
c1=rgbfade(c2,70)
c2=c1

// Console Screen View port
BoarderRadius=32
BoarderWidth=800

global IMage_Console_Backdrop =MakeBorderedBox(w,580,BoarderRadius,c1,c2)
global IMage_Console =MakeBorderedBox(w,580,BoarderRadius,c1,c2)

rendertoimage Backdrop

c1= rgb(50,100,200)
c2= rgb(50,200,100)
c1=$00203040
c2=$004060a0
shadebox 0,000,800,300,c1,c1,c2,c2
shadebox 0,300,800,600,c2,c2,c1,c1

Xpos=(GetScreenWidth()-BoarderWidth)/2
Xpos=4

rendertoimage IMage_Console
ThisImage=IMage_Console
r=BoarderRadius*0.75
w=getImageWidth(thisImage)-r
h=getImageHeight(thisImage)-r
ImageViewport Thisimage,r,r,w,h

// Create a scroller
NewScroller()


rendertoimage IMage_Console_Backdrop

ink argb(128,100,100,100)
setfont 2
centertext 660,520,"Text Console:"



setfont 1
SetFps 50

RefreshScroller=true


xx=850
xx2=xx*2

Do

if RefreshScroller=true
copyrect IMage_Console_Backdrop,0,0,1000,1000,IMage_Console,0,0
RefreshScroller=false
rendertoimage IMage_Console
DrawScroller()
endif

rendertoimage screen
Drawimage Backdrop,0,0,false

Scale#=1.5+CosRadius(Angle#,0.7)
Angle#=wrapangle(Angle#,2)

DrawZoomedImage(IMage_Console,400,304,Scale#)


if spacekey() or rnd(1000)>990
; set default ink colour
ink $c0808080 ;aaaaaa ;ffdfdf
Select rnd(5)
case 0
sprint("Normal 'Hello World' text")
case 1
sprint("[ink=$ffFF0000]Some Red Text [ink=$ff00ff00]Green Text")

case 2
sprint("[ink=$ffff0000][hr=2]")

case 3
sprint("This is a line of underlined text")

case 4
sprint("[shadow=1]This is a some [ink=$ffff00ff]shadowed text")

case 5
sprint("[ink=$ffFF0000]Red Text[/ink] Default Text Colour [ink=$ff00ff00]Green Text[/ink] and some [ink=$ff0000ff]Blue Text")


endselect

RefreshScroller=true
endif
ink $ffffffff


Count=Mod(Count+1,3)
if Count=1
CopyImage Image_PBLogo_original,Image_PBLogo
BlurImage Image_PBLogo,8+cosradius(blurangle#,4)
BlurAngle#=Wrapangle(BlurAngle#,20)
endif

DrawTintedImage(Image_PBLogo,xx,200,2,$a0ff8f8f,1+8)
xx-=2
if xx<-1000 then xx=1000

rendertoscreen
drawimage screen,0,0,false

Sync
loop





Function Make_Mirror_Image(ThisImage,MirrorSize)
if GetImageSTatus(ThisImage) and MirrorSize >0
OldSurface=getsurface()

Width =GetImageWidth(thisIMage)
Height =GetImageHeight(thisIMage)

MirroredIMage=GetFreeImage()
CreateFXImageEx MirroredImage,Width,Height+MirrorSize,32
Login required to view complete source code



 

kevin

#2
 
PlayPackager V0.03 - Connecting it Together


     Since yesterdays update,  i've been merging the various bits of code into what will be come the PlayPackager tool.  There's really nothing to it from the users perspective at this point.  You run the app, then select 'build' and that's about it.     Currently the build path  is hard coded to a folder on my computer (so i don't have to constantly select it), but this will open up a folder dialog.  

     I'm in two minds actually.  The user could select the game exe directly.  From here the app could assume that the folder the exe is within is the games base folder.  So it'll archive this folder and anything within it.    While this would work for the majority of situations, there are occasions, where you might not want the exe stored in the root.  If this occurs, it'll fail.  

    The other option (and how it currently works) is that you supply the packager with the root folder of the project.   The app then archives everything inside/bellow it, the only difference is that the packager app chooses the games EXE for you.    So EXE can then be in any folder within this tree.   But there's a problem with this also.   What if the games folder structure has more than one exe file in it ?   Which one does it choose ?  - Well currently if that occurs, it'll fail :)

    The packager is designed so that you can build your packaged exe directly from your game projects source folder (as long as you store all of your games media in that location!).    So all you have to do is open your game in PB, compile this to an exe.   Then run the packager and select the games file/folder.   Don't worry,  the packager will completely ignore your SOURCE CODE / projects files and thumb nail files automatically.  


    Anyway,  here's the first amazing screen shots of this app up and running, (Yes that's sarcasm people ! ) -  it looks more like a demo at this point since the console window zooms in and out and the PB logo is scrolling across for absolutely no reason at all...   But ya get :)

kevin



PlayPackager V0.05 - Up & Running


    Today, i've been tweaking up the packager application.  Functionality wise, it's changed a little bit. Mostly to help users overcome the aforementioned catch 22.  The solution has been to give the user the option to not only select the Projects parent folder, but any EXE inside that folder which is to be the launched application.   This means the package can include more than one exe if need be.   The thinking here is for people wanting to distribute not just the game, but perhaps an editor also.

    Another change is that you now specify the output file separately from the build process.   The reason for this will the addition of the some exlusion filters.    These will allow you to exclude certain files from  being included in the output.  The exclusion list will be saved in the projects folder.  So you won't have to create the list each time.   

    Anyway,  will no doubt upload a build of the package for testing over the weekend

 
 

kevin

#4
 PlayPackager V0.06

     Well, here's the first alpha of the package.  I haven't had a lot of computer time over the past couple of days, so it's not too dissimilar than it was when i last posted.    The main thing missing (apart from the some real world testing) would the exclusion list support.    


Download
   
  Download Play Packager V0.06 (alpha)  10th,May,2010  





LBFN

It compressed a 2.38 MB .exe to about 1.3MB for me.  I moved the compressed .exe to my desktop to test it and it worked fine.

kevin


Thanks.  Just out of curiosity is there many media files in your package ?

LBFN

Quote from: kevin on May 10, 2010, 07:59:06 PM

Just out of curiosity is there many media files in your package ?


There are 19 images that are included in the package.  All are .bmp format. No sound media at all.

kevin


PlayPackager V0.07

     Today's been the first day all week, I've had any time to do some PB related programming.    So i've been tweaking up the build/launch process a little more. As a result, the packager will only work with PlayBASIC V1.64 exe's for the time being.  Which is really not a bad thing, given it's a freebie for PlayBASIC community after all.    None the less i'll try and get a new build up on the site over the weekend.   

kevin

#9
 PlayPackager V0.07

     Here's the second release for community testing. There's a number of small fixes/tweaks, one major change is that this version is designed for use with PlayBASIC V1.64.    So it'll only package exe's built the PlayBASIC V1.64 at this time.  



Download

    OLD FILE REMOVED


kevin


PlayPackager V0.08 - Exclusions ?

     I've been working on the adding the exclusion list feature this afternoon, like a lot of things, rolling the code to handle the internal list and do the matching was pretty straight forward.  That's not what  worries me though,  as often the underlying routines within an application are simple, it's building the interface for the user that actually gets in the way.   

     The exclusion list currently has two modes, by filename or by file type, there's a folder option partly embedded also, but that can be plugged in later. The original thinking was the just add some dialogs so the user could type or multi select from the open dialog.  But there's an issue with that features in the dialog library,  so that's out of the question.    Entering a file names by hand isn't much fun either.    So it's look like i'll have to roll something out.   Probably just a file listing of the project folder where you click on the opt out files or something.     I figure with a little tweaking the console lib be used for this purpose.   Dunno, prolly just wing it :)


   

LBFN

I would like to help provide some feedback on this, but I am getting the 'Couldn't locate linker' error when I compile and I cannot find an .exe on my computer anywhere.  I searched the forum about this problem, but I don't see a resolution.

kevin


Sounds like you've failed to install an update correctly....

LBFN

I have tried twice to re-install the PBFX 1.76 update.  I moved all of the files from it to replace the existing files, but I get the same error.

kevin


The upgrade process is listed here.   Install base edition, the install upgrade over it.

PlayPackager can not be used with PBFX ..