The last fortnight has been pretty productive. I’ve worked harder than previous weeks, chasing after a working GUI system like a person chasing a train. My hand’s outstretched, but I’m not quite close enough to grab on.
My eyes have been on the prize this fortnight – GUI or bust. I made the transition to CEGUI 0.8.x and cleaned up some of my previous initialization code. This involved The Most Boring Code in the world – a function that converts key codes from my main input library (OIS) to the one for CEGUI. This is literally “OIS’ space bar means CEGUI’s space bar”. The mapping is almost trivial but not quite. Some tricksy Emacs maneuvering cut the tedium down a bit, but I still had to check there weren’t any surprises. On the upside, now I support mapping keys to most of the goofy web keys you might have (just in case you like to confirm dialog boxes with the VolumeUp key).
My next bit of coding has been GameStates. A game state a the user interface state like a splashscreen, the main menu, the main game or maybe a pause menu. Each has its own interface elements and shortcut keys. For example, in a splash screen if you spam any key, it should progress to the next state. In the game proper, that key might do something specific.
My system is the usual stack-based approach. It slides in new interfaces pretty easily. Part of this is helped by CEGUI’s GUIContext objects. However in implementing this stuff, I’ve had to figure out how the hell CEGUI works. It’s a fantastic library and it looks easy to get powerful interfaces. But if you don’t know what you’re looking for or how to do something, you’ll be faced with gigantic, indigestible API documentation.
I need to make sure I’ve got the mainline stuff work. This involves thinking through what happens when I run the program to make sure all the pieces are in the right places and working as expected.
So I’m getting there. I was hoping to have a lamo screenshot for today, but alas. It’s like Zeno’s Paradox, but the more I work, the further away the goal is, but only infinitesmially.
I was asked in the last dev report how I think I’ll get the AI Director to bring themes and character points into the game. With actual game programming on the horizon, I’ve been thinking about this stuff lately.
Let me walk you through my latest conception of how the game might work. Suppose we’re playing single player (multiplayer works similarly but you have bookkeeping to worry about). Your first choice is which character you want to play. You make a choice from my fine stable of characters, and are given the option to customize your game even more, or just go with it.
Customization might involve choosing difficulty, length of game, or even things like preferences for levels of violence, horror, and humour. Because I think of The Day After like a graphic novel, I imagine you also having the choice of stories. I imagine this as choosing the title page for a comic. You might have chosen the Courier and have an option between stories, presented like melodramatic monthly comics:
- “Premium Rush“: The Courier is on a bike busting through some psychopaths and there’s a hook line “Can Becky beat the clock or will it beat her… TO DEATH”
- “The Courier in… The Chains That Bind”: The Courier is squaring off against some Psychopaths with her trademark bike chain. The hook line: “Scars are only skin deep.”
- “The Day After… RIOT GRRLS”: The Courier, The Scientist and The Cop are smashing through a street. The hook line: “A bloody revolution!”
The front pages are usually melodramatic or cheesy, but can set the mood between a light action plot, a dark and brooding story and slightly gimmicky setups (to use the three examples above). With the right art direction, you could imitate the gamut of comic book styles from Golden Age silliness, to Frank Miller stylised grit, to the more realistic Walking Dead style. And it’s just the cover. Everyone knows that the comic book cover doesn’t always accurately reflect the art or plot inside.
I’ve been reading the excellent Team Fortress 2 comics. While I wouldn’t want to go as crazy or comedic, they ape the style that could be good here.
So we’ve chosen a story. In the player’s mind this has maybe set them up with some base expectations. In the background the AI Director knows about the option chosen. It sets some parameters, and does some thinking. It might choose a plot package which sets up a few key scenes, and makes sure another character is in your game. From this setup it chooses an appropriate starting point, some hidden style variables and away you go.
The game itself is a series of separate scenes. The AI Director has an internal state corresponding (hopefully) to the current mood and feeling. It also has goals which are things it wants to happen or a mood/feeling it wants to achieve. It’ll have a range of heuristics open to it, and it’s in a constant battle with itself to satisfy those goals (choosing comedic scenes for a light-hearted adventure) and also cause some chaos (dropping in plot twists, mood shifts, or temporary shifts in difficulty). I hope to also encode into it some writer’s instincts like Chekov’s Gun (“if you see a gun in Act I, it better go off by the end of Act II!”) It’ll have plot elements to play with and this will guide later decisions. It won’t get it right all the time – it might want to put the pressure on and accidentally kill a character. How it copes with this will be interesting.
The Left 4 Dead series works in much the same way, although they mostly model stress and only have a few things they tweak in the level (mostly because of the constraints of 3D shooters and having an ultra-polished product). The vignette structure of The Day After allows a playbook approach to the AI Director and a much wider variety of things to use.
Individually everything is written by me, because computers aren’t yet to be trusted with such tasks (it’s an aspirational goal for Kung Fu Chronicles). So on a micro level, I lace in themes and make sure characters are authentic. The AI Director (with detailed yet open-ended instructions from me) pieces it all together.
There’s a lot of work to be done here, not just in having a wide array of scenes to use, but making sure you don’t get weird degeneracies like the AI Director always choosing the same things, or choosing things narratively weird, or choosing scenes to get itself into a broken condition. I have a variety of strategies to employ here: automated statistical testing, playing through games with the AI Director telling me what it’s doing and vaguely why, and just plain ol’ playtesting by myself or others.
The Short and Sweet
Recently completed tasks:
- Boring internal GUI code cleanup.
- GameStates machinery.
- Initial required GameStates for a GUI Demo.
I’m working on:
- The goddamn GUI and making sure my engine all works smoothly.
- Starting to code up the WorldManager (aka the game part of the game)
- Unit tests – oops!