Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Problems Making a Final EXE

Author
Message
Sir_Herbert
12
Years of Service
User Offline
Joined: 6th Nov 2013
Location: The InterWebz
Posted: 11th Apr 2014 20:30
I am trying to compile my game so that it can run on any computer by itself. Someone in my class said that you need to remove the drive letter and the path before the actual file . So instead of "E:\My DBPRO Games\Edutainment\images\sky_texture.jpg" it would be "images\sky_texture.jpg". The exe is in the same folder as all of the media folders such as images, sounds, and models so it should look for the images folder in its folder that it sits in. But, it doesn't work. How would I add the media so that it can run standalone? Thanks

Here is the code if it helps

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Apr 2014 21:12
Quote: "Here is the code if it helps"


Not really. In a situation like this you should first try reducing the problem to the simplest case and see if that works. If it works then the problem is likely to be something else you've not considered. If it doesn't work then we only need to study that simple code - or something else unrelated to the code.

For example, you could try something like



And you haven't told us what you mean by "But, it doesn't work". What, precisely, happens? Wrong image? Error message? Or something else?



Powered by Free Banners
Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 11th Apr 2014 21:38 Edited at: 11th Apr 2014 21:39
The code is using absolute paths, these paths only exist on your computer, they'll be different for everybody else.





You need to use relative paths. Assuming E:\My DBPRO Games\Edutainment this is your project folder, we can get rid of this part of the file paths. So when the game runs it'll look inside the local Images folder for the files it wants.




Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th Apr 2014 01:05 Edited at: 12th Apr 2014 01:09
He says he's already tried that - at least that's what I thought he meant when he said:

Quote: " So instead of "E:\My DBPRO Games\Edutainment\images\sky_texture.jpg" it would be "images\sky_texture.jpg". The exe is in the same folder as all of the media folders such as images, sounds, and models so it should look for the images folder in its folder that it sits in. But, it doesn't work."


I think he's already been told this in another thread. Perhaps it was someone else?

Edit Yes, he was told that by Blobby 101 on this thread:

http://forum.thegamecreators.com/?m=forum_view&t=210670&b=1



Powered by Free Banners
Sir_Herbert
12
Years of Service
User Offline
Joined: 6th Nov 2013
Location: The InterWebz
Posted: 12th Apr 2014 01:33
When I say it doesn't work I mean that the the matrix that the image should be texturing is black like I had the wrong path when I remove the E: part and so on. It's like the game can't read the images/image name.jpg command. It just shows up black like the texture doesn't exist. Also when I try to add the image in the Media section like image/etc.jpg it adds a bunch of other stuff before it like C:\ then temp and other stuff like that like it is trying find it on the actual computer.
Blobby 101
20
Years of Service
User Offline
Joined: 17th Jun 2006
Location: England, UK
Posted: 12th Apr 2014 01:50
Try what GG said about reducing the problem down, can you load one of these images and just display it on screen? It'll help you figure out exactly where the problem lies in your code.

Double check that you have the paths correct as well, all the spellings and such, you'd be surprised how often you can miss a tiny difference in filenames when you've been debugging the same code for a while!

Barry Pythagoras
12
Years of Service
User Offline
Joined: 14th Mar 2014
Location:
Posted: 12th Apr 2014 02:45
He says that he tried it, but it's odd that he posted a code snippet that had absolute paths. If you try something you should post the code that you are working with. Otherwise it makes it look like we have to fix the posted code.
wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 12th Apr 2014 05:56
Could just make an installer that automatically installs to the same path. I'd try debugging like this though; set dir "E:\My DBPRO Games\Edutainment\" at the beginning of your code, then take out that same section from all your loading sections. If it still doesn't work, you've done something very wrong.
Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 12th Apr 2014 08:07 Edited at: 12th Apr 2014 08:14
If relative paths don't work, then it most likely means the current folder isn't the EXE's folder. So at the top of your program, drop in some code to get the current path when your game starts up, then check to see if your important folders like 'images' 'models' 'sound' etc exists in this path. If they don't, either print a meaningful failed error message to the screen (or log file), sync and wait for a key before ending. So when people run your game, they can give some type of useful feedback as to why it died, rather than .. it died..


Although looking at your original code snippet again, there's absolute paths sprinkled all through it. It'd be nice if we had the 'current' cleaned up version of the code to look at, but I'm guessing that you converted the paths you might have missed a path, which would make it fail..

The version of your snippet bellow, adds a bit of header to query the current folder and drop an error message / exit when the paths fails. I've changed all the media loads to use the games initial startup location as it's base path, so if you ever change the path while the program is running, it'll still be able to find the media files regardless.




Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th Apr 2014 12:28
Quote: "Also when I try to add the image in the Media section like image/etc.jpg it adds a bunch of other stuff before it like C:\ then temp and other stuff like that like it is trying find it on the actual computer."


That could be the problem. I've never used that feature of the editor so I can't advise you on that. You should be able to do what you want without using that pane at all.

The attached simple project illustrates one way of organising and using your media.



Powered by Free Banners
Sir_Herbert
12
Years of Service
User Offline
Joined: 6th Nov 2013
Location: The InterWebz
Posted: 13th Apr 2014 20:01
Here is my updated code. I put the stuff in a new DEV folder cause it's necessary for a competition but that is besides the point. So i got rid of the drive reference like you said, but when i run the game it says missing sounds, but when i put the absolute path back on the sounds but not the images the game runs but nothing is textured. The folder is with the EXE (see attached pictures)

Login to post a reply

Server time is: 2026-07-07 06:48:13
Your offset time is: 2026-07-07 06:48:13