A Lil Help On An Aggravating Problem Please...
Miscellaneous Forums/General Discussion/A Lil Help On An Aggravating Problem Please...
... how do you guys resolve your media directory, and file structure for any other essential folders that must be linked to your app?
for example... if the final exe expects the media in appdir\media folder, it seems as if i've got to set the reference to it in the app... but i must have the media also somewhere in the Blitz3d\media folder, so that i could access it while running the app from the ide, during development and testing...
how do you guys/gals deal with this... and what am i missing here...
thx again...
--Mike
I'm not sure I understand the problem.
You're using blitz3d yeah? The media should be relative to the source files. That's it. I've never put anything in the blitz3d\media folder.
yeah Indie... i'm using that already... but during development, the ide runs the app from the Blitz3d\bin directory... where your source file resides doesn't seem to be relevant...
now, i understand that there are some implicit path associations that Blitz makes when running thru the ide, but when i wrap the app for distribution, keeping a media folder relative to the app dir, this falls apart...
example blitz3d\projects\mygame\media
projects\mygame is the app dir, and will default to wherever the user places it... and projects\mygame\media is where the media resides...
during development Blitz doesn't see projects\mygame\media at all, so something like loadmesh("../media/mymesh") in the program will look for Blitz3D\media to find the mesh...
right... wrong...
ok, now, when you're ready to compile for distribution, and you include a media folder in the app folder for distribution... the exe doesn't know about ../media, and loadmesh("../media/mymesh") results in an error...
right now i've got the code set to define the homeDir when i'm developing, and get the homeDir during runtime of the final exec... i was just wondering if i'm missing something and am thoroughly confused...
--Mike
You're way overcomplicating this. If the app is in blitz3d\projects\mygame\ then make all paths relative to that folder.
If a texture called mytexture.png is in blitz 3d\projects\my game\some textures\
then just load sometextures\mytexture.png
You don't need anything else. Blitz does the systemproperty appdir stuff automatically now. It will find the texture whether you're in the IDE, or not, debug or release. It's all the same.
then make all paths relative to that folder.
i'm lost... what do you mean... how do i do that G...
--Mike
I don't recall ever having this problem. Maybe you should refrain from calling ChangeDir SystemBlah(boop) and see if that does anything?
so something like loadmesh("../media/mymesh") in the program will look for Blitz3D\media to find the mesh...
right... wrong...
WRONG
None of my projects are even in the Blitz3D folder...and I don't use anything more special than just referencing files relative to where the executable will be (as Gabriel said).
You should only use the "ChangeDir SystemProperty("appdir")" line when building an exe. REM the line out while running in the IDE.
that's what i'm doing right now...
.SET_APP_PATH_HERE ; ALL MEDIA AND DEPENDENT FILES SHOULD REFERENCE THE GAME'S HOME DIRECTORY
;
;-------------------------------------------- USE THIS LINE WHEN DEVELOPING AND TESTING IN THE IDE ;
this\System\HomeDir="c:\progra~1\blitz3d"
;
;-------------------------------------------- USE THIS LINE WHEN COMPILING THE FINAL EXE
;this\System\HomeDir=SystemProperty("appdir")
;
;------------------------------------------------------- COMMENT OUT THE UNUSED LINE ABOVE
;
; DURING DEVELOPMENT AND TESTING, THE DEFAULT BLITZ3D\MEDIA FOLDER CAN CONTAIN YOUR MEDIA FILES
; WHEN COMPILING TO A FINAL EXE, A COPY OF YOUR MEDIA FOLDER MUST EXIST IN THE GAME'S FOLDER
ok.. thanks guys...
the problem was having is with the final deployment... the code above has everything working right, but it seems that the packing app i'm using is a lil demanding about this... until i appl;ied this code, nothing that was working normally before worked on the deployed exe...
thx again for the help...
--Mike
You dont need changedir AT ALL.
When you run your game from the IDE or when making an exe the default directory is the directory that the .bb (when launching from IDE) or .exe (when building an exe) file is in.
So if I have a folder called "Gfx" I can access files within simply by prefixing "Gfx\" before my filenames, I then put the Gfx folder in the folder with my .bb files, which is also where I build my .exe's too.
When making a distro I simply archive up the project folder and remove the .bb files along with the thumbs.db files from the final zip.
You dont need changedir AT ALL.
Yes you do, when launching from a shortcut.
Yes you do, when launching from a shortcut.
No you don't. You used to, but not in recent versions.
i'm lost... what do you mean... how do i do that G...
Like the example I gave. Assume the program is beginning from where your exe is located. Think of the path as a journey from where the exe is to where the file you're loading is. The exe is ( for example ) C:\Blitz3d\Projects\My App\App.exe
So the program begins from C:\Blitz3d\Projects\MyApp
So if you want to load a file which is called C:\Blitz3d\Projects\MyApp\Resources\Textures\MyTexture.png
Just Load "Resources\Textures\MyTexture.png"
You leave out everything before that because the app is already there before it begins. With me?
Forget all your HomeDir stuff, you don't need it. And forget ChangeDir too, because Blitz3d was updated so you no longer need to that any more either.
No you don't. You used to, but not in recent versions.
Well, I have the latest version (1.94) of Blitz3D and I still get a MAV when launching from a shortcut without the ChangeDir line.
[edit] My mistake, it does work. It would have been nice if we were informed about this.
i'm still on 1.87... when did they release the latest update!!???
:)
thx again people...
--Mike
[edit] My mistake, it does work. It would have been nice if we were informed about this.
Yes, come to think of it, you're right. They never did tell us about this change.
Mike, I would avoid 1.94, it's buggy. I think 1.91 is the latest stable version.
I used to have this problem, but I just used my preprocessor.
#IfDef CREATINGEXE
ChangeDir SystemProperty( "appdir" )
#EndIf
Nice, MR. I miss (coming from C) having preprocessor directives. However, as Gabriel says, this is no longer needed. :)
Off topic: big10p, I see youre still using 1.94- Remember theres a memory leak in it- FREE commands don't free anything.
I reccoment going back to 1.91
thx G... yeah, i really have to update...
--Mike
> yeah, i really have to update...
Your keyboard drivers?
Damn, I'll have to go back to using 1.91 too - sniffage. I might even rename the file to 2.00 and own all of you.
Off topic: big10p, I see youre still using 1.94- Remember theres a memory leak in it- FREE commands don't free anything.
Yeah, I know about the mem leak on images but are you saying NONE of the Free commands work (FreeBank, FreeEntity etc)? :/
Trouble is, I can't remember if the latest build of Juicy Fonts was compiled with 1.94.
Sorry Big10P, Was a bit vague- It's the image problem i'm talking about, however, Someone should probrably check the other free commands to make sure they work.
I guess the other commands haven't been checked coz most of us jumped back to 1.91 as the last stable version, Red, when the first few were found (-most unlike Mark to introduce bugs to this extent).
And I agree. The source code folder is always naturally recognized as the 'homedir'.
What probably happened is that if you've been playing with Blitz for a few years as I have, you probably realised at some point that the 'current directory' was being switched behind your back by other apps, and so for safety you had to constanty re-state the path needed.
This has not happened in the last couple of years, so I think that the concept of 'current dir' is handled on a 'per app' basis by XP.
i.e. If another app changes it's 'current dir' it won't affect yours.
OK, I've rolled back to v1.91 - the linker is still v1.94, though. I assume this is OK and Mark has simply synced the IDE, runtime, and linker version numbers to avoid confusion?
I'd roll back the linker just in case too.
I'd roll back the linker just in case too.
Er, how? :) The updates don't seem to include the linker.
How Lovely! Download the demo and steel it from that? :S
Didnt you keep a backup? Silly question, right? :)
If not, maybe best to email BRL about the issue, I have no problem sending it you, but you know, they might :)
I managed to get back to linker v1.64 by re-installing from the CD. Is this the version I should be using?
[edit]After re-installing, I see we get a load of SFX/tunes in the Extras folder. Anyone know if we're allowed to use these, royalty-free?
ON THE CD????
Lucky get. :)
Yeah, kinda handy having it on CD - I bought Blitz3D from "that other place", shortly before "the split". :P
So, is linker v1.64 the one I need, then?
I beleive so, if it works :D
Yes you do, when launching from a shortcut.
No you don't and never did, as long as you create the shortcut correctly and add the 'start in'/'Target' path.
That has always worked for me, at least.
My mistake, it does work. It would have been nice if we were informed about this.
When was this switch made? I've been using Blitz for years, and I've never had any issues starting apps from a shortcut. I mean, I don't know when exactly was the first time I tried starting a Blitz app from a shortcut, but it must have been 2003 at the latest since that's when I released my first game.
Also, there's a memory leak in the latest version of Blitz? Yikes!
my problem showed up while trying to deploy an app that was packed with molebox... the path off the root would never resolve unless i explicitly referenced the appdir in the code...
--Mike