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 / Few questions

Author
Message
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 18th Jul 2009 20:52 Edited at: 18th Jul 2009 20:54
Hmm..


my whole project code:



Well im running debug mode, since release mode is totally screwed up somehow, it breaks once my gam runs, anyway before testing your example my game was running just fine, but now my debug\KoD.exe is gone
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 18th Jul 2009 20:57
Ew...4 errors from

and 1 error from
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 18th Jul 2009 20:58
Read my post (second post) on how to fix it. http://forum.thegamecreators.com/?m=forum_view&t=154012&b=22

Maybe the running in release mode problem is caused by not initializing variables correctly.

Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 18th Jul 2009 21:00
Its alreadt /MTd
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 18th Jul 2009 21:04
Reread my post. You want it to be /MT

Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 18th Jul 2009 21:05
oh LOL!!! sorry about that XD
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 18th Jul 2009 21:09 Edited at: 18th Jul 2009 21:11
ok i think everything works now.
except one thing
when i call CreateCreature function then DrawObjects main camera (me) go to <X,Z> <0,-130>
why's that?

and oh well, i didnt mention that when my CreateCreature function used to create and draw the object, i had the same problem. what the hell i mean it has nothing to do with camera position O_o
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 18th Jul 2009 22:11
nevermind at last post, idk what the hell was causing the problem but i fixed it, thanks everyone for posting.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 19th Jul 2009 11:54
Quote: "when i call CreateCreature function then DrawObjects main camera (me) go to <X,Z> <0,-130>"


Whenever you create or load a new object, the camera is automatically repositioned to try to look at the new object. You can turn this behaviour off by dbAutoCamOff().

Also, if you have many objects to store in that vector (array, whatever), it would be a good idea to index the array directly with object ID. It is a bit more work to code correctly when objects are created/deleted, but it pays off in speed when you need to find the data block that belongs to an object ID.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 19th Jul 2009 12:22 Edited at: 19th Jul 2009 12:23
Quote: "since there is a function to point camera to an object, is there a function to point an object to the camera? "

still looking for an answer, if there is not, any idea about how to turn objects (enemies) to the camera(player) ?
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 23rd Jul 2009 15:51


i dunno what is the problem here, but some black spots in the picture appears as the color of the background, what is the problem here? (the picture is not alpha channeled)

http://img268.imageshack.us/img268/3640/signatureugo.jpg
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 23rd Jul 2009 19:53 Edited at: 23rd Jul 2009 19:54
Which command do you use to put the image to the screen?
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 24th Jul 2009 00:14
dbSprite()

http://img268.imageshack.us/img268/3640/signatureugo.jpg
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 24th Jul 2009 16:46
that thing also happened to another image, alot of black spots in it are same as background color :/

http://img268.imageshack.us/img268/3640/signatureugo.jpg
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 24th Jul 2009 20:23
In sprites, the black colour is transparent by default. Before putting it to the screen, try to apply this to the sprite:



From the documentation:
void dbSetSprite ( int iSprite, int iBackSave, int iTransparency )
If the transparency state is set to zero, the sprite will not treat black as a transparent color.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 24th Jul 2009 23:55
great thanks alot i will try that as soon as possible, im having another problem with the exe file that is created when i debug my project from VC++.

ok so the project works fine when i debug it from VC++, but when i run the exe in the project folder it shows a black screen, like there are no sprites/objects(etc..) to show, why is that?

http://img268.imageshack.us/img268/3640/signatureugo.jpg
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 25th Jul 2009 00:10
Your media needs to be in the right place relative to the "current directory". When you're in Visual Studion that happens to be the solution's folder. If your run the exe outside VS the current folder is the folder the exe is in. That's different folders for something compiled in debug mode vs. release mode.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 25th Jul 2009 00:25
so i have to use release instead of debug?

release mode errors:


http://img268.imageshack.us/img268/3640/signatureugo.jpg
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 25th Jul 2009 00:41
Debug mode should be used strictly for development. When your program has all of the bugs out of it (debugged,) you compile in release mode in order to release it to others. Regardless of mode a .exe is generated but one is in the Debug folder and the other is in the Release folder. When you run either of these from a command prompt or from Windows Explorer the media needs to be relative to the folder that contains the .exe file you're running. When you're running it in either mode from VS the media files need to be relative to the folder where the solution resides.

So when you package the program up for release you need to make sure that the media files are where they belong since your users aren't going to be running from VS.... normally.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 25th Jul 2009 11:48
For fixing those release mode compile errors, try to select the menu Project / "Project" properties / Linker / Input. Make sure that "release" mode is selected in the drop-down menu of this options dialog box. In the line which says "ignore specific library", add the names of those libraries that the error messages are complaining about: MSVCRT.lib, libcmt.lib.

