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.

Dark GDK / black screen

Author
Message
sadsack
20
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 13th Dec 2007 00:44
Hello,
Well I got 2008C++ loaded up with Dark GDK. I been working on a game in DBP, so I just used that world to play with in GDK.

I wrote the code and compiled it and ran it. I worked fine. when I raned it from the compiler
see photo:

OK when I make a exe. all I get is a black screen. No world.
Does anyone know why this is happening?
Thank You renny

Attachments

Login to view attachments
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 13th Dec 2007 02:44
Any chance of seeing some code so we can locate any possible errors?

The Sun is trying to kill me!
Pharoseer
17
Years of Service
User Offline
Joined: 21st Feb 2007
Location: Right behind you
Posted: 13th Dec 2007 04:40 Edited at: 13th Dec 2007 04:45
What's most likely happening is that the code can't find your media. This is a problem I was having when I first started.

First find your project directory. For example, if the path to your solution is:



then your project file should be at the following location



Assuming you have a separate media folder, your "media" folder should be placed at the following location:



Then if you have a tree model in your media folder(say "tree.x") you would load it in your code like this:



[Edit]
If you're not very familiar with C or C++, it's important to remember the double backslash ("\\"). The backslash character is the escape character in C/C++. This allows us to use things like "\n" to print on a new line (sorta like hitting the Enter key when typing). If you were just to use the following command:



It would assume you were using the escape characters "\m" and "\t". Even if those don't make sense it'll still try to translate them and you're path would get messed up.
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 13th Dec 2007 12:21 Edited at: 13th Dec 2007 12:22
Yeah, that is a good point.

But surely the GDK would kick up a stink if you pointed it towards non-existent media?

The Sun is trying to kill me!
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 13th Dec 2007 15:49
Not really. I added "FileExist" checks EVERYWHERE I load media - and I have a "list" I stuff errors into - that I can display - usually helps ALOT with the "Simple ... um... stuff".

It's more work - but beneficial - like you'll have this resolved - and two months from now after modelling and doing stuff - chanign media - all of a sudden - WHAT HAPPENED? Those little Error things - will get you on track in a hurry - "Oh yeah - I renamed that yesterday" and you'll fix it and You're off and running again.

sadsack
20
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 13th Dec 2007 17:41
Well I did not understand all of what you said.
I tryed to set the dir to the folder, it would not work even in the compiler. So I went back to just setdir media. then it will work when I compile it, the world come up and you can play around in it.
then I tryed your load object (\\media\\world);. It wouls not work.
Where do I go to set the path for the compiler. here my code:




Thank you,
I am new to C++
renny
aersixb9
16
Years of Service
User Offline
Joined: 29th Nov 2007
Location:
Posted: 13th Dec 2007 18:15
Uh, are you setting the directory to "media", then looking at the "media" subdirectory of "media"? It looks like your code is checking the "media/media/" directory and not the "media" directory...I think...yeah, the rest of the code looks good, so if it's all blank then it's not finding the bad_guy.x file. Maybe do a dbFileExist("media\\bad_guy.x") to see if you can find the file?
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 13th Dec 2007 18:23
Basically I mean this:



thats a dumbed down version of what I meant to get the idea across.

But what I was saying - with regards to how I deal with it - and how your new to C++ - and that sometimes "Writing to the screen" isn't going to work - depending on where your code - is - your dbSync setting etc - is that I basically use a string variable for things like a filename so I'm not typing it everywhere like in the example above - and then I also have a string variable I can load with errors - and then my main loop will display this "string" so I can see it when its a "Good time" to print it to the screen.

Basically - I check to make sure the file is there first. Now with Direct.X objects - there are often filenames in the Direct.x file - like for textures and stuff - and this - well - I just try to make sure they are there.

I guess you could say I try to write code that for the most part gives me a clue as to what went wrong when/if I can.

If you're new to C++ - you should scope out http://www.cplusplus.com - go to documentation - and there is a tutorial link - also - IanM on here is kind of a C++ Guru - and he recommends the STDLIB stuff - for making array's lists etc - and more importantly for you now - there is astring lib in C++. I personally made my own - but that was my way of learning the nitty gritty - and not recommended for casual coders who want to do things in a "main stream" way. I'm not mainstream - I'm just a techno fact nut - and I do whatever will work for me - the fastest - meaning RUNTIME speed - if I can help it. I wrote my own double linked list class for example when STDLIB has a whole slew of that stuff - but again - its my way of forcing myself to learn the "deep" things - though I also avoided learning something more standard - mainstream - so my way isn't always the best - but it works for me usually....

Try to make your code tell you were its messed up. If a file or something MAY be missing? Make your code test for it so you aren't guessing.

also - try running your program in a window vs. full screen - so its less of an issue to go back and forth between the Dev GUI and the "Game Window" - if its fullscreen - it mucks things up.

sadsack
20
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 13th Dec 2007 19:31
Well I will try to see if I can make it work. It seems like if the compiler can find the media folder and load the model and run it the exe. should be able to. But I know nothing about this compiler.
Thank you for your help
renny
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 13th Dec 2007 20:06
sadsack
20
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 13th Dec 2007 20:27
Well, I just don't know what I am doing, so don't feel bad. If I knew more I could understand what you was saying. So it is not you it is me.
renny
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 13th Dec 2007 20:33
Quote: "So it is not you it is me."




Lol, oooh that old chestnut!

The Sun is trying to kill me!
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
sadsack
20
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 14th Dec 2007 02:32
With the help of IanM I found the problem, It was simple to fix. All I need to do was move the exe.file from the releace folder to the project folder and it worked fine.
renny
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 14th Dec 2007 21:01
You know what I do for "THAT"

I set a HARDCODED line like:

dbSetDir("c:/MyProject");

so that I effectively get the same result as you did by moving the file. This way I can debug etc. without needed to keep moving the file.

then I remove that line - and copy the file to the project directory when I release it ...

Login to post a reply

Server time is: 2024-11-17 00:24:07
Your offset time is: 2024-11-17 00:24:07