Bennu Game Development

English Forums => Helpdesk => Topic started by: Imerion on October 18, 2009, 03:20:31 AM

Title: Releasing game with binaries and libraries included
Post by: Imerion on October 18, 2009, 03:20:31 AM
I recently finished a game made with Bennu which I want to put on my page for everyone to download. However, I would prefer if I could include the Bennu runtime and the modules/libraries with the game, so whoever download the game won't have to install the whole Bennu package in order to be able to play the game. Any idea how to do that? The most convenient way would be to simply include a folder called "Runtime" or "Lib" or something like that in which all Bennu files are located. But I don't know which files to include and how to make my program look for the files there. Simply using : import "lib\mod_x.so" doesn't seem to work.

Anyone who knows? I tried looking for examples, but found none.
Title: Re: Releasing game with binaries and libraries included
Post by: panreyes on October 18, 2009, 06:40:05 AM
What I do is to copy all of Bennu's files (core,externals,libs) to the project's folder, then I rename the bgdi to something according the dcb and then I use packator to get an EXE of everything.
http://www.pixjuegos.com/descargas/PakAtor.exe
Title: Re: Releasing game with binaries and libraries included
Post by: Sandman on October 18, 2009, 09:10:41 AM
Why not include the install?

The modules you want to import need to be in a folder in the PATH on Windows (or the same directory as the exe) and on Linux it needs to be in a folder in some other environment variable.
Title: Re: Releasing game with binaries and libraries included
Post by: Imerion on October 18, 2009, 01:52:15 PM
QuoteWhat I do is to copy all of Bennu's files (core,externals,libs) to the project's folder, then I rename the bgdi to something according the dcb and then I use packator to get an EXE of everything.
http://www.pixjuegos.com/descargas/PakAtor.exe

I tried this for the Windows version, and it worked fine. I have loads of files in the main folder, but I guess that is ok. It didn't work with the Linux version though.

QuoteWhy not include the install?

The modules you want to import need to be in a folder in the PATH on Windows (or the same directory as the exe) and on Linux it needs to be in a folder in some other environment variable.

Including the install would make the package quite big and would be rather unconvenient. I want it to be as simple as unzip and run and I really hate it myself when programs and games ask me to install all sorts of other things on my computer. With Fenix, all I needed to do was to include the interpreter and rename it to the same name as the dcb.
But how about pointing out where the libraries are in a start-script or something? The GP2X Wiz port of Bennu does that. Perhaps that can be done on Linux as well, since the Wiz is Linux based?
Title: Re: Releasing game with binaries and libraries included
Post by: Sandman on October 18, 2009, 02:00:16 PM
Sure is possible, just reuse that script. But if you ask me, I find an installer or even a link to the installer better, because you only have ONE Bennu on your machine this way (if everyone does it like this). You don't see Java applications have these problems, they just assume you have Java installed.
Title: Re: Releasing game with binaries and libraries included
Post by: Windgate on October 18, 2009, 02:40:49 PM
I always include the necesary DLL files in my projects, you can see how I do it if you download any of my tutorial-videogame-examples:

http://trinit.es/videojuegos/Videojuego%20Tema%204.zip

I solve it with a INCLUDE "import.prg" where I list all the IMPORT "mod_xxx" needed, the DLLs are loaded from a local folder that comes with the videogame.

I started programming Bennu by doing this...
Title: Re: Releasing game with binaries and libraries included
Post by: Imerion on October 18, 2009, 04:01:00 PM
QuoteSure is possible, just reuse that script. But if you ask me, I find an installer or even a link to the installer better, because you only have ONE Bennu on your machine this way (if everyone does it like this). You don't see Java applications have these problems, they just assume you have Java installed.

