Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Distributing Allegro 5 games

Credits go to AMCerasoli, Edgar Reynaldo, Matthew Leverton, and torhu for helping out!
This thread is locked; no one can reply to it. rss feed Print
 1   2 
Distributing Allegro 5 games
djchallis
Member #13,637
October 2011

My apologies in advance if this is an obvious/stupid question or if I've posted this on the wrong board. I'm an Allegro newbie, but I've done some Googling and forum-searching for a while and still can't come up with the answer so I thought I'd ask direct.

I'm currently making a game in Allegro 5 using Visual Studio 2010. I'd like to distribute an early version to a friend so he can test it, but it won't let him run the .exe file. I can run the .exe file on my own laptop as long as allegro-5.0.4-monolith-md.dll is in the same folder. On his computer it complains that it wants msvcr100.dll.

It appears to me that I'm dynamically linking to dlls and those will need to be distributed with the .exe when I distribute my game. From my research I've found that if I statically linked I could just send the .exe file with my resource folder (for images/fonts/sounds etc.) and that would work without any external dlls. Apart from not knowing whether what I've said this far is accurate or not, my problem is that I can't find anywhere that explains to me how to change from dynamic linking to static linking in Visual Studio 2010. There's lots telling me how to set up static linking on Code::Blocks, but I was originally advised to use VS2010 because I updating my game would be easier with that, but I now wonder whether static linking would remove that advantage anyway... I'm rather confused.

Put simply, my question is: what's the simplest, most professional way to distribute my game?
Should I use an installer for the finished game? (I've no idea how I'd do that)
Is there an advantage to dynamic linking that means I should stick with that, or should I switch to static linking?
If I should switch to static linking, how do I do that in Visual Studio 2010?
Once I've done that, do I just need to send the .exe & the resources folder, or will they still have to install Allegro or something else to make it work?

Sorry for the long newbie post.
Thanks to anyone who can help me out.

Matthew Leverton
Supreme Loser
January 1999
avatar

http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx

  1. Open the project's Property Pages dialog box. For details, see How to: Open Project Property Pages.


  2. Click the C/C++ folder.


  3. Click the Code Generation property page.


  4. Modify the Runtime Library property.

Switch from /MD to /MT. Link against an -mt version of Allegro.

msvcr100.dll is no longer required.

AMCerasoli
Member #11,955
May 2010
avatar

djchallis said:

what's the simplest, most professional way to distribute my game?

The simplest most professional way would be obviously a static link. distributing tons of dlls with your applications isn't professional.

Quote:

Should I use an installer for the finished game? (I've no idea how I'd do that)

That's not related with Allegro nor with Visual Studio. You should look for a free installer tool.

Quote:

Is there an advantage to dynamic linking that means I should stick with that, or should I switch to static linking?

If you were creating your application and your application includes some libraries made by yourself, I would say that a dynamic link would be good since you can send just that dll in case there is a bug. Now, that's only required in very big applications/games. But a dynamically linking Allegro or another library that you program uses as a core part of your game doesn't make sense.

Put the case that the developers find a bug in Allegro: A memory leak when destroying .wav audio samples. Since you're using .vorbis files, are you going to send the new library to all your users? no, because isn't affecting you, otherwise you would have realized that there was a bug when testing your application isn't?.

Or put the case that Allegro release a new version with a new feature that your game could use, like Allegro 5.1 with the Shaders addon which isn't available in Allegro 5.0.4. You can't just send the addon you would need to send the .exe with the corresponding modifications too.

So I recommend you to always use static link to the core libraries that your program uses, since are less likely to fail.

For more info:
Static_and_Dynamic_Link

Quote:

If I should switch to static linking, how do I do that in Visual Studio 2010?

I have no idea... I use C::B.

Quote:

Once I've done that, do I just need to send the .exe & the resources folder, or will they still have to install Allegro or something else to make it work?

There's nothing to install after a well done static link.

Peter Wang
Member #23
April 2000

The simplest most professional way would be obviously a static link. distributing tons of dlls with your applications isn't professional.

Rubbish.

Mark Oates
Member #1,146
March 2001
avatar

The most professional way to distribute your program would be to provide an installer.

The 2nd most professional way would be to have a downloadable zip file. Inside would be a readme.html file, a launcher exe with an embedded icon, and a folder containing all your game files, dlls if you have them, and the actual game exe.

3rd (which is what most of us have done) is to put everything in a zip, and not worry about creating a separate launcher exe or anything like that. Just let the gamer double-click program.

Rubbish.

qft

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Matthew Leverton
Supreme Loser
January 1999
avatar

I don't care if they are "professional." Installers for Allegro games are overkill.

Mark Oates
Member #1,146
March 2001
avatar

Exactly. Having an installer for an Allegro game is like putting on a tie and bringing a suitcase to an interview. There's really no point.

Haha, and in most cases the interviewee is slobbering all over himself. ;D

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Trent Gamblin
Member #261
April 2000
avatar

I think you're making a poor generalization of "all Allegro games". There are some that should have an installer. Most hobby games that are just handed around to other programmers obviously shouldn't though.

AMCerasoli
Member #11,955
May 2010
avatar

Rubbish.

You always so educated... What I said is my opinion and nothing more, and as I have said plenty on times in here, you're not going to change my mind and I'm not going to change yours. If you like to distribute your applications with tons of libraries do it, at the end it's not me or you who is going to decide which is better.

qft

Again, if that's your truth that's fine, go ahead and spread the word!.

Matthew Leverton
Supreme Loser
January 1999
avatar

Microsoft needs to add OS X like bundle support to Windows. That's the most professional way to distribute an application. Installers should only be necessary if your program actually needs to install something to the system.

There are some that should have an installer.

