🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

How to program dialogue for a game?

Started by
11 comments, last by Alberth 4 months, 2 weeks ago

@Alberth That sounds like another solution, yes.

Advertisement

RmbRT said:
That sounds good, but may be quite a bit more complex once you want to localise to other languages

I didn't consider localization, but just because I use a concrete sentence doesn't mean it's the only solution. You can instead use a suggestive name like care_for_a_garden_walk_invite instead of the text. The computer can collect them for you (I tend to be as lazy as possible 🙂 ), and generate files (one for each language) for the actual text like

care_for_a_garden_walk_invite : are you interested in a walk in garden ?
no_i_am_busy : ...

Alternatively, you can put all languages in one file, much alike the conversation

care_for_a_garden_walk_invite
en_us: are you interested in a walk in garden ?
en_uk: are you interested in a walk in garden ?
..

no_i_am_too_busy
en_us: Go away, I am terribly busy
...

And of course, my examples are just about defining the interaction and the actual text, it doesn't say anything about how to implement it. So you can use classes etc.

Typically, you first try a small example, to work out what code you exactly need. Once you know, write Python (or other) code that prints the same pattern, for all dialogs you defined in the text files, in a fraction of a second.

Never do anything the computer can do faster or more precise 🙂

This topic is closed to new replies.

Advertisement