Relative paths can be difficult to get your head around at first, but I'll try and explain it in simple terms...
OK, imagine the following file and folder structure on your hard disk:
GFX File Located In:
C:\Data\DB\Graphics\Background1.jpg
DB Project Directory:
C:\Programming\Dark Basic\DBC\Projects\MyGames\Pong\
And in your program you have:
Load Image "C:\Data\DB\Graphics\Background1.jpg",1
This is a
full path as it includes the drive letter and all subdirectories. If you give a normal exe (not a Build Final exe) of your program to someone else, Background1.jpg has to be on drive C: in that exact location for it to be found by your program. The chances are it's not, so your game will only run on your computer.
So, you use Build Final to include the image in your exe - but it still doesn't work. Why?
Well, your program is still trying to access the image using that specific path - even though it is now built into the exe. It still works on your machine because you still have the original image in the correct location...
With Build Final, think of your exe being turned into a new virtual hard disk drive with the root (C:\) being the current project folder - in the case of the above path example, the 'Pong' directory.
In this situation, the Projects folder (or anything before it in the path) does not exist.
However, any folders in the Pong directory will be sitting there on the 'virtual drive' - along with anything on them.
So, you create folders inside the Pong directory to hold all your media files and
copy them all over, changing the Load commands to access the media in the folders within the Pong directory.
But, Build Final still doesn't work!
This is because your Load commands are still pointing to specific folders with full paths. Don't forget, your game exe might be run from
C:\Games\Pong so:
Load Image "C:\Programming\Dark Basic\DBC\Projects\MyGames\Pong\Images\Background1.jpg",1
...isn't going to find that jpg image like it does when running it on your machine!
This is where 'relative' paths come in.
Take the path:
C:\Programming\Dark Basic\DBC\Projects\MyGames\Pong\Images\
If your dba file is in the Pong folder then the Images folder can be accessed directly - without all the preceding C:\ and all those folders. So, loading the image just needs:
Load Image "Images\Background1.jpg",1
As it's relative to the 'root' (the Pong folder in your exe), it doesn't matter where the exe is run from on another machine, the Images folder is always available.
You just need to do the same thing with everything that is loaded off disk.
Hope this helps clear up the confusion.
TDK_Man