How can I put debug text directly on game screen?
by H.W. Kim · in Torque Game Engine · 01/28/2008 (7:54 am) · 10 replies
How can I put debug text directly on the game screen?
I want to put it in player.cc and see when I press some keys during the game is playing.
I called 'dglDrawText' but it does not correcty way to do that. There is no text on.
Any easy way to achieve that?
I want to put it in player.cc and see when I press some keys during the game is playing.
I called 'dglDrawText' but it does not correcty way to do that. There is no text on.
Any easy way to achieve that?
#2
I arleady tried Con::printf() function but it is shown on console. That means I can't move the player if the console is open so it is less useful way.
I need other way to put some debug message even move my player.
01/28/2008 (4:51 pm)
Thanks for the reply.I arleady tried Con::printf() function but it is shown on console. That means I can't move the player if the console is open so it is less useful way.
I need other way to put some debug message even move my player.
#3
--You could just write your debug messages into the chat window using the built in messageHud system.
--you could create a custom GUI and use networking (commandToClient should handle your needs) to send data down to that gui (keep in mind that most debug messages are going to occur on the server, but GUI rendering only happens on the client).
--you could create a custom SceneObject that displays data, and stream the data using the ghosting system (not recommended unless the data is simply a couple of numbers--sending text this way is very inefficient).
01/28/2008 (5:13 pm)
Many options----You could just write your debug messages into the chat window using the built in messageHud system.
--you could create a custom GUI and use networking (commandToClient should handle your needs) to send data down to that gui (keep in mind that most debug messages are going to occur on the server, but GUI rendering only happens on the client).
--you could create a custom SceneObject that displays data, and stream the data using the ghosting system (not recommended unless the data is simply a couple of numbers--sending text this way is very inefficient).
#4
It already has what you need, even the gui. For an example, while on a mission, write on the console "mtrics(fps);", close the console and look at the upper left corner of the game screen.
02/02/2008 (12:19 pm)
@Kim, did you ever used metrics() function? I think the easiest way would be to use the mechanism implemented on that function, on .\common\client\metrics.csIt already has what you need, even the gui. For an example, while on a mission, write on the console "mtrics(fps);", close the console and look at the upper left corner of the game screen.
#5
02/03/2008 (2:11 am)
Yes, I copied the metrics system and moved the text display down a line to create an AI specific metrics system that displays under the normal metrics info.
#6
02/04/2008 (3:27 am)
@Novack, Thanks for pointing it out. BTW, I wonder how can I set any value in C++ side then refer it via Torque script global varibale like '$fps'. For instance, where $fps global variable is specified inside C++ code? If I can specify a value on C++ side then refer it via script like $fps, it could be possible to use 'metrics' as you've mentioned. Sorry for the newbie question. :-)
#7
You shall use setLocalVariable() and setVariable(), both defined in console.cc, around line 560. For an example of use, you can check the very $fps case, on main.cc (aorund line 565).
On a side note, a weird thing happen to me, when in MSVC++ Express I searched for "$fps::real", "$fps:" or "$fps", didnt got any results, I had to search just "fps". I guess characters like $ and : are used for regular expressions.
02/12/2008 (11:14 am)
@Kim, again, I didnt saw your comment til now...You shall use setLocalVariable() and setVariable(), both defined in console.cc, around line 560. For an example of use, you can check the very $fps case, on main.cc (aorund line 565).
On a side note, a weird thing happen to me, when in MSVC++ Express I searched for "$fps::real", "$fps:" or "$fps", didnt got any results, I had to search just "fps". I guess characters like $ and : are used for regular expressions.
#8
Yes, at first time I searched with only a word 'fps' and it produces too many result. Useless. Regular expression as you mentioned seems to make sense.
Thank you again.
02/12/2008 (4:54 pm)
@Novack Thank you for the answer. In fact I already solved this problme what like you've mentioned with using setLocalVariable() function. Your advice to see metrics was very helpful. That hinted on me. :-)Yes, at first time I searched with only a word 'fps' and it produces too many result. Useless. Regular expression as you mentioned seems to make sense.
Thank you again.
#9
02/12/2008 (5:16 pm)
Glad it help :)
#10
Could you please post a sample of how to make it all work.
Thanks in advance.
04/22/2009 (8:12 pm)
Hi Kim.Could you please post a sample of how to make it all work.
Thanks in advance.
Torque 3D Owner Marc 'Dreamora' Schaerer
Gayasoft
this will write it into the console ... you could as well use the error function so it is printed in red.
Getting to UI is possible as well but you first must create an UI element you can use to put it there.