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: 29th Jul 2009 12:22
Hmm, when i removed "struct" i got some more errors.

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 29th Jul 2009 12:33 Edited at: 29th Jul 2009 12:36
i have a question, my game relies on reading / writing to files mainly, i have an option ingame which allows me to continue from my last place in the last time i logged, but to this i had to make a function which contains 20000 lines. because when i read something from a file it becomes a character, and i want it to be int, so my function is like

int ReadCacache (char buff[20])
{
char XX1[20] = "1";
char XX2[20] = "2";
char XX3[20] = "3";
char XX4[20] = "4";
//...till 9999
if(strcmp (health,XX1)== 0)
return 1;
if(strcmp (health,XX2)== 0)
return 2;
if(strcmp (health,XX3)== 0)
return 3;
if(strcmp (health,XX4)== 0)
return 4;
if(strcmp (health,XX5)== 0)
return 5;
if(strcmp (health,XX6)== 0)
return 6;
if(strcmp (health,XX7)== 0)
return 7;
//...till 9999
}

and i call it like this:

sw = fopen ("Data\\cache\\swidth.txt", "r");
if( sw != NULL )
{
fgets(wbuff, 20, sw);
swidth = ReadCache(wbuff);
}

it works fine but oh well im pretty sure that there is a better way to do it, any suggestions?

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 29th Jul 2009 15:12
Take a look at the function atoi(). It converts an ascii string of digits to an integer. I'm thinking you mean something like

int ReadCache (char *buff)
{
return atoi (buff);
}

or just call atoi instead of ReadCache.

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: <script> alert(1); </script>
Posted: 29th Jul 2009 15:26
So if char *buff = "250" the integer returned by ReadCache will be 250?

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 29th Jul 2009 16:40
Yep. Just make sure that all the characters in the string are digits.

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: <script> alert(1); </script>
Posted: 8th Aug 2009 21:42 Edited at: 8th Aug 2009 21:46
Hey guys, i still didnt find a solution for my structures.
ill make the question more simple..

i have 3 files
1 headers and 2 cpp
kod.h, kod.cpp,and spells.cpp
kod.cpp includes something like:


in spells.cpp:


how should kod.h look like? i want to access player struct from the other cpp file, thats all.

thanks.

dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 9th Aug 2009 05:23 Edited at: 9th Aug 2009 05:24
It should look something like this:

something.h


something.cpp


anotherFile.cpp


Amnzero
15
Years of Service
User Offline
Joined: 1st Aug 2009
Location:
Posted: 9th Aug 2009 05:38
Ah, thats refreshing.

if(enemy == Amnzero) runAway();
Amnzero->WebSite = L"http://neovance.com/";
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 9th Aug 2009 13:13
Ok great. that worked, thanks alot dude!

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 11th Aug 2009 19:56
hey there!

my game was working fine, but today i was making drops from creatures, before i create any, my game was running just fine, but after i created them and added the main function to the main game loop, the game became REALLY slow, more like the loop runs once every second. i tried removing the new functions but it didnt work, removed all the functions in the loop and still no hope. i dont know where is the problem exactly, i would be thankful if you take my game file and test running the game, if its also slow, it would be great if someone can find the problem, project attached.

im going on a vacation today at night so i wont be able to reply before a month, it would be really great if i find an answer when i come back.

at least you'll get rid of my endless questions for a month

goodbye.

Attachments

Login to view attachments
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 11th Aug 2009 21:20
did you actually create a function called main()?

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: <script> alert(1); </script>
Posted: 11th Aug 2009 21:28
no, the main creature loot function

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 8th Sep 2009 00:34
kod.cpp:

kod.h :

spells.cpp:

spells.h :


when i run it, my fps stuck on 1 while executing Play() function, why's that? i tried to remove all the functions in Play() but no use, what is the problem?

PS: data file attached 3 posts above, but the code there is incorrect i think.

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 9th Sep 2009 19:48
still cant find the problem, any help with that please?

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 10th Sep 2009 20:31
one minor question, whats the point of release mode? i can run my game from outside the solution explorer using debug mode without problems, so why was the release mode created?

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 10th Sep 2009 20:43
When you compile to debug mode the compiler adds a lot more information in order to be able to implement break points and a number of other things for tracking the program's behavior. This stuff is taken out for release mode. A program I've written currently takes up 738K in release mode. The debug version of it takes 2.2M. That's about three times larger.

I also believe that debug mode depends on other external files (not counting media) to be able to run whereas release mode doesn't unless they're DLLs that support program functionality.

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: <script> alert(1); </script>
Posted: 11th Sep 2009 03:19 Edited at: 11th Sep 2009 03:20
oh, i see.

i have a question about pointers, i've read in a C book about pointers and repeated it many times, but it aint coming across my mind..



errors:


Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 11th Sep 2009 03:31
Looking at this line:

strcpy(*it2->icon,"Data\images\energy potion img.jpg");

it2 is a pointer so it2->icon by itself returns the address (char *) of icon within the item that it2 is pointing to. Using the * in front of it dereferences the address and returns the character in the first element of icon.

Either drop the * or use (*it2).icon .

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: <script> alert(1); </script>
Posted: 11th Sep 2009 13:27
awesome that worked, thanks for the info.

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 16th Sep 2009 19:48 Edited at: 16th Sep 2009 19:48
that is what i was afraid of....the strange error again...