That's the only guess I have, this is a linker error and I don't know much either about configuring linking options for Visual Studio.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 25th Jul 2009 19:05
dbCheckDisplayMode() <-- this command works?


w,h and d are integers.

this compiles without errors, but when the program run and reach the if statement it gives me an error: Unhandled exception at 0x00c1b5eb in GDM.exe: 0xC0000005: Access violation reading location 0x00000594.

any ideas?

http://img268.imageshack.us/img268/3640/signatureugo.jpg
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 25th Jul 2009 20:07 Edited at: 25th Jul 2009 20:08
Just fishing here, but where is "restart" with respect to the "if" statement?

Have you tried setting a breakpoint at the "if" statement then stepping through the code to see what line it breaks on?

EDIT: OMG, A GOTO STATEMENT!!!!!!!

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 25th Jul 2009 20:14


http://img268.imageshack.us/img268/3640/signatureugo.jpg
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 25th Jul 2009 20:24
I don't think you can have a 12-bit color depth. Only 16 or 32.

Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 25th Jul 2009 20:30 Edited at: 25th Jul 2009 20:33


that is not the reason, if so why this function exist? i think it should return 1 if the info is right and 0 if not, not cause an error if the mode doesnt exist

http://img268.imageshack.us/img268/3640/signatureugo.jpg
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 25th Jul 2009 20:48
Put a breakpoint at the if statement and then check the values of w, h, and d before the function call. It wouldn't hurt to assign them initial values as part of the debuggin.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 25th Jul 2009 21:23
At the if statement all the values are the same as the ones i entered in the dos app.

Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 25th Jul 2009 21:30 Edited at: 25th Jul 2009 21:33
Ah I think I know why. In order for a DarkGDK function to work properly, I believe:

void DarkGDK()

Must be the entrance point for the program. (It has to be called by DarkGDK first)

Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 25th Jul 2009 21:32
Hmm, dbExecuteFile worked without DarkGDK(), well ill try calling DGDK anyways, thanks.

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 26th Jul 2009 00:34
dbExcuteFile doesn't depend on the support system that Dark GDK provides. It's probably just a shell for the Windows execute function. Otherwise, Dark GDK probably hasn't looked into the capability of the video until the DarkGDK() function has been called.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 26th Jul 2009 16:07 Edited at: 26th Jul 2009 22:36
bah ill do it without a check then.

Is it possible to change the resolution while playing? well in some games i have played, there are options ingame for choosing the resolution, i wonder if that is possible using the DGDK.

one more question: how to make an object point to another one?

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 26th Jul 2009 22:39 Edited at: 27th Jul 2009 19:58
if i find the answer for this question my game code will be done in 2-3 days then i will only need to make the 3d objects but oh well, too bad..24 objects without animations takes MUCH less time to load than 1 animated object, i wonder how many days will my game need to load when the 24 objects be animated XD

Outerblob
15
Years of Service
User Offline
Joined: 27th Jul 2009
Location:
Posted: 27th Jul 2009 19:45
Hi guys I'm new to Dark GDK but when I try to make a new dark gdk file in Visual C++ 2008, It doesn't load the main.cpp!!!
any help will be appcriated!

Why change the the world when it changes itself?
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 28th Jul 2009 14:58
Em, im having a problem in declaring my vectors in a header file, how can it be done?

extern struct _player player; for structures
exter in a; for normal variables
extern enum _gamemodes eGameMode; for enums

thanks.

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 28th Jul 2009 15:06
Quote: "im having a problem in declaring my vectors in a header file"


Not quite sure what you're trying to do. Are these variables stored in a module you've linked in? If not, then don't use the extern specification.

Otherwise, you haven't really specified the problem you're having. Are you getting error messages when you compile?

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 28th Jul 2009 15:11 Edited at: 28th Jul 2009 15:38
i have a header file and a cpp file, in the cpp file i have these lines:

and now i want to declare this vector in the header file, here's my header atm:


EDIT: im trying to use that vector from somewhere out of the cpp file, from anoth cpp file.

i have same problem with structures:
i have KoD.cpp and KoD.h, and Creatures.cpp and Creatures.h, in KoD.cpp i defined a structure:

and in the header :


now i want to use it from creatures.cpp, i included KoD.h but it seems that the structure isnt deined:


Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 28th Jul 2009 16:59 Edited at: 28th Jul 2009 17:04
Put the struct _player in a header file and put the assurances that it won't be redefined around it like so:




