Archived

This topic is now archived and is closed to further replies.

Psybr

in-game console

Recommended Posts

i read the zen of direct3d, and in the book theres a chapter on quake-style consoles. the books 2d code seems very slow and cumbersome to me, and much of the code seems unnecessary to me, so can anyone point me to a tutorial on consoles? by console, i mean like something in game where you can type commands and stuff, and have the game read them

Share this post


Link to post
Share on other sites
pretty sure that theres a tutorial hosted here on console development, if not then check flipcode.



/* Ignorance is bliss, then you go and spoil it by learning stuff */

Share this post


Link to post
Share on other sites
Surely it''s pretty simple?

I don''t know anything about D3D but in OpenGL I''d create a quad which covered the bottom third or whatever of the screen. Should be easy enough to code this so that it stays still instead of moving around with your scene.

I use NeHe''s basecode which has support for fonts built in. Then it''s just a case of tying input and output streams to the functions to display the fonts.

- seb

PS all the above is just a guess, but it''s how I plan to make a console soon.

Share this post


Link to post
Share on other sites
One quad for the console background. One quad for each character. Can''t get much simpler than that.

Get the Quake1 or Quake2 source code. See how they really implement their console.

Steve ''Sly'' Williams  Monkey Wrangler  Krome Studios
turbo game development with Borland compilers

Share this post


Link to post
Share on other sites
Problem is that when you use font support, you have to keep a big char array to store all previous text or else it will be wiped on the buffer flip...
-Jesse

Share this post


Link to post
Share on other sites
It won''t actually have to be that big. Ideally, to remember the last, say, 256 lines in the console, you''d have an array char* ConsoleText [256] and each individual line you''ll create dynamically. Since most lines are very short or blank, this would be ideal and memory-efficient, I think.

~CGameProgrammer( );

Share this post


Link to post
Share on other sites
big char array? (that sounds menacing)
oh, you mean a string...and...it wont be too big, prolly around 100-200 bytes
think about it, thats almost nothing

The way i implemented my console, was to basically make it the same as the chat messages. I tied the event loop to a struct that added and displayed the messages (max of 10 on screen at 1 time). When i told that struct to add the msg, it checks to see if the message is a control string (like "exit"), if so, it does that command, otherwise it sends the string to the server, assuming it''s a chat message. Sounds like it''ll work for me.....

Share this post


Link to post
Share on other sites
Think: Allowing the user to scroll through previous messages, that's what I'm talking about... No, it's not horribly large, but I find it hard to justify using precious memory on a stupid console... Anyway, the scrollable console is what I implemented in my past engine build because the debug info got so lenghty it couldn't fit neatly on one screen...
-Jesse

Edited by - SIGMA on January 30, 2002 9:58:01 PM

Share this post


Link to post
Share on other sites