My in-game console

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Juan

I’m trying to make an in-game console that will make up most of my gameplay, where the user can use the console(debugger) to enter simple commands, i.e., collect_item and the item will be collected. What I want is a custom autocomplete feature that will be able to generate the command for the user, so that they can get use to writing lines of code if they don’t know the first time round what exactly to type.

This would work by for example writing the first letter or word i.e, coll… and then the actual completion of the command appears, therefore collect_item. I was wondering how I could go about this.

Any feedback would be much appreciated.


What part are you wondering about exactly?

If it were me, I’d start by breaking down the tasks. An easy part would be the basic UI setup. Just some control nodes and options to allow typing and show output somehow.

Another part would be algorithms/manipulation to get the elements to autocomplete to. What is the set of commands the user can do that they should see?

By this time, updating the UI to reflect those completions will probably be pretty clear. How can you show the autocomplete options in an intuitive way and allow the user to choose it?

I bet there are examples of basic auto completion on the internet in lots of languages, especially a shell language like Bash. After that, translating to GDScript shouldn’t be too bad

w411-3 | 2022-03-09 02:31