Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » My game doesn't starts on any computer :(

This thread is locked; no one can reply to it. rss feed Print
 1   2 
My game doesn't starts on any computer :(
_mEck0
Member #7,650
August 2006

Hi, I'm a new member here and hope I post my question on the right forum.

I have a problem with my game, RallyCross, which I have developed with the DevC++ and allegro graphical library. The game only starts on those computers which have DevC++ and allegro installed :( I copied alleg42.dll to the game's directory, because otherwise I got a dialogbox that this file is missing. By the way, I have programmed this project using static dll-mode.

When I execute the game, then a dialogbox is appear and tells something like the program has been closed... Note that this is happening on a computer which don't have DevC++ and allegro installed. On another computer the game's splashscreen shows up, but don't the menu which should appear thereafter.

On the computer which I've programmed the game, it starts directly from this directory. In the RallyCross directory I have the exe-file, a readme-file and a save-file. There is also a subdirectory, graphics, where I have all the graphics which is used by the game.

I think some file is missing which should be in my game-directory, because it runs on any computer which have DevC++ and allegro installed, but if they don't have it, the game doesn't start...

I have also thought that my problem depends on some paths in my code. Because when I first started the game on a computer which don't had DevC++ and allegro, the game doesn't started at all, but after I changed my paths to the graphics, so they look like the example below, the splashscreen is appearing, but not the menu :(

Example how my paths look like in the code:
"Graphics/Splashscreen/load_2.tga"

But now I don't think this problem is because the paths, because as I wrote before, it starts on computers with DevC++ and allegro, so it's must be some file missing...

I would be very glad if some of you guys could help me with this problem and solve it, because this game I've programmed is a project in a course I've red and it must be working on any Windows computer! It's kind of a short premonition because I'm going to deliver a talk about the game now on friday!

Indeterminatus
Member #737
November 2000
avatar

Be sure to check the return values of Allegro's functions, like load_bitmap! They'll tell you the moment something goes wrong, which should help you get to the root of the problem.

_______________________________
Indeterminatus. [Atomic Butcher]
si tacuisses, philosophus mansisses

_mEck0
Member #7,650
August 2006

Okey, but how do I check the return values? I don't think I understand exacly what you mean.

Indeterminatus
Member #737
November 2000
avatar

Not checking return values:

BITMAP * bmp = load_bitmap(...);

/* Can you rely on the validity of bmp?
 * What if something went wrong in load_bitmap,
 * like the file couldn't be found?
 */
blit( bmp, ... );

Checking return values:

BITMAP * bmp = load_bitmap(...);

if ( bmp == 0 ) {
  // Oh noes! Something bad happened!
  allegro_message( "bmp couldn't be loaded!" );
  exit( 1 );
}

/* From this point on, we can rely on the
 * validity of bmp.
 */

The same applies for many Allegro functions, like initialization routines. Of course, above code is just to show what I meant, and can be highly improved with better logging and taking measures to somehow stabilize the game without need to abort it, but that's quite a job and also not always possible, so don't break your head over it.

edit: Of course, which functions return their success, and how to check their return values is documented in the Allegro manual.

_______________________________
Indeterminatus. [Atomic Butcher]
si tacuisses, philosophus mansisses

_mEck0
Member #7,650
August 2006

Ahh, now I understand what you mean! Thanks, I'm going to test it.

Richard Phipps
Member #1,632
November 2001
avatar

Read the manual, which documents error checking for many functions. :)

_mEck0
Member #7,650
August 2006

Indeterminatus: I checked the return values for all the images for my splashscreen and the image for my menu, but there wasn't any fault :( So, I presume that the program find all the images so far. I even tried to copy my project directory to another path and tried to check the return values from there, and it worked! What else could be wrong?

Richard Phipps
Member #1,632
November 2001
avatar

Quote:

I even tried to copy my project directory to another path and tried to check the return values from there, and it worked!

So, your program was in directory A and it didn't bring up any errors, and you moved it to directory B and it stll worked? Are you hardcoding the image locations (i.e. "C:\mygame\dira\" etc..)?

_mEck0
Member #7,650
August 2006

Quote:

So, your program was in directory A and it didn't bring up any errors, and you moved it to directory B and it stll worked? Are you hardcoding the image locations (i.e. "C:\mygame\dira\" etc..)?

Yes, so was the case. No, my paths don't look like this anymore, "C:\mygame\dira\" (first I accidently wrote my paths so, but then I changed), the now look like this:

BITMAP* load_2 = load_tga("Graphics/Splashscreen/load_2.tga",palette);

Graphics is the subdirectory of RallyCross.

Indeterminatus
Member #737
November 2000
avatar

Do you launch the game via Dev-C++ or via the shell?

_______________________________
Indeterminatus. [Atomic Butcher]
si tacuisses, philosophus mansisses

_mEck0
Member #7,650
August 2006

How do you mean by the shell? You mean the exe-file?
I've launched the game via DevC++ when I checked the return values, I compiled and then executed the game thereafter. This is the so called project dir with all the sourcecodes, headerfiles...

I also have a "game directory" with only the exe, a readme-file and the Graphics subdir. This dir is working on any computer with DevC++ and allegro but not on any others. I have also tried to copy my project dir to another computer, but it's not working.

-Doft-
Member #7,309
June 2006

I'm still a newbie, and don't know anything about distribution, but I was having a similar problem, and it was solved by debugging my project(F8). I don't even know what it does, but it worked, so I'm happy :)

