Best way to do a dialogues, logical

D

Duno

Guest
Hi guys, I’m up to do game with lot dialogues and I’d like to hear your experience.
What you think is better: write the dialogue right in the code or
read the text from external file.
Thanks for responds.
 

Yal

🐧 *penguin noises*
GMC Elder
Hi guys, I’m up to do game with lot dialogues and I’d like to hear your experience.
What you think is better: write the dialogue right in the code or
read the text from external file.
Thanks for responds.
There's no "right" or "wrong" way to do things in programming, each way has pros and cons.
  • Right in the code (I'll interpret this as "only use hardcoded text strings, no variables")
    • + Easy to make
    • - It's hard to change the text later because you need to find all the text separately
  • External file
    • - Takes time to load at start of game
    • - Easily tampered by the player
    • - The file might be gone if the game didn't install correctly, and you need a way to handle that
    • - Connection between code and text is less clear
    • + Easy to make translations (replace the entire file)
    • + Can be updated independently of the game
    • - Possible format issues (e.g. Unix/Windows newlines)
  • Global text array (basically the file approach, but you set up the data in-game instead of externally)
    • + Stays with the game, so you can't lose it
    • - Connection between code and text is less clear
    • + Possible to have translations by replacing the entire array
    • - You need to update the game to update the text
    • + Format is guaranteed to be Game Maker's native
  • Per-object variables
    • + Easy to make
    • + If something needs to be changed, it's easy to find
    • - Updating text or making translations still require you to go through every object separately
If you need a certain feature: pick an approach that supports it (has it as a "+"). Otherwise, pick whatever has the most flaws you can safely ignore. (Aka if a problem won't be a problem to your particular, it's not a problem)
 
Top