Then include the header file in all of your .CPP files. Remove it from you .cpp file. This should assure that all modules know of the structure without giving a redefinition error.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 28th Jul 2009 18:20 Edited at: 28th Jul 2009 18:21
that also works with vectors?
so i can make a header file like:


this header file's name must be _CREATURE_H.h?

and also..can you please explain what do these commands do (the ones with notes) and "#pragma once"? thanks alot, (i know my questions are endless )

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 28th Jul 2009 19:12
I'd be a bit concerned about including the declaration of the vector in the header. It would probably work but I can imagine some instances where it might not. <shrug>

#pragma once is supposed to replace all the #ifndef stuff I put in. I don't rely on it because I swear I tried to use it a few times and got some errors generated.

The text used in the #ifndef statement can be of your own choosing. I generally use the name of the header file in that sort of construction but often prepend my initials just to try to make sure it doesn't class with someone else's rendition.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 28th Jul 2009 19:14
Thanks alot, ill try to do this in a copy of my code, hope it works. thanks again!

Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 28th Jul 2009 19:25 Edited at: 28th Jul 2009 19:30
Generally you put the structure and class declarations (types) into the header file, so that other modules which include that header can use them. The implementation part (the bodies of the functions and anything else other modules don't need to see) go into the cpp. The cpp should include its own header of course, and no need for extern.

Of course if you have a class or struct which is not to be used in more files than one, its code can go entirely into the cpp. Think of a header as the communication interface between different files.

It does not matter what the name of the header file is. It helps if it's similar to that string you define in the "ifndef" lines but not necessary. The main thing is that in the "include" instruction you use the header file name.

The "ifndef" is a conditional statement for the prepocessor which basically says: do not read these lines twice. The first time, since the flag is not defined yet, it is defined and everything else within the "if" lines is processed too. When these lines are read by the compiler more than once, the flag is already defined, so it won't read them again. This prevents double declaration errors.

The "pragma once" says exactly the same: read this header only once. So you use either the set of "ifndef" lines or just the "pragma once" in the beginning, they should be interchangeable.

http://en.wikipedia.org/wiki/Pragma_once
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 28th Jul 2009 19:33
P.S. Yes, you can declare a vector in the header file, but then the header must have #include <vector> in the beginning.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 28th Jul 2009 20:04
alright, thanks alot.

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 28th Jul 2009 21:08 Edited at: 28th Jul 2009 21:12
i have one more problem, there is an integer called iTime, it is my main integer for holding the time. i dont know where to define it, i have 2 cpp files and 2 header files, if i define it in the KoD.cpp and write "extern int iTime = 0" in KoD.h i get some linking errors, if i define it once in KoD.h i get 6 linking errors about structures, if i create a new header and define it there, i get the same set of linking errors, any ideas about where to define iTime? (it is used by both cpp files).

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 28th Jul 2009 21:36
Oh... my bad, its not because of the iTime integer, tbh i dont know what caused them :


these are my headers:
KoD.h


creatures.h:


Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 28th Jul 2009 21:53
found the problem:



2 from the 2 structures 2 from the enums and 1 from the vector, any ideas about where to define them?

dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 28th Jul 2009 21:59 Edited at: 28th Jul 2009 22:00
Quote: "} player;"

Quote: "_gamemodes eGameMode = eMainMenu;"

Quote: "_playerstate ePlayerState = eStop;"


You're declaring a variables in your header which you shouldn't do, the compiler needs to know where to store the variable and if you have it in a header and include it more than once from different source files you'll get that error. Instead, declare the variable in your cpp and declare an extern to it in your header if you need it to be visible to other files.

Also, "typedef struct _creature", this isn't C, you don't need to typedef all your structs/classes. Same goes for your earlier "extern struct _creature creature;".

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 28th Jul 2009 22:58
So i should define the structure in the KoD header, then declare the varibale in the KoD.cpp, and in KoD.h i should use extern struct _creature creature; etc and then i can access creature variable from any other cpp file which is including KoD.h. i hope that was right

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 29th Jul 2009 01:27
oh my god....another 200 error, man i give up ill just stick with using one file.

dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 29th Jul 2009 08:32
Quote: "So i should define the structure in the KoD header, then declare the varibale in the KoD.cpp, and in KoD.h i should use extern struct _creature creature; etc and then i can access creature variable from any other cpp file which is including KoD.h. i hope that was right"


Almost. As I was implying, "extern struct _creature creature;", the struct part there should be removed. Other than this it should work fine provided you have header guards.

Login to post a reply

Server time is: 2024-10-06 03:38:58
Your offset time is: 2024-10-06 03:38:58