_mEck0
Member #7,650
August 2006

Quote:

Doft: I'm still a newbie, and don't know anything about distribution, but I was having a similar problem, and it was solved by debugging my project(F8). I don't even know what it does, but it worked, so I'm happy :)

Okey, did you just press the debug (F8) and it fixed your problem? :) I'm going to test it now!

-Doft-
Member #7,309
June 2006

Well, after debugging it, it worked on my friend's PC... Hope it works for you too...

_mEck0
Member #7,650
August 2006

No, it didn't worked after debugging :( But I got two error dialogs:

The first has the title "Microsoft Visual C++ Runtime Library
Runtime Error!
R6034
An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information.

The second has the title "RallyCross.exe"
I translate this dialog because this came in swedish (my Windows is a swedish version, but the first dialog came in english ???).

It wasn't possible to initiate the program correctly (0x0000142). Click on OK to exit program.

EDIT:
Everytime I start a new allegro project, I must go on to project | project options | parameters tab | and add "liballeg.a" under the title "Linker". Maybe my allegro isn't correctly configurated with DevC++? Shouldn't DevC++ choose the linker automatically every time I start a new project?

I tried to start the game from the game-dir (the dir with only the exe, readme, savegame, graphics-dir and alleg42.dll), and it doesn't even start on this computer which I have allegro and DevC++ installed on! I got a dialogbox which says that the file "MSVCR80.dll" couldn't be found ??? But if I start the exe from the project-dir, it works correctly.

Samuel Henderson
Member #3,757
August 2003
avatar

Quote:

I got a dialogbox which says that the file "MSVCR80.dll" couldn't be found But if I start the exe from the project-dir, it works correctly.

.. Umm, Why is it trying to load MSVCR80.dll ? Have you had ANY allegro programs compile and run?

try this:

/*save this as main.cpp in a new Dev-C++ project.  Make sure it is a Win32 application and that your linker includes liballeg.a */
#include "allegro.h"

int main()
{
    allegro_init();
    allegro_message("All is well!");

}END_OF_MAIN()

Compile and build this. Then try running the .exe file

=================================================
Paul whoknows: Why is this thread still open?
Onewing: Because it is a pthread: a thread for me to pee on.

LennyLen
Member #5,313
December 2004
avatar

Quote:

By the way, I have programmed this project using static dll-mode.

What do you mean by "static dll-mode"?

Are you talking about the way you've built Allegro, eg. for static or dynamic linking? because if you are getting messages saying that alleg42.dll is missing, then you have built Allegro for dynamic linking.

If you mean the Project Type setting for Dev-C++, then there is a win32 static library type, or a win32 dll type, but not a static dll type, which would be contradictory. Either of these are not what you want anyway, you want to build a win32 console application.

Quote:

So, I presume that the program find all the images so far. I even tried to copy my project directory to another path and tried to check the return values from there, and it worked! What else could be wrong?

If you moved the entire directory, including the graphics subdirectory, then of course it's still going to find the images.

_mEck0
Member #7,650
August 2006

Quote:

.. Have you had ANY allegro programs compile and run?

Yepp, all allegro programs are running (those I execute from their project-dirs, which have all files in it, the source-files, header-files... but if I execute the program from the game-dir where I only have an exe-file, graphics-dir, save-file, readme, then it does'nt start).

I tried your test-snippet and it worked correctly and I've got the dialogbox telling me that everything is alright. I tried to compile and run (this executes the exe from the project-dir, and I've also tried to copy out only the exe-file to another place and started it from there and it also worked!).