I understand that there's reason to cater to the computer novice, and if you think you've reached that market, then obviously you should use an installer. But at least offer a ZIP version for the sane people among us. :-/

SiegeLord
Member #7,827
October 2006
avatar

You always so educated... What I said is my opinion and nothing more, and as I have said plenty on times in here, you're not going to change my mind and I'm not going to change yours. If you like to distribute your applications with tons of libraries do it, at the end it's not me or you who is going to decide which is better.

Don't call it "most professional" then. Real professionals who make thousands of dollars on their games distribute tons of dlls with their games. How much money do you make of your games to qualify your approach an example of what professionals do?

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

torhu
Member #2,727
September 2002
avatar

Linking everything statically makes your game distribution look neat, but is usually more hassle for the developer. Libraries often come precompiled as DLL files, and it's useful to be able to swap DLL versions when testing. But as the average user doesn't look at what's inside the installation folder, it doesn't really matter. Firefox comes with a zillion DLLs.

AMCerasoli
Member #11,955
May 2010
avatar

SiegeLord said:

Don't call it "most professional" then.

I always forget that I'm talking with programmers here... :-/ I forgot to add IMH, so the SiegeLord compiler gave me an error of type;

error: /../../thread: line32: you forgot to say that it's your opinion. Alternatives are (IMH and then the text)

djchallis
Member #13,637
October 2011

Thanks for the quick replies, everyone. Before I go ahead and change to static link with those instructions, I had a couple of other questions.

The main advantage I can see for static links is that I don't have to try to work out which dlls I need to include with my game for it to work. But torhu says static linking's more hassle for me. Am I missing something?

Also there seems to be the impression that Allegro games don't ever make it big enough to be worth using an installer for. Is there a technical or legal reason why most Allegro games are just passed between hobby programmers, or is that just usually the case?

Matthew Leverton
Supreme Loser
January 1999
avatar

Given that the Allegro 5 binaries are all prebuilt with static versions, there's no hassle to you. The only thing you have to do is add #define ALLEGRO_STATICLINK to your project's build option.

Note that the -mt flag static links the C runtime. This is independent of whether or not you use the static Allegro libraries.

-mt removes the need to distribute the MSVC DLL
static removes the need to distribute Allegro DLLs.

And there's no reason that the average Allegro game sucks other than the average Allegro programmer lacks the skills, desire, or resources to create a professional looking game.

djchallis
Member #13,637
October 2011

Thanks for the reassurance there!

I've modified the runtime library to be /MT and I changed the additional dependencies in Linker->Input to be -mt, like you said in your first post.
I'm not sure where to put #define ALLEGRO_STATICLINK though.

Matthew Leverton
Supreme Loser
January 1999
avatar

C/C++ / Preprocessor / Preprocessor Definitions.

Just add ALLEGRO_STATICLINK to the semicolon delimited list. (No need for #define when you put it in your compiler options.)

djchallis
Member #13,637
October 2011

Thanks.
I've done that, but when I run the .exe file it says it can't find allegro-5.0.4-monolith-mt.dll. Does that mean I put the wrong dll into Linker->Input or that I messed up something else?

Matthew Leverton
Supreme Loser
January 1999
avatar

You need to link against the static version of that library.

djchallis
Member #13,637
October 2011

That would be allegro-5.0.4-monolith-static-mt.dll? I tried that and it wouldn't compile. It threw LNK2001 errors for all the allegro functions.
Sorry I'm slow at this.

Matthew Leverton
Supreme Loser
January 1999
avatar

When you static link you also need to add each Windows library that it complains about. There's probably a list around here somewhere, otherwise you can just search Google on the function name, click through to the MSDN documentation, and see what .lib file is needed.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

I think this is it, and that the order is correct as well.

dumb.lib
FLAC.lib
vorbisfile.lib
vorbis.lib
freetype.lib
ogg.lib
z.lib
gdiplus.lib
uuid.lib
kernel32.lib
winmm.lib
psapi.lib
opengl32.lib
glu32.lib
user32.lib
comdlg32.lib
gdi32.lib
shell32.lib
ole32.lib
advapi32.lib
ws2_32.lib

djchallis
Member #13,637
October 2011

Thanks for the list. I added it to Linker->Input->Additional Dependencies, but it can't seem to find any of the .lib files. Does that mean I need to add another directory to Linker->General->Additional Library Directories?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

djchallis
Member #13,637
October 2011

I got this list:

agl.lib
agld.lib
agld_s.lib
agl_s.lib
agl_s_crt.lib
alld.lib
alld_s.lib
alleg.lib
alleg_s.lib
alleg_s_crt.lib
allp.lib
allp_s.lib
comsupp.lib
comsuppd.lib
comsuppw.lib
comsuppwd.lib
delayimp.lib
libcmt.lib
libcmtd.lib
libcpmt.lib
libcpmt1.lib
libcpmtd.lib
libcpmtd0.lib
libcpmtd1.lib
msvcmrt.lib
msvcmrtd.lib
msvcprt.lib
msvcprtd.lib
msvcrt.lib
msvcrtd.lib
msvcurt.lib
msvcurtd.lib
oldnames.lib
ptrustm.lib
ptrustmd.lib
ptrustu.lib
ptrustud.lib
RunTmChk.lib

I'm not really sure if it helped yet. The compiler once again threw LNK2001 errors for every allegro command, which I can only assume is because allegro-5.0.4-monolith-static-mt.dll isn't the correct file to link against (it was changing that from the non-static version that caused those errors).

I also got a new error relating to one of the .lib files I added, which I can't make much sense of. It's printed below.

1>msvcrt.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in libcmt.lib(typinfo.obj)
1>msvcrt.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in libcmt.lib(typinfo.obj)

 1   2 


Go to: