• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Make a Textbox engine from Scratch

E

ethian

Guest
Greetings

Currently using GMS2 with the subject of the textbox on my game, i finally decided to make a textbox engine from scratch, identical to the full ones that are for sale in the marketplace, the difference is don't use them on my game because of my lack of virtual money...
It must have the next features:
  • Closed inside a sprite box, it just features 3 lines of text as maximun...
  • Typewritter-like typing text
  • Play sound when typing (Customizable via Interactible object/NPC object Creation Code)
  • When typing, perform a short pause at commas, and probably dots, double dot and dot and coma...
  • If the main character is at the top of the screen, the textbox is at the bottom of the screen and if the main character is at the bottom of the screen, the textbox is at the top of the screen.
  • When typing, the sprite of the one who is responsable of the current dialougue (Face in textbox and Overworld NPC (Both of them customizable via Interactive Object/NPC object Creation Code)) becomes animated, when isn't typing, unanimated...
  • When the text stops and it's complete, an arrow in the bottom right position of the box appears telling to you: "You can continue with the next dialougue by pressing z".
  • Some characters/words are of different colors (Custom per Dialougue)
  • Characters sometimes shake or move on circle (Optional via creation code or something else, if the variable "canshake" is true to make characters shake, and "cancircle" is true to make characters move on circles...)
  • "Skip" the dialougue by pressing x while typing (Make the rest of the typing text type already, making it finished)
  • Just continue with next dialougue by pressing z when text is not typing and it's complete, if out of dialougues, textbox disappear.
And the important question for start: what is the most basical point to start to make the engine from scratch? For later continue implementing the features of adove? In a safe order?

(i was working with GMS2 before, but i'm now working with GM:S now... see what comes next below...)
 
Last edited:
C

CptChuckles

Guest
Your starting point would be making the box appear and disappear when the NPC triggers it. Then make the textbox type out short lines of text; don't worry about scrolling or multiple sections, just get one sentence to type out and then when z is pressed close it. You can work on doing multiple lines from there.

This is similar to a project I did years ago which displayed books, much like you'd find in Skyrim. Each book had custom text that was loaded in from a .txt file in the game's directory. The book object would tell the text-parser what file to open, and then everything else was automatic. It didn't type out, but that's only a small difference. So I suggest you keep dialogues either in separate files or separate resources, and have each NPC simply tell the textbox which resource to lookup/load, and that's pretty much all the NPC does.

As for word highlighting, pauses, etc. I would suggest you encode those kinds of things into the message, such that as the text-typer algorithm parses out the text, it reads those codes first and then displays the text accordingly. So you could have a message like this:
Code:
Watch out for $rMonsters.
The text parser would iterate over the characters, look out for '$' and think "oh this character signifies that there is a color change coming up", it would then parse 'r' and know "ok r right after $ signifies red, so switch the draw color to red for the next letters" and then it would continue typing the letters in the new color,
and what the player sees would be "Watch out for Monsters."

In general, I suggest inventing a set of preprocessor markup tags that the text-parser reads and does different things. Then you can code all the special text-style events in the message text resource itself, just like color: you could make another special character to signify delays or changes in typing speed, one for special event cues, etc.
 
E

ethian

Guest
Watch this tutorial:
Oh... i'll do what you gave to me this weekend... i'm currently on a trip where i take a break, and it will end tomorrow... taking the break i'm taking it's really good, trough...
Also...
Code:
Watch out for $rMonsters.
"Watch out for Monsters."
That is because the Textbox is powered via script instead of object, because of the "$r" that, as appears on the script, if "$r" is on the message, the rest of the text becomes red...
Hmm... i was thinking also on make the textbox be script-powered...
Ah! And i forgot to put something more on the festure list:
  • If the main character is at the top of the screen, the textbox is at the bottom of the screen and if the main character is at the bottom of the screen, the textbox is at the top of the screen.
 
Well, in much the same way with a text editor, if you change the colour for a word, you usually have to change it back after you've typed that word, so it'd be like "$rMonster$b" or something.
 
E

ethian

Guest
New News...

I started to work with GM:S like before again... much easier, much more issue-less compared with GMS2 and much more fun to work! (for me...)...

So, let's reboot the thread starting with what GM:S tutorial should see to get started from scratch?
 
E

ethian

Guest
Hey, the time for implement a textbox on my game, came!

I just followed this tutorial:


Now is the hour of implement the features of adove

Help me, please?
 
E

ethian

Guest
Hey! Isn't over!

I just want to make an object that has the textbox feature...

With editable strings, and duplicate that object for make the other strings...

The issue is... i don't know how to get started by make the string write like it was a typewritter... sound included...

The object can be an object or an script, for the other features...

So, help me, please?
 
E

ethian

Guest
Try this guy's tutorials:
https://www.youtube.com/playlist?list=PLmSKZ2VXUPYi0inJ1DTHrHq2LG1kwLzx-

They're what I used. It's an Undertale-like dialogue system. It answers to a lot of your requirements you listed, but not all of them. You may need to adjust a few things to meet your liking though.

I strongly encourage you give it your own touch though. Be original! :)
I renember i used what was before...

I didn't liked before but i like it now...

Thanks for everything...
 
Top