Where do I put my .dat files?
DJLad16

I've recently added some .dat files to my game to store the coords of my enemies and coins, it all works fine when I'm working on it.
The problem is that the game bugs out when once I've installed it on my machine. I'm using advanced installer, and I'm not sure where to place the files. I've tried placing them where the game itself is, but that didn't work. It also didn't work placing the files where my sprites are. So where do I place them?
(Sorry if I'm not clear enough, I wasn't sure how to explain this)

StevenVI

If they're in the same place as your sprites, and the sprites load yet the data files do not, are you specifying the paths differently when loading them?

Make sure that your installer is setting the "working directory" for the app's shortcut to the same path that it is installed in. It looks like it's called "Start in" in Windows 7. Been a while since I even thought about that sort of thing. :P

Dizzy Egg

Yeah, what Steven said!

Basically the folder where your game runs whilst you're working on it will probably be very different to the folder it runs in when you install it!

So you have to use a function to get the working directory as a string, so you can use something like this pseudo code load_dat_file(workingDirectory + "/datafiles/mydatfile.dat"). There is a way to do this using allegro, but I'm not going to tell you how, mainly because I can't remember ATM.

Neil Roy
Dizzy Egg said:

So you have to use a function to get the working directory as a string, so you can use something like this pseudo code load_dat_file(workingDirectory + "/datafiles/mydatfile.dat"). There is a way to do this using allegro, but I'm not going to tell you how, mainly because I can't remember ATM.

workingDirectory = al_get_current_directory();

LennyLen

It's good to see you were able to get loading your data from a file working. Just in case you weren't aware - you don't have to use the .dat extension on your files. I just used that with the code I sent you to as an example.

Arthur Kalliokoski
NiteHackr said:

al_get_current_directory()

Isn't the OP talking about Allegro 4?

LennyLen

Isn't the OP talking about Allegro 4?

No.

Thread #612302. Printed from Allegro.cc