Skip to main content
Added point about localization as was mentioned by Milo Price
Source Link
Christian
  • 2.1k
  • 15
  • 21

There are several reasons for that. I'm just gonna touch on a few:

  1. It makes your source code a mess. If you have a lot of dialog (trees), a huge part of your codebase is just text that has nothing to do with your actual game code.
  2. You'd need to recompile every time you change so much as a single character.
  3. The dialog itself is hard to navigate. I imagine trying to implement a whole dialog tree, let alone several, completely inside your source will result in a nested mess of spaghetti and nested ifs, switches and so on. Which then results in code that is prone to errors, hard to read and harder to debug.
  4. If you want to enable people to mod or expand your game, that's far easier if they don't have to deal with the source code to change something.
  5. The above point is even more important if you work in a team. You don't want your writer to have to mess with the code just to enter a piece of dialog.
  6. Parsing XML or other standard file formats is pretty easy to do if you use existing libraries, so the cost of implementing it that way is very low while giving you lots of advantages and avoiding the problems mentioned above and lots more.
  7. As @MiloPrice pointed out below, it's also far easier to localize the game if your text is in external files. You can add a language by adding a file, your team can take care of translation without having to touch the source (which is especially important if you let people translate who are not supposed to see all of your code - think freelancers, people from the community that don't belong to your team etc).

There are several reasons for that. I'm just gonna touch on a few:

  1. It makes your source code a mess. If you have a lot of dialog (trees), a huge part of your codebase is just text that has nothing to do with your actual game code.
  2. You'd need to recompile every time you change so much as a single character.
  3. The dialog itself is hard to navigate. I imagine trying to implement a whole dialog tree, let alone several, completely inside your source will result in a nested mess of spaghetti and nested ifs, switches and so on. Which then results in code that is prone to errors, hard to read and harder to debug.
  4. If you want to enable people to mod or expand your game, that's far easier if they don't have to deal with the source code to change something.
  5. The above point is even more important if you work in a team. You don't want your writer to have to mess with the code just to enter a piece of dialog.
  6. Parsing XML or other standard file formats is pretty easy to do if you use existing libraries, so the cost of implementing it that way is very low while giving you lots of advantages and avoiding the problems mentioned above and lots more.

There are several reasons for that. I'm just gonna touch on a few:

  1. It makes your source code a mess. If you have a lot of dialog (trees), a huge part of your codebase is just text that has nothing to do with your actual game code.
  2. You'd need to recompile every time you change so much as a single character.
  3. The dialog itself is hard to navigate. I imagine trying to implement a whole dialog tree, let alone several, completely inside your source will result in a nested mess of spaghetti and nested ifs, switches and so on. Which then results in code that is prone to errors, hard to read and harder to debug.
  4. If you want to enable people to mod or expand your game, that's far easier if they don't have to deal with the source code to change something.
  5. The above point is even more important if you work in a team. You don't want your writer to have to mess with the code just to enter a piece of dialog.
  6. Parsing XML or other standard file formats is pretty easy to do if you use existing libraries, so the cost of implementing it that way is very low while giving you lots of advantages and avoiding the problems mentioned above and lots more.
  7. As @MiloPrice pointed out below, it's also far easier to localize the game if your text is in external files. You can add a language by adding a file, your team can take care of translation without having to touch the source (which is especially important if you let people translate who are not supposed to see all of your code - think freelancers, people from the community that don't belong to your team etc).
Mod Moved Comments To Chat
Source Link
Christian
  • 2.1k
  • 15
  • 21

There are several reasons for that. I'm just gonna touch on a few:

  1. It makes your source code a mess. If you have a lot of dialog (trees), a huge part of your codebase is just text that has nothing to do with your actual game code.
  2. You'd need to recompile every time you change so much as a single character.
  3. The dialog itself is hard to navigate. I imagine trying to implement a whole dialog tree, let alone several, completely inside your source will result in a nested mess of spaghetti and nested ifs, switches and so on. Which then results in code that is prone to errors, hard to read and harder to debug.
  4. If you want to enable people to mod or expand your game, that's far easier if they don't have to deal with the source code to change something.
  5. The above point is even more important if you work in a team. You don't want your writer to have to mess with the code just to enter a piece of dialog.
  6. Parsing XML or other standard file formats is pretty easy to do if you use existing libraries, so the cost of implementing it that way is very low while giving you lots of advantages and avoiding the problems mentioned above and lots more.