i was working on my game today morning, everything was fine, after like 5 hours, i opened my project and edited it abit and started debugging and got a similar error as the one in the screenshot, i cant create any application using VC++ anymore, somehow VC++ isnt creating right appliacations, when i run the exe from its folder, it gives me an error saying "-path-.exe is not a vaild win32 application.
anyone has an idea about what caused this? and how to solve it?

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 21st Sep 2009 19:23
Hello, i have a question,
if i create a structure like:
struct something{
int something1;
int something2;
void Something3 ();
}s1,s2,s3;
each one of s1,s2,s3 will have its own function (Something3())?
i mean is it possible to be like:
s1.Something3() {
DoSomething(1);
};
s2.Something3() {
DoSomething(2);

thanks in advance.
};

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 21st Sep 2009 20:49


each one of s1,s2,s3 will have its own function (Something3())?
i mean is it possible to be like:




I think what you'd need to do, if I understand what you're getting at, is

void DoSomething (int value)
{
DoSomething (value);
}

Then you can call

s1.DoSomething (1);
s2.DoSomething (2);
etc.

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: <script> alert(1); </script>
Posted: 21st Sep 2009 21:38 Edited at: 21st Sep 2009 21:44
alright, thanks, so each new structure variable can't have it's own different function

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 21st Sep 2009 21:44
If each creature is supposed to have a different behavior then the answer is "no." A member function of a structure or a class is the same for each object of that type. However, by passing a different number to the function as above you could have the DoSomething() function cause different behavior. You could store a number in the class/structure that says, "I'm this kind of creature" and when the function picks it up it tells itself to behave like that kind of creature.

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: <script> alert(1); </script>
Posted: 21st Sep 2009 21:46
alright, thanks alot

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 23rd Sep 2009 22:02
Hello again

if i want to make a level/object editor program, and export/import my own file type (example: something.kod), how should i start? i mean, if my program created an object, how can i export it? im not asking you to make me a program, i just want to know where should i start.
also, how can i import it to my game? i mean how does dbLoadObject() look like? so i can make a similar function that can import my file.

thanks alot

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 24th Sep 2009 20:52 Edited at: 24th Sep 2009 20:52
Quote: "
that is what i was afraid of....the strange error again...



i was working on my game today morning, everything was fine, after like 5 hours, i opened my project and edited it abit and started debugging and got a similar error as the one in the screenshot, i cant create any application using VC++ anymore, somehow VC++ isnt creating right appliacations, when i run the exe from its folder, it gives me an error saying "-path-.exe is not a vaild win32 application.
anyone has an idea about what caused this? and how to solve it?
"



it is really annoying and im still looking for a solution :/

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 7th Oct 2009 21:19
Hello, sorry for bumping the thread but making a nre topic for this question is not worth it,


This application is supposed to write 10 random numbers between 0 and 9 to a text file, but it always creates the same numbers, why's that?

Wolf4D
15
Years of Service
User Offline
Joined: 5th Oct 2009
Location:
Posted: 7th Oct 2009 21:40
Maybe, you must add dbRandomize(someseed) at the begining of your programm?
Like:


Sorry for my bad English.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 8th Oct 2009 14:48
Do i have to make add a new number in dbRandomize() parameter everytime i run the program? =.=

puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 8th Oct 2009 23:10
Yeah. Computers can't actually produce random numbers, they just run the "seed" through an algorithm to make a number that appears random. A common solution to this is seeding it with the time. You'll need to have #include "Time.h".

So instead of dbRandomize(42);

put


that should work.
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 8th Oct 2009 23:25 Edited at: 8th Oct 2009 23:25
Quote: "#include "Time.h""

Can't you just use dbTimer() for the seeding, or is time.h faster or something like that?

Your bedtime story is scaring everyone
Paynterboi TicTacToe
16
Years of Service
User Offline
Joined: 23rd Dec 2007
Location: That one place
Posted: 9th Oct 2009 04:07
It wasmy understanding that dbRandomize( dbTimer() ); was considered the best method of achieving this while useing the GDK.

EYE R T3H +ick +ack +oe mester
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 9th Oct 2009 09:37
Hmm, i use dbRandomize at the start of the program, so it's going to be 0 or so, which means it's kinda useless, right?

puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 9th Oct 2009 13:48
Oh I didn't know about that dbTimer function. I guess that works too then.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 9th Oct 2009 13:49
your way worked just fine, im using it ^^

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 11th Oct 2009 22:18
Hello guys, once again i have a question, and making a new topic is not worth it..my question is, im making some rockets for my game, and i want to add some fire effect getting out of it's back, is it possible to do this in 3ds max? ( i've dont it there, but is it possible to export it as .fx or with the scene or anything? ), or should i use dgdk particle system, or .fx files? i have no much hlsl knowledge, so it'd be hard, what do you guys suggest me to do? and please, tell me if one of these ways is neater than another, i want to to look like "real" fire, not like the rest of my programs, which looks like cartoon

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 16th Oct 2009 17:00
hello again! sorry for bumping..

why my sprites are not being shown on the screen? is there anything that affects the sprites? some of them are being shown unlike the others, here's my code:


the problem is in UpdateObjectives():


So what's wrong? the sprite is not being shown on the screen ( you can notice that the image #500 is loaded in LoadGame() and the name is correct. )

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 20th Oct 2009 18:06 Edited at: 20th Oct 2009 18:18
Hello!

im having some problems over here..

the bold line triggers an unhandled exception, the weird thing is that when i put the exact same line after calling the function, it works

thanks in advance

Login to post a reply

Server time is: 2024-11-20 11:32:42
Your offset time is: 2024-11-20 11:32:42