I’ve been trying to learn Gdevelop by working on a type of game I used to play/create on old Macintosh systems as a kid: A point & click adventure game and text parser (via the software World Builder). I like having a text parser because I feel solving puzzles is more rewarding when the player can issue specific commands based on the scene’s puzzle (rather than just clicking the ‘use’ button and trying every object in the inventory on every object in the scene).
I seem to be getting pretty close to a working text parser with Gdevelop by using a Text Entry object paired with a Bitmap Text object. However, I’m noticing there are a few approaches to text fields, and—being so new at this—I wanted to see if there’s a better way to accomplish my goals.
Here’s a summary of my current set up (as an example, let’s say the player enters “Use screwdriver” into the Text Entry field): If the return key is pressed, the Text Entry object is disabled. Then, I Compare two Numbers set as: StrFind(Parser.String(),“Use”) ≠ -1. Next, I have a sub event that uses the same process to check for the word “screwdriver”. If yes, and the player has a screwdriver in their inventory, the player will use the screwdriver (if screwdriver is missing, system responds “You don’t have a screwdriver!” If the player entered in something like “Use super powers,” or “use spatula” they’ll receive a reply from another text field that says “That didn’t work”, since the only word the events recognized was “use”.
That system seems to be working pretty well for me, but there are some significant snags. First, I’m using a Bitmap Text object to display the typed commands (to avoid blurry fonts), and it’s clunky: There’s no text cursor, text can’t be highlighted, and the backspace key must be pressed for each character to delete (rather than just holding it down). So in short, it’ll work, but it’s not perfect.
Here’s my second method I’m playing with, and ultimately why I’m posting this now: I just discovered the experimental object, Form Control > Text Input. Oh boy did I get excited when I started playing around with this! There’s a lovely text cursor, text can be highlighted, deleted easily, and it’s even got a spell checker to let my player know that “Scerwdriver” is incorrect!
But oh no! The return key creates a new line within the text area, so my events triggered by Return Key is Pressed do not work while the player is within the Text Input Field. Also: My Compare two Numbers condition is no longer working, because StrFind(TextInputObject.String(),“Word being searched”) returns with an error “can’t find an expression…” It seems I can’t pull string info from the Text Input object. I did find a work around where I still include the invisible Text Entry object and then use StrFind on that, but I can’t use this beautiful experimental object Text Input unless hitting return submits the user input. Is there a way to do this?
I feel like I’m so close, and I’m loving the endless possibilities of different types of gameplay I can incorporate with Gdevelop, but I need to figure out this text parser. A couple years ago, I tried using the game engine Adventure Game Creator, but I felt that the text parser within that software was too restrictive: Instead of the system scanning the text for certain words, I had to create a list of specific words to ignore, and that was very tedious. I want to ignore ALL text except for combinations of the correct words to advance the game. That way if a player types “Go on top of the tree, whistle a tune, then use screwdriver”, the command use screwdriver is still recognized. I did see a TextEntryConsole available as an extension within Gdevelop, but the way it’s set up is also pretty strict in regards to what a player might type (first word is a command condition, and words afterward are assigned as an enumerated argument, which—as I understand it—means that I’d need to account for/predict possible combinations of words a player might type). I want players to type any wacky thought that might enter their head.
Any advice, insight, tips & thoughts are greatly appreciated. For those of you that read my entire post, thank you. I know what I’m looking for is a very antiquated system and that most adventure games are simply point-and-click. But I absolutely adored trying different text inputs as a kid and I want to recreate the experience.
I’m so close!