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 / Newb Question on the second tutorial or GDK.

Author
Message
jpedersm
13
Years of Service
User Offline
Joined: 29th Jul 2011
Location:
Posted: 31st Jul 2011 06:42
I just got everything installed and started going through the tutorials. On the second one I am getting stuck. I am trying to input the 3d colonel with the camera. Here is the code. Every time I try to load it the program does not function just a black screen. The only way to exit out of it is to close it manual and it say program is not responding. Does anyone have any ideas on why this is doing this?

Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 31st Jul 2011 18:01
1. Is the colonel model in your project directory? (Although you would be able to exit the program normally with the Escape key if it doesn't find the model, so it's probably not the problem, but never hurts to check.)

2. I suppose you start the program in debug mode in Visual Studio. On some computers loading X models from within Visual Studio is just very slow. Maybe you don't wait long enough before stopping the program. The colonel model takes one and a half minutes on my computer to load in debug mode. In comparison, when I compile in release mode and start outside Visual Studio, it's only a few seconds. Try to compile in release mode, put the model next to the EXE and start it from the file system, maybe that works better.
jpedersm
13
Years of Service
User Offline
Joined: 29th Jul 2011
Location:
Posted: 31st Jul 2011 23:28
Ok the model wasn't in the debug folder put it in there and the program would not freeze this time but, sat for 3 minutes and nothing showed up. I escaped this and went into the debug folder and clicked on the program.exe file and it worked perfectly. I am using visual c++ 2008 is there something wrong with the compiler?
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 1st Aug 2011 20:18
Don't put the .x file in your debug folder. The default directory scheme is:
(where your programs are)\game\game(this is your "running" directory)\debug

The "running" directory is where VC++ compiler sets as the game's initial directory. If you load an object without specifying a directory, that's where it looks for it.

A lot of people do something like this:
Make a directory such as "Media" and place it inside your "running" directory. Whenever you access your objects, do it like this:

This will keep your "running" directory clean and make a common spot for your objects.

You may want to make a subdirectory inside "Media" for your images... Keep in mind that your .x files, by default, look for any images associated with it inside the same directory that the .x file is located. You can fix that by editing the .x file and where it references images simply change the directory to match what you have.

The fastest code is the code never written.
jpedersm
13
Years of Service
User Offline
Joined: 29th Jul 2011
Location:
Posted: 2nd Aug 2011 13:15
Ok I am having problems. Like I said I got this tutorial to work and went onto the third one. After readying and going through it all I compiled it. Well it came up with a blank white screen. Then I messed around with the color and got to where I can see the level but, the object of this tutorial was to load a level and move in it. I am at the point where I can load the level now but, can not move around in it. Is there any other reall helpfull info on the net for GDK that anyone knows about?
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 2nd Aug 2011 18:06
I don't know what you are trying to do.... Post the code please.

The fastest code is the code never written.
jpedersm
13
Years of Service
User Offline
Joined: 29th Jul 2011
Location:
Posted: 3rd Aug 2011 00:42
Here is the Code. What we are trying to do here is post a level and move around in it. It can be found with the tutorials for Dark GDK. When I first ran compiled it it was just white. I had to change the 0 on the object light to 2 to actually see something. Well after doing that the level came up kinda white but, hey it is up so I was happy in till I tried to move around and nothing happened. It is just like it is a still picture. Maybe one of you guys can see what I did wrong or would it be my laptop being slow?

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 3rd Aug 2011 06:06
Any input MUST be within (or at least a function called to your input) the "while ( LoopGDK ( ) ){.....}".
That's why you can't move.


Notice the difference? Your code doesn't move the camera, it only turns it.

The fastest code is the code never written.
jpedersm
13
Years of Service
User Offline
Joined: 29th Jul 2011
Location:
Posted: 3rd Aug 2011 12:47
I an curently at work. When I get home I will try that. Another thing in the tutorial it said the level had a lamp already in it so we for the object light we just use 0. When I compile it it is just white. Would this be becuase the lamp for the level was to strong? I can bump it up to 2 and see a light whiteish gray level.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 3rd Aug 2011 15:28
Do you have your images in "media"? If the .x files reference any images, they will (by default) look for them in the same directory that the .x file is located. If they don't find them, they will be white-ish depending on the light level. I suggest putting the light level back to normal and make sure the images are where they are supposed to be.

The fastest code is the code never written.
jpedersm
13
Years of Service
User Offline
Joined: 29th Jul 2011
Location:
Posted: 3rd Aug 2011 17:28
I dont know if I dropped them in where the .x files are. I just downloaded them and dropped them where the project is. for the media should I make a seperate folder then call out media first then what I want to load? Also I dont know if this makes a difference but, when I installed everything I ran Visuall c++ before I downloaded the direct x program and GDK. After I ran visual I down loaded the direct X file and unzipped the files to a folder on my machine then I downlaoded GDK. I set up everything in visual to where you can make a project out of gdk. Was I sopose to do something with the direct X file to? Also I do recall it stating after I downlaoded it there was some updates for it which I did not install (Thought it would just update to the latest file). Should I have done this or something different then just installing the direct X files?
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 4th Aug 2011 00:22 Edited at: 4th Aug 2011 00:23
It sounds like you installed everything correctly--don't worry about that. Here is a pick showing what I mean about the directories:
]
When you program a load object/image, do it something like this:
dbLoadObject("media/object.x",ObjNum);
dbLoadImage("media/image.jpg",ImgNum);

I have a post featuring the game I got the directory shot from:
http://forum.thegamecreators.com/?m=forum_view&t=186514&b=5
It's not exactly simple, but it's not too complicated to follow. Just look at the "void GenerateLevel(void){....}" function and you can see how it's done.[href]null[/href

The fastest code is the code never written.

Attachments

Login to view attachments
jpedersm
13
Years of Service
User Offline
Joined: 29th Jul 2011
Location:
Posted: 4th Aug 2011 01:01
First hawkblood thanks for helping. I posted the code and now I can look around. I tried moving files around and to a media folder and it came up with nothing. It will only work if the files are by them self in the project folder. For the post with the game you created it looks awesome but, where is the source code?
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 4th Aug 2011 01:24
It's in the download (second post). The .sln file is in the first directory (Cameron's Car Game). It's not hard to follow once you get into the code. Just go to VS and open the solution.

The fastest code is the code never written.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 5th Aug 2011 22:21
Quote: "I tried moving files around and to a media folder and it came up with nothing. It will only work if the files are by them self in the project folder."


It is good to know that you can change the working directory where Visual Studio looks for files when you start the program in debug mode from VS. Open project properties, go to the Debugging tab, and there is a "Working directory" setting. It has a "Browse" option to search for directories. You can set it to your "Media" folder, for example.

It is also possible to redirect the compiled EXE files to a different directory. By adjusting the target directory settings, you can set up the final directory structure of your project separately from the intermediate files of the compiler.

Login to post a reply

Server time is: 2024-11-19 08:45:26
Your offset time is: 2024-11-19 08:45:26