   [Newbie] Drop Down Console? How do people do it?
  Hi All.I''m curious to how a CONSOLE is created in games like Quake, etc.i was trying to read over some UConsole code i grabbed from the net, but it .. well .. was not easy for a blond.And besides, i like trying my own code.But i''m curious to how other people IMPLIMENT this idea.do you just make a BOX / 2D plane and have it always above the camera, or something?i have absolutly NO IDEA how people implement this console option.Oh. of course, this drop down console will be used for typing in this to change various states of the game.I hope this make sence, and thanks in advance to any help re: this.-Pure Krome-  
  theres one here, and theres one here but it uses directdraw so it probably wont be of much use to you, apart from the passing text and stuff...  ;  Basicly you disable depth testing and then use glVertex2 to draw a box on the screen. I will leave string parseing and executing commands up to you. If you need help look at the Quake 1 source. It will help you make a much more robust console than any other tut.    InFerN0Not all who wander are lost...  ;  Hi there. Actually drawing a console is quite easy, and it is very simple - that''s not the end of it tho. Quakes console is a very powerful tool. I''m not sure if you have heard of John Carmack speak of "cvars" before, but they are special console variables that you can modify within the console (ie. "fov 90" changes the var fov to 90 degrees). It also supports commands and loading config files, such as "map mapname". It can get quite technical, and is probably WAY beyond anything you want to implement on your own (something to work towards). Have a think about how you might implement various commands and these cvars (hint: unions). Try having a look through some of quake''s src code to see what they do in regards to the "system". The drawing code is quite simple - it''s just 2 triangles rendered with a texture/multiple textures and some font code. Some sections of the code you might like to check out:Cmd.hCmd.c  //command handling code...will give you some ideas about how and what commands can doconsole.cconsole.h //main console codecvar.ccvar.h  //cvar definitions and methodsI hope this helps a little...   ;  Ahh.Thank you kindly to all you folks who have responded.CVars:- I''ve never heard of this technical term before, so thank you for the heads up. This is EXACTLY one of the reasons why i wanted to impliment this idea into my program.So, i will not look at the directx examples, becuase i''m doing this on linux.QUAKE source code was mentioned, with inparticular, some files -> console.h, cmd.hWhere could this be downloaded from? Is this legal?Thank you again.-PK-  ;  The Quake source code is now open src, but is under GPL (so you might wanna read the GPL on it) and it can be found on id softwares ftp site, or anywhere that mirrors their site.ftp.idsoftware.comIf you still cant find it, let me know.  ;  I can remember attempting a console long ago, but never quite succeeding. The topic coming up again has brought around my interests. Since I never succeeded, I am not an expert on it, but I do know a few things.There is no one correct way to make a console. There may be better or more powerful ways, but sometimes the way you come up with could be better with the standard. That is why I feel you should always come up with your own method. Anyway, choose an idea and stick to it (but first check it out with a seasoned programmer). For instance, maybe you could have a data structure array, one for every line, that contains its string and some other vars, and when a new command is entered, the strings could some how be moved up and the new string added to the first slot. That I know isn''t the best idea, but it is a start.A good idea is to stop all ai/game processing, but to keep rendering (naturally) when you are in the console. Nothing sucks worse then to have baddies waste away at you while you enter in the commands. That or course wont work in multiplayer, so you will have to find your own method.Cheers!L8r,The Rainmaker  ;  Well really, consoles aren''t quite as simple as you might think. What is a console? Sure, it''s like a dos console where you can enter commands and the program can print out to it...sure that''s a very simple use for a console. Lots of Quake is designed around it''s very powerful console. It''s part of the "core" engine (in a way). Don''t dismiss it as being too simple.  As I said earlier, drawing the console, storing the lines of the console and all that sort of stuff (visible) is VERY simple...if you are any sort of programmer you should easily be able to implement a very simplistic console that just does as described above. Tying in console commands and cvars in an OOP language like C++ involves lots more messing around, and is actually the harder part.  ;  What if you had a variable data structure for all of the variables that can be edited in the console? This is still limited, but perhaps a struct for allowing decimal(int variable) editing:typedef struct{    char *szRecognizedName; // what the command in the console is    int *value; // a pointer to the variable} cvar;The parser could then cycle through every cvars'' szRecognizedName and see if it matches the first word in the command.So if they entered "cvar_Value 0", the parser would search all of the cvars'' szRecognizedName strings for cvar_Value. If it finds it, value is set to 0, which they entered. when value is set to zero, what it points to is set to zero. Keep in mind, you must save value like this: *value=enteredvalue, not value=enteredvalue. I want to elaborate more but I am in a rushl8r,the rainmaker  ;  don''t forget though, you have to convert the string on the right to an int. You''d get the character 0 instead of 0 itself. or, in a less trivial case, you might get "123.32", then you''d have to write a conversion function. of course, you could restrict cvars to booleans then you can use commands like "set CVAR1" "not CVAR2" "clear CVAR3" and "read CVAR4" to make a very simplistic one to enable/diaable features on the fly  