Starting Game
General Information
Date: 24/10/00
Time: 21:39:48
Name of debug file: D:\Mijn documenten\Bricks\debug.log
Windows Version: 4.10. A
Processor type: Intel Pentium or higher
Keyboard language: English (United States)
Sub Main()
Initializing Procedure
Initializing DirectSound
Setting soundbuffer: CTRLFREQUENCY, CTRLPAN, CTRLVOLUME, STATIC
Setting wave format: PCM
Setting number of channels: 2
Setting sound frequency: 22050
Setting bits per sample: 16
Initializing DirectDraw
...
In my program I just call this method: WriteLog("Initializing DirectSound", 3). Is this a good technique?
Edited by - soehrimnir on 10/25/00 2:47:06 AM
🔒 Locked
Debugging...
Advertisement
Original Post
I was wondering if anyone here creates a debug file, when they create a game. I just made my first game and while programming it, I realized I had to create a debug file, because it is hard to debug a fullscreen game with the debugger itself.
I have two questions now:
- Is this debugging information still usefull, when the game is finished? I think it's an important question, because this debugging takes up a lot of disk space. Without the debugging stuff my game is 104kb and with debug info it is 174kb.
- And second, how is your debug file setup? Now, I'm just writing some text with an indentation. Something like this:
you might want to do something like
#define LOG(text,num) (#ifdef DEBUG WriteLog(text, num) #endif)
i think that will work to only log when you compile in debug mode
as for debug file setup, i use variable arguments
so i can do something like this:
WriteLog("Error: something failed, returned %d", ReturnVal);
if you want this and aren''t sure how to do it, let me know
#define LOG(text,num) (#ifdef DEBUG WriteLog(text, num) #endif)
i think that will work to only log when you compile in debug mode
as for debug file setup, i use variable arguments
so i can do something like this:
WriteLog("Error: something failed, returned %d", ReturnVal);
if you want this and aren''t sure how to do it, let me know
This game is made in VB, so I can''t use precompiler commands and macro functions.
And for the function you''re using, looks interesting. What you''re trying to show is a method that has the functionality of the printf function in C, am I right? If so, no, I don''t know how to implement this and yes, I would like to know
.
btw, do you only log error messages? As you can see in my example, it logs some general information, too. I also log the game events that happen (like: went game_over, starting new game, new high score is reached, ...). I think this is all unnecessary information.
And for the function you''re using, looks interesting. What you''re trying to show is a method that has the functionality of the printf function in C, am I right? If so, no, I don''t know how to implement this and yes, I would like to know
btw, do you only log error messages? As you can see in my example, it logs some general information, too. I also log the game events that happen (like: went game_over, starting new game, new high score is reached, ...). I think this is all unnecessary information.
after i went and wrote that message i looked back and realised you probably were using VB - Sub Main() 
well instead of using preprocessor defines, you could always just make a global variable debug, and then check if its on before printing debug info
what i do, is print debug info in debug, and only print errors in release
as for variable arguments, im not sure if its even possible in VB
well instead of using preprocessor defines, you could always just make a global variable debug, and then check if its on before printing debug info
what i do, is print debug info in debug, and only print errors in release
as for variable arguments, im not sure if its even possible in VB
I also use a debug file, but I don't write alot of info in it, usually stuff I need to know 
There's no "good" technique-"bad technique
It's just a debug file 
I usually use it when I need tomake sure an if statement is performed or something similar.
There are another 100000 ways to do it (ASSERTs, Message boxes etc.) but I'm just used to a debug file
I think writing information from the actual game is useless, maybe it's good for trying out a new feature, but not for debugging/profiling because it can take down the FPS.
I also use variable arguments, here's the code:
Very handy when your debugging.
EDIT: Oops, forgot you were using VB, I don't know how to use variable arguments in VB
- Goblineye Entertainment
The road to success is always under construction
Edited by - Tornado on October 25, 2000 7:25:38 AM
There's no "good" technique-"bad technique
I usually use it when I need tomake sure an if statement is performed or something similar.
There are another 100000 ways to do it (ASSERTs, Message boxes etc.) but I'm just used to a debug file
I think writing information from the actual game is useless, maybe it's good for trying out a new feature, but not for debugging/profiling because it can take down the FPS.
I also use variable arguments, here's the code:
|
Very handy when your debugging.
EDIT: Oops, forgot you were using VB, I don't know how to use variable arguments in VB
- Goblineye Entertainment
The road to success is always under construction
Edited by - Tornado on October 25, 2000 7:25:38 AM
I know this is off-topic, but I must say, I''m pleasantly surprised. That log-file sample looks nice, and I wasn''t expecting you to have used VB! People are using the tools that they are comfortable with to produce great things. Power to you, I know nothing about VB 
People might not remember what you said, or what you did, but they will always remember how you made them feel.
~ (V)^|) |<é!t|-| ~
People might not remember what you said, or what you did, but they will always remember how you made them feel.
~ (V)^|) |<é!t|-| ~
Hello, again,
To bad, but you can''t do that in VB. You can only compile to the release version. There isn''t anything like a debug version.
I know it''s possible to use variable arguments in VB, but I don''t know how. I could look it up in the MSDN, but I''m at work now and we are working with Linux here.
But don''t mind, I know C, too (a little). Thanks for the source. However, there are some things that I don''t understand.
What is a va_list data type and what do the functions va_start, va_end and vsprintf do. And what is the ''output'' variable used for?
The return statement is clear, though
.
And what made you think I wasn''t?
quote:
Quantum
what i do, is print debug info in debug, and only print errors in release
To bad, but you can''t do that in VB. You can only compile to the release version. There isn''t anything like a debug version.
quote:
Tornado
EDIT: Oops, forgot you were using VB, I don''t know how to use variable arguments in VB
I know it''s possible to use variable arguments in VB, but I don''t know how. I could look it up in the MSDN, but I''m at work now and we are working with Linux here.
But don''t mind, I know C, too (a little). Thanks for the source. However, there are some things that I don''t understand.
What is a va_list data type and what do the functions va_start, va_end and vsprintf do. And what is the ''output'' variable used for?
The return statement is clear, though
quote:
MadKeithV
That log-file sample looks nice, and I wasn''t expecting you to have used VB!
And what made you think I wasn''t?
I guess my experience as a professional programmer has made me pretty blind to a language other than C++ - I wasn''t expecting anyone to make a full-blown, well-thought-out piece of software in a language like Visual Basic..
People might not remember what you said, or what you did, but they will always remember how you made them feel.
~ (V)^|) |<é!t|-| ~
People might not remember what you said, or what you did, but they will always remember how you made them feel.
~ (V)^|) |<é!t|-| ~
va_list is c++ struct used to save somekind of data.
va_start initializes va_list.
va_start(arg_list,text);
here arg list is va_list and text pointer to start.
Then he writes with vsprintf text in va_list to buffer.
If buffer includes data he writes it to file.
Power of va_list is that you can use macro va_arg after list is initialized with va_arg to retrieve current data,same time macro va_arg moves pointer to next argument.
After all is done you set the pointer to null using va_end.
Output is C++ file stream and operator << is overloaded so that it writes text to file.
va_start initializes va_list.
va_start(arg_list,text);
here arg list is va_list and text pointer to start.
Then he writes with vsprintf text in va_list to buffer.
If buffer includes data he writes it to file.
Power of va_list is that you can use macro va_arg after list is initialized with va_arg to retrieve current data,same time macro va_arg moves pointer to next argument.
After all is done you set the pointer to null using va_end.
Output is C++ file stream and operator << is overloaded so that it writes text to file.
Well, MadKeithV, thanks for the compliments. I believe such techniques (like debugging) should be used everywhere, no matter what language you''re using.
I started this thread because I wondered if debugging is an important thing in games. Like in UT: they also log everything. How else can they generate their NgLocalStats. (With NgLocalStats you can see how many frags you have made, how many kills with a specific weapon, how many suicides, .... You can let UT generate a HTML overview of all your games you''ve played).
And if you use debugging, how to do it. Do you write to a simple text file, or do you use a more ingenious XML like framework.
Anyway, I think my technique is satisfactory for now. It''s a simple Tetris clone, so...
Oh yeah, Jaxks, the output stream is something like cout and cin then. How can I tell ''output'' to which file to write to?
I started this thread because I wondered if debugging is an important thing in games. Like in UT: they also log everything. How else can they generate their NgLocalStats. (With NgLocalStats you can see how many frags you have made, how many kills with a specific weapon, how many suicides, .... You can let UT generate a HTML overview of all your games you''ve played).
And if you use debugging, how to do it. Do you write to a simple text file, or do you use a more ingenious XML like framework.
Anyway, I think my technique is satisfactory for now. It''s a simple Tetris clone, so...
Oh yeah, Jaxks, the output stream is something like cout and cin then. How can I tell ''output'' to which file to write to?
Well, since I''ve never had the (mis)fortune of working on a fullscreen-only application, and I''m a Visual C++ 6.0 only user, I get away without logging so far. I make copious use of TRACE and ASSERT ( which are debugger utilities, TRACE outputs a formatted string into the debug window, while ASSERT stops execution and breaks to the offending line of code if a condition is not met ).
Logging with XML would be nice, but I imagine you''d have to do a lot of tool-writing to read the info you''ve just written out! HTML is a good compromise, I''ve used that on occasion.
People might not remember what you said, or what you did, but they will always remember how you made them feel.
~ (V)^|) |<é!t|-| ~
Logging with XML would be nice, but I imagine you''d have to do a lot of tool-writing to read the info you''ve just written out! HTML is a good compromise, I''ve used that on occasion.
People might not remember what you said, or what you did, but they will always remember how you made them feel.
~ (V)^|) |<é!t|-| ~
Oops, Sorry soehrimnir, Forgot to mention ''output'' is of type ''ofstream'' (A C++ File Stream, As Jaxks said) 
- Goblineye Entertainment
The road to success is always under construction
- Goblineye Entertainment
The road to success is always under construction
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement