dialogue in Grail

I had been thinking about how I wanted to get back into coding. I wanted to start committing regularly to Grail. But when? My week is already pretty full with work and college.

I'd been reading a lot about atypical coding hours on the likes of Hacker News. Apparently the best time to write code is in the early hours of the morning, when it's quiet. I'd also read a bit about The Artist's Way and morning pages. Apparently we're more creative when we first wake up, or something.

The morning seemed like the perfect time to do this. I haven't been able to get up every morning, but I'm getting better at it. Wake up at 4, write code for a couple of hours, then go to work, or sometimes back to bed for an hour or so.

I don't know if I'm any better a programmer at this hour in the morning. Sometimes I feel pretty hazy until the coffee kicks in. But it gives me a set time to write code.

What I've been working on is the dialogue system. It's designed to be pluggable so that a frontend for displaying characters' dialogue can be easily changed. Multiple frontends can be used at once, for example a subtitle frontend displaying subs while a sound frontend plays the recorded dialogue audio.

The two frontends we have at the moment are:

speech bubbles The characters' dialogue appears floating above their heads in their own fonts and colours

subtitles Displays the lines at the bottom of the screen, optionally prepending the speaker's name and using the speakers font

Here's an example of how dialog frontends are defined in a game's Lua script: local subtitles = Subtitles() subtitles.position = VP(2000,2800) subtitles.font = Font("fonts/tommy_holloway.ttf", 45, 1) subtitles.centered = true subtitles.showSpeakersName = true subtitles.useActorsFont = false And here's how they look in action:

speech bubbles subtitles