I tried reusing that script, but it didn't work. (See below). I can understand what you mean by only having one Bennu version installed. Problem is most people won't bother in that case i'm afraid. It is the same for me with Java. As you mention all java applications assume Java is installed. That is why I never use any Java-based software. To do that, I have to install a >100MB gigantic package, which I don't want to have installed on my computer since I never use Java myself otherwise. And if I remove that program, Java will remain and keep taking up space until I remove it as well.
If I remove a programs folder (or it's package) I want all files associated with it to be gone. Package's do this mostly, but not completely. Most Windows installers don't do that at all and leaves lots of stuff around the file system. Therefore, my favorite solution is to include all the files needed for the game in the games folder, so removing the folder will remove all traces of it.

QuoteI always include the necesary DLL files in my projects, you can see how I do it if you download any of my tutorial-videogame-examples:

http://trinit.es/videojuegos/Videojuego%20Tema%204.zip

I solve it with a INCLUDE "import.prg" where I list all the IMPORT "mod_xxx" needed, the DLLs are loaded from a local folder that comes with the videogame.

I started programming Bennu by doing this...

Thanks, that is just what I was looking for. It only worked for the Windows version though. Still can't get it to work in Linux. I made a script like this :

[code language="bash"]#!/bin/sh
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/Libs
PATH=$PATH:
Libs/bgdc Game.prg
Libs/bgdi Game.dcb[/code]

But it still tells me it cannot find the libraries.
Title: Re: Releasing game with binaries and libraries included
Post by: josebita on October 18, 2009, 04:38:05 PM
Quote from: Imerion on October 18, 2009, 04:01:00 PM
Thanks, that is just what I was looking for. It only worked for the Windows version though. Still can't get it to work in Linux. I made a script like this :

[code language="bash"]#!/bin/sh
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/Libs
PATH=$PATH:
Libs/bgdc Game.prg
Libs/bgdi Game.dcb[/code]

But it still tells me it cannot find the libraries.

Try this:

[code language="bash"]#!/bin/sh
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:Libs
PATH=$PATH:
Libs/bgdc Game.prg
Libs/bgdi Game.dcb[/code]
Without the slash.
Title: Re: Releasing game with binaries and libraries included
Post by: DCelso on October 18, 2009, 05:24:01 PM
To distribute your game in a standarlone linux version you need the next structure directories and files:

bgdruntime/bgdi
bgdruntime/jpeg.so
bgdruntime/libbgdrtm.so
bgdruntime/libblit.so
bgdruntime/libdraw.so
bgdruntime/libfont.so
bgdruntime/libgrbase.so
bgdruntime/libjoy.so
bgdruntime/libkey.so
bgdruntime/libmouse.so
bgdruntime/libpng-3.so
bgdruntime/libpng1.so
bgdruntime/libpng12-0.so
bgdruntime/librender.so
bgdruntime/libscroll.so
bgdruntime/libsdlhandler.so
bgdruntime/libtext.so
bgdruntime/libvideo.so
bgdruntime/libwm.so
bgdruntime/mod_blendop.so
bgdruntime/mod_cd.so
bgdruntime/mod_crypt.so
bgdruntime/mod_debug.so
bgdruntime/mod_dir.so
bgdruntime/mod_draw.so
bgdruntime/mod_effects.so
bgdruntime/mod_file.so
bgdruntime/mod_flic.so
bgdruntime/mod_grproc.so
bgdruntime/mod_joy.so
bgdruntime/mod_key.so
bgdruntime/mod_m7.so
bgdruntime/mod_map.so
bgdruntime/mod_math.so
bgdruntime/mod_mem.so
bgdruntime/mod_mouse.so
bgdruntime/mod_path.so
bgdruntime/mod_proc.so
bgdruntime/mod_rand.so
bgdruntime/mod_regex.so
bgdruntime/mod_say.so
bgdruntime/mod_screen.so
bgdruntime/mod_scroll.so
bgdruntime/mod_sort.so
bgdruntime/mod_sound.so
bgdruntime/mod_string.so
bgdruntime/mod_sys.so
bgdruntime/mod_text.so
bgdruntime/mod_time.so
bgdruntime/mod_timers.so
bgdruntime/mod_video.so
bgdruntime/mod_wm.so
bgdruntime/ogg.so
bgdruntime/SDL.so
bgdruntime/SDL_image.so
bgdruntime/SDL_mixer.so
bgdruntime/vorbis.so
bgdruntime/vorbisfile.so
bgdruntime/zlib.so
bgdruntime/zlib1.so

run_me.sh
Game.dcb

When Game.dcb is your dcb of your game
And run_me.sh is a script that has the next lines

#!/bin/sh
LD_LIBRARY_PATH=./bgdruntime:$LD_LIBRARY_PATH
PATH=./bgdruntime:$PATH
bgdi Game.dcb

You must put the original variable at the end of the line because if you would have another version of BennuGD installed in your system, the systen would use it instead your standarlone version of linux..
And you must put the directory in the path too. It causes that you can run it in any directory without the necessity to put the full path.
Title: Re: Releasing game with binaries and libraries included
Post by: Imerion on October 18, 2009, 09:29:52 PM
Now I got it to work! Thanks DCelso, that method worked fine. It also seems that I could not use the version packaged in the PPA. No idea why, but it wouldn't look for the libraries in any other place than the original. The version from this page worked all right though. josebita, you might want to take a look at your PPA. I believe I have the latest version of the packages, but the files are different somehow.
Title: Re: Releasing game with binaries and libraries included
Post by: Imerion on October 18, 2009, 09:31:54 PM
Seems I posted to fast. The downloaded version was RC10, the version from the PPA was RC8. Perhaps that is why the RC8 version didn't work but the RC10 version did. That feature was added later on. Anyway, thanks everyone for the help! Ill release the game soon if you want to try it.
Title: Re: Releasing game with binaries and libraries included
Post by: DCelso on October 18, 2009, 09:36:59 PM
You're welcome.
We will wait your game.
Title: Re: Releasing game with binaries and libraries included
Post by: Sandman on October 19, 2009, 01:52:35 AM
Quote from: Windgate on October 18, 2009, 02:40:49 PM
I solve it with a INCLUDE "import.prg" where I list all the IMPORT "mod_xxx" needed, the DLLs are loaded from a local folder that comes with the videogame.
You can also create a file called "game.import" or "game.imp" if your main prg is called "game.prg" and list the modules there.

Quote from: Imerion on October 18, 2009, 04:01:00 PM
I can understand what you mean by only having one Bennu version installed. Problem is most people won't bother in that case i'm afraid.
You can have multiple packages, catering to all the needs of your customers. A package for someone who has the Bennu VM installed (multiplatform), a package for Windows user, a package for Linux user.

Quote from: Imerion on October 18, 2009, 04:01:00 PM
It is the same for me with Java. As you mention all java applications assume Java is installed. That is why I never use any Java-based software. To do that, I have to install a >100MB gigantic package, which I don't want to have installed on my computer since I never use Java myself otherwise. And if I remove that program, Java will remain and keep taking up space until I remove it as well.
Are you serious you call 100MB gigantic? In these times of terabytes? Just to visualize it: you can fit 10000 of those Java installs on a 1TB drive. That's just an argument for the sake of having an argument. Secondly, if you use your method, you get a 100MB 'gigantic' file for every piece of software that uses it. Of course it's easier to just include it in the package, but don't come with an argument about space usage then.

Quote from: Imerion on October 18, 2009, 04:01:00 PM
If I remove a programs folder (or it's package) I want all files associated with it to be gone. Package's do this mostly, but not completely. Most Windows installers don't do that at all and leaves lots of stuff around the file system. Therefore, my favorite solution is to include all the files needed for the game in the games folder, so removing the folder will remove all traces of it.
Most Windows installers clean up the filesystem very nicely and ask if you want to keep any files. The Windows Installer system is a handy tool for making installers. It provides a safe (well relatively... it's still Windows) environment, tracks changes and can create restore points automatically. If a Windows Installer did not do this right, it is because the *creator* of the installer didn't do it right. This doesn't mean *your* installer has to be bad. Their use in amateur games is of course limited, so an archive containing the game suffices.

Well, I take it you're not a fan of a BennuGD.msi. Too bad really, I'm of the opinion it's the future. Maybe my views are too broad.
Title: Re: Releasing game with binaries and libraries included
Post by: SplinterGU on October 19, 2009, 04:47:46 AM
well 100mb is too much for me too.

cool msi, yes...
Title: Re: Releasing game with binaries and libraries included
Post by: josebita on October 19, 2009, 07:03:59 AM
The packages in the PPA are RC10 now, and should've been RC9 by when you posted. Have you updated your system lately?

Also, are you saying that the packages from the PPA don't work at all or that they didn't work for the kind of install you're doing?
Title: Re: Releasing game with binaries and libraries included
Post by: Imerion on October 19, 2009, 02:24:24 PM
QuoteThe packages in the PPA are RC10 now, and should've been RC9 by when you posted. Have you updated your system lately?

Also, are you saying that the packages from the PPA don't work at all or that they didn't work for the kind of install you're doing?

I did an update quite recently, but it seems the repository had been removed from my system for some reason. No idea how it happened, but it's fixed now. The packages worked fine all the time during development though, it was just this kind of install/packaging that did not work. (When I tried to put them in any other location than /usr/bin and /usr/lib).

QuoteYou can have multiple packages, catering to all the needs of your customers. A package for someone who has the Bennu VM installed (multiplatform), a package for Windows user, a package for Linux user.

Sure, that could work. As it is now though, those with Bennu already installed can simply remove the folder bgdruntime to run it with their installed version instead.

QuoteAre you serious you call 100MB gigantic? In these times of terabytes? Just to visualize it: you can fit 10000 of those Java installs on a 1TB drive. That's just an argument for the sake of having an argument. Secondly, if you use your method, you get a 100MB 'gigantic' file for every piece of software that uses it. Of course it's easier to just include it in the package, but don't come with an argument about space usage then.

Sorry, I was not trying to argue, just explain how I feel. I do think 100MB is quite a bit for something I don't use and it's not really the actual space it takes up that is the problem. I just don't want to have loads of stuff lying around that is not used. My system is already full of packages which has been installed at one point but the program that needed them is removed since long. I know apt-get can clean out unused packages, but sometimes I have to track them down myself too. But as you said, some people prefer the other way. A good solution, which would not require multiple packages would be to include a link to the runtime installer and instructions in the ReadMe. I think Ill do that.

QuoteMost Windows installers clean up the filesystem very nicely and ask if you want to keep any files. The Windows Installer system is a handy tool for making installers. It provides a safe (well relatively... it's still Windows) environment, tracks changes and can create restore points automatically. If a Windows Installer did not do this right, it is because the *creator* of the installer didn't do it right. This doesn't mean *your* installer has to be bad. Their use in amateur games is of course limited, so an archive containing the game suffices.

I know they mostly work well, but sometimes, when I still used Windows, they would not work at all or leave lots of files behind. Not to mention menu entries and stuff like that. True, it is the creators fault. But I still prefer to do things myself and arrange my files the way I want them to be. Just extracting an archive and run the included files still feels like the most convenient way.

QuoteWell, I take it you're not a fan of a BennuGD.msi. Too bad really, I'm of the opinion it's the future. Maybe my views are too broad.

I haven't heard about it or used it actually, which is probably because I don't use Windows. Also, msi files have been known to work quite badly in Wine for some time. But I believe that has been fixed now though, so I could try it out.

Please don't take this as an argument, but one more reason I prefer this way of packaging is that I know it will always work. If I don't include the runtime and everyone uses the latest version installed on their computer, there is a risk my game will stop working if some update later on changes something in the runtime. This has happened to me with other programs. It's not a problem as long as long as Bennu stays 100% backwards compatible, but just a small change could break some part of the game. I guess that is inevitable though, because some time the OS will change so the old binaries and libraries won't run and so on. But it's still an issue.
Title: Re: Releasing game with binaries and libraries included
Post by: Windgate on October 20, 2009, 11:36:01 AM
Could you put here a link where we can download a VERY SIMPLE example that could run on Windows and Linux without a preinstalled Bennu???

For example, a Hello World that use mod_text...

I could fix all my videogame examples in order to make it "compatible" with Linux too...
Title: Re: Releasing game with binaries and libraries included
Post by: Imerion on October 20, 2009, 02:20:21 PM
Here you go : http://www.mediafire.com/download.php?ydzvwunim2i (http://www.mediafire.com/download.php?ydzvwunim2i)

It includes both runtimes and scripts to compile and run each of them.
Title: Re: Releasing game with binaries and libraries included
Post by: Windgate on October 20, 2009, 09:05:14 PM
Tested on XP only... But it is OK and the .sh looks good too... I'll try it soon.

My idea is making all my examples compatible with Windows and Linux by this way, thanks.

And fell the karma Imerion, virgin no more ;D
Title: Re: Releasing game with binaries and libraries included
Post by: Imerion on October 20, 2009, 09:31:16 PM
QuoteMy idea is making all my examples compatible with Windows and Linux by this way, thanks.

Sounds great! Tell me if you need anything more, like testing or something. And thanks for the karma. :)
Title: Re: Releasing game with binaries and libraries included
Post by: Imerion on October 22, 2009, 08:45:46 PM
Sorry Windgate. I did some more testing, and it seems it doesn't work after all. The Linux .sh installer installed files in a different location than the repository packages did, so I was not able to make the program run as stand alone. It simply looked for the libraries in that other location instead. When I removed it, the game stopped working. I have tried so many things now I don't know what to do... I even compiled Bennu myself to see if it made any difference, but it didn't.

Does anyone have a working example of a stand-alone Linux app using the Bennu runtime in the way described in this thread?
Title: Re: Releasing game with binaries and libraries included
Post by: Windgate on October 22, 2009, 08:50:51 PM
Oh, I didn't try it on Linux :(

The Windows .bat has a problem... It makes a cd bgd_win, and all INCLUDES must have a ../ before their path...

I have modified the .bat in order to avoid changing the paths:

@echo off

bgd_win\bgdc.exe main.prg

pause

bgd_win\bgdi.exe main.dcb
Title: Re: Releasing game with binaries and libraries included
Post by: Imerion on October 22, 2009, 09:24:47 PM
Yes, that is a better solution. I didn't get it to work properly for some reason. But that might have to do with Wine.

Perhaps the problem is that the Linux binaries point to a specific place where it looks for the libraries which is hard-coded or somehow compiled into the binaries? This seems to be the case, since the .sh installer only looks for the files in /usr/lib/bgd and the repository packages only looks in /usr/lib/bennugd. Perhaps it can be compiled to look at the place where it is currently located instead?
Title: Re: Releasing game with binaries and libraries included
Post by: Windgate on October 22, 2009, 09:30:03 PM
I don't know dude, maybe Splinter would know about it... I'm a Linux N44B... :-[
Title: Re: Releasing game with binaries and libraries included
Post by: josebita on October 23, 2009, 09:09:02 AM
Imerion, please have a look at my karaoke package (here (http://code.google.com/p/bennugd-karaoke/))
Download it from the linux command line with:
[code language="Bash"]svn checkout http://bennugd-karaoke.googlecode.com/svn/trunk/ bennugd-karaoke-read-only[/code]

It contains all the binaries for Bennu RC8 inside a foler and a script to launch them.

PS: I also attacht the launch script:
[code language="bash"]
#!/bin/bash

CURDIR=$(dirname 0)
BINDIR=$CURDIR/bin
LIBDIR=$BINDIR/lib

export PATH=$PATH:$BINDIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LIBDIR

if [ -f main.dcb ]; then
   rm main.dcb
fi

bgdc main.prg
if [ -f main.dcb ]; then
   bgdi main
fi
[/code]

PS2: Paths to the libs are not hardcoded in any way. It's just that you must put the path to the libs into the $LD_LIBRARY_PATH environment variable.
Also, my script above will prefer an installed version of Bennu, if available. If you want to always use the bundled Bennu version, you should switch the order of the vars, like this:
[code language="bash"]
export PATH=$BINDIR:$PATH
export LD_LIBRARY_PATH=$LIBDIR:$LD_LIBRARY_PATH
[/code]

The directory in which the system looks for Bennu modules is specified in /etc/ld.so.conf.d/bennugd.conf (or another file in the same path with a similar name) for a global installation. Both the official Bennu installer and my PPA packages use this way to let the system now where the binaries are. The exact name of the file may vary, though.
If you open that file, it says (for me, the contents will probably vary in your installation):

# BennuGD libs support
/usr/lib32/bennugd


So now, the system nows that it should look for libraries in the usual paths AND in /usr/lib32/bennugd (there's where I keep my Bennu libs).
There should be more config files in that folder, for other apps.
But there's no need to use this mechanism -which requires you to install the program with root privileges- if you use a script such as the one

I hope this clears the situation a bit.

[Sidenote] If you modify that file, you must tell the system to update the list of available libraries, by either rebooting (discouraged) or running, as root the following code

ldconfig
Title: Re: Releasing game with binaries and libraries included
Post by: Windgate on October 23, 2009, 10:35:09 AM
So, it is possible?

Please, if anyone modifies the Imerion Hello World in order to have it running on Linux without a previous Bennu instalation...

I will change the .bat too, and INCLUDE will work now without prefixing all paths with ../
Title: Re: Releasing game with binaries and libraries included
Post by: josebita on October 23, 2009, 10:58:51 AM
Chnaging the helloWorld RunLinux.sh script to this works for me:
[code language="Bash"]
#!/bin/sh

CURDIR=$(dirname 0)
BENNUDIR=$CURDIR/bgd_linux

export LD_LIBRARY_PATH=$BENNUDIR:$LD_LIBRARY_PATH
export PATH=$BENNUDIR:$PATH

bgdc HelloWorld.prg
bgdi HelloWorld.dcb
[/code]
I suppose the only problem is that Imerion wasn't using export with the PATH and LD_LIBRARTY_PATH vars.

Also, please note that even if you'reusing export, the environment is only modified for the script, the rest of the system will remain untouched (after you run the script, the system will not find bgdc anymore).
Title: Re: Releasing game with binaries and libraries included
Post by: Imerion on October 23, 2009, 01:38:45 PM
Thanks josebita, this time it works for real! Adding export did the trick.
I understand the whole thing better now. I guessed they were not hard-coded, since different distros put things in different places. But /etc/ld.so.conf.d/bennugd.conf was the missing thing I was looking for. Perhaps you should put this in the documentation somewhere. (Or perhaps it already is, and I didn't look well enough.)

Anyway, thanks again to all who helped me with this. If you want to try the working game, it can be found here : http://neotron-games.blogspot.com/2009/10/railroad-rampage.html
Title: Re: Releasing game with binaries and libraries included
Post by: josebita on October 23, 2009, 07:04:42 PM
It's always nice to help. Sorry I didn't reply before.
I'll give a look at the game once I get some free time :)