how to create in-game console like in Quake?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
sandfighter
Posts: 2
Joined: Tue Nov 07, 2006 11:40 am

how to create in-game console like in Quake?

Post by sandfighter »

anyone knows how to start writing my own in-game console? i've tried to build it with the irrlicht interface but it won't work... i only know that a console need something called "parsing language". can you provide me with some external links? or please just tell me how to start thinking about console in my game... :?
Lideln
Posts: 79
Joined: Sat Jun 24, 2006 11:35 am
Location: Paris, France

Post by Lideln »

Hi !

Im not an experienced coder, but if you want some general ideas to follow, here is what I can tell you

Graphically, for the console, you will have one Image, with 2 textbox children.
One will be used to enter the text, the other, multiline, will show the log.

Write an key event handler for the input textfield, and associate the keys you need (UP and DOWN for going through commands "history", ENTER to validate and parse the command, etc.)

To parse the command, you can write a real parser ONLY if you will have complex commands (it cant be explained in 2 lines, you have to search for websites explaining it... In general, you have to use the lex language, and then call your parser from your code).
The other option is to simply parse the command with the C function strtok (look at google to see how it works), and when you have your different tokens (a token is generally a word or an operator), you can call this one or that other function depending on the tokens.

You can also use function pointers.

Make some tests and you'll find the good way by yourself :)

Hope this helps,

Lideln
--
Lideln, France
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

a few people have already made these, there's one by rambus in the code snippets forum, there's acki's chat box (which is a good start for someone making their own), and there's at least one more I remember seeing somewhere (as part of irrwizard perhaps?) try searching the forums
as for a console language, you'll want some script integration. there are a few different scripting language implementations knocking around the forums too
Last edited by bitplane on Tue Nov 07, 2006 1:48 pm, edited 1 time in total.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

I would not immediately suggest writing your own parser. It may be much more effective to integrate a scripting engine like gamemonkey, squirrel, python or lua.

Travis
jam
Posts: 409
Joined: Fri Nov 04, 2005 3:52 am

Post by jam »

To add to bitplane's list, mohaps had one called IrrConsole if I remember correctly.
system-independent, adj.:
Works equally poorly on all systems.
-- unknown
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

thinking of having a console in the first place, i spose it's only of any real use if you already have some kind of scripting.
I mean... it's supposed to be a useful debug interface to your scripting engine isn't it?
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
sandfighter
Posts: 2
Joined: Tue Nov 07, 2006 11:40 am

Post by sandfighter »

well... i have already started writing my own FPS, but i need some useful tool to check what can be done in Irrlicht from user interface. a command line is something very helpful. for example if you want to test connection between two computers in your game, just open a console window and type eg.: "connect ip.of.your.friend" and that's the simplest way.

by the way, thank's for all help :)
Post Reply