Quote:

What do you mean by "static dll-mode"?

Are you talking about the way you've built Allegro, eg. for static or dynamic linking? because if you are getting messages saying that alleg42.dll is missing, then you have built Allegro for dynamic linking.

If you mean the Project Type setting for Dev-C++, then their is a win32 static library type, or a win32 dll type, but not a static dll type, which would be contradictory. Either of these are not what you want anyway, you want to build a win32 console application.

Yes exactly, I've chosen static linked when I created this project. I'm trying to create a new project now and choose static linked and then in project options choose win32 console (because now I have the "win32 GUI" marked").

EDIT:

I tried to create a new project and choose static linked, and pasted in my old code and in project options i choose win32 console. It worked to start the exe from the project-dir, and also if I copied only the graphics-dir and exe to somewhere else. Note that this was on this computer which I have DevC++ and allegro installed on. I tried to choose win32 GUI in project options (this is standard if you choose static linked), and it worked perfectly. The difference was when I've choosen console-mode, a console-box was appearing behind my game, and when I've choose GUI-mode, only my game was appearing and this is how I wanted it.

So, I've chosen "static linked" and as I wrote above it worked on this machine. BUT, when I've copied over the Graphics-dir and exe-file from the project-dir to another computer without DevC++ and allegro installed on, the game was searching after alleg42.dll ??? How could this be possible when I've chose static linked :o Anyhow, I copied the dll to the this directory and then it was searching for the MSVCR80.dll again :-[

EDIT2:

Could I send my project in a zip-file to someone who can fix my problem? Because no I'm heaving really huge problems because I copied my project-dir to my laptop (where I have DevC++ and allegro installed) and compiled and executed the game. The splashscreen started, the menu appeared and all menuchoices worked except the almost most important, when I press 1 for loading the track... for playing, the game crashes :'( If the game doesn't work on any computer, I must show my teacher the game on my laptop, but if it doesn't work on that eather, I have a huge problem :( So, please, can someone help me?

BAF
Member #2,981
December 2002
avatar

You need to not only choose static link in the IDE, but also use the allegro static link lib.

Victor Williams Stafusa da Silva
Member #4,212
January 2004
avatar

This may be a DLL-hell. Maybe some part of your project is using dynamic-linking and some other is using static-linking. This may also appear if you're using some third-party library based on allegro which is dynamic-linked while your project is static linked or vice-versa or something like "part A of project uses Allegro 4.2.0 and part B uses Allegro 4.1.17 (or whatever version)".

May be something related to a corrupt allegro installation. E.g. You could get a corrupt allegro installation if you compiled allegro with sources from different versions mixed. This may occur if you install an old version and sometime after that you try to overwrite their sources with a new version.

This could be too a problem about color depths. Is possible to get some "weird", "annoying", "nobody knows why", "only work on some computers" errors because of problems about color depth or making some assumptions about which video-mode or video resolution allegro would take.

[The attack of the space bugs - Speedhack 2005] [Rambananas - Speedhack 2006] [Make clean - Speedhack 2009] [The source god - TINS 2010]

piccolo
Member #3,163
January 2003
avatar

Try switching to MSVC++6 ill fix for you in an instance.

wow
-------------------------------
i am who you are not am i

BAF
Member #2,981
December 2002
avatar

How will using MSVC 6 help?

gnolam
Member #2,030
March 2002
avatar

It won't. But anything piccolo says can be safely disregarded.

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

Indeterminatus
Member #737
November 2000
avatar

Unless it's about his game.

_______________________________
Indeterminatus. [Atomic Butcher]
si tacuisses, philosophus mansisses

_mEck0
Member #7,650
August 2006

After I told this problem to my former programming teacher, the game is now working on my laptop and any other computer with devc++ and allegro installed. He told me that some resources were wrong. So the game is running and I can show it to my teacher today :) But it doesn't work on any other computers, but I'm glad it's working on the laptop so I at least can get a grade.

I'm probably going to uninstall DevC++ and allegro then, because all of these weird problems I've had. I think that something maybe went wrong in the installation process of allegro. I have also heard that DevC++ compiler etc. is kind of otherwise and sometimes weird.

So, I think I'll install Visual Studio 2005 Express instead and allegro to it, is it a good choice? As far as I know, the Visual Studio 2k5 Express is free to use? Is it so even for commercial projects? Is it free for anyone? And where can I download it (you've got a direct link)?

 1   2 


Go to: