Saturday, December 29, 2012

Are You Sure You'd Like To Read This Post?

I've recently been playing around with a version of the ProcessKey routine, part of my compartmentalized-version of EndGame that tries to make it easier to add new choices to the "The game has ended. Do you want to (R)ESTART, R(E)STORE a saved game, (U)NDO your last turn, or (Q)UIT?" text.

In this latest version, opting to restart or quit brings up a "Are you sure?" prompt just as it is in-game. My thinking is that, hey, even though it's the end of the game, we still want to make sure the player really wants to stop the party before we let him.

Of course, some of the appeal is that while the original version of ProcessKey rehashed a lot of the code from DoRestart, DoUndo, and DoQuit (with the exception of the prompt text, of course), the new version is really simple and looks like this:
replace ProcessKey(entry,end_type)
{
    local r

    if not entry
        return -1
    select entry
        case "restart", "r" : r = &DoRestart
        case "restore", "e" : r = &DoRestore
#ifclear NO_UNDO
        case "undo", "u" : r = &DoUndo
#endif
        case SpecialKey(end_type) : r = &SpecialRoutine
        case "quit", "q" : r = &DoQuit

    if not (call r) : return -1 : else : return true
}
The bonus of this is, if your game does anything special with any of these routines, ProcessKey automatically inherits the (hopefully) wanted behavior.

Anyhow, for now, I think I'm only going to keep this code in my "undolib.h" library extension because I can see how the new behavior might be controversial. If a couple other people like it (I figure 2 other people is almost a Hugo-users-majority), I'll probably end up adding it to roodylib.

2 comments:

  1. What do you think might controversial? Asking "Are you sure?" when the player selects the end-game option to quit or restart, or the inheritance of DoRestart, DoUndo, and DoQuit in ProcessKey? I can't imagine that the inheritance would be controversial, unless it raises implementation issues that are over my head.

    As for asking the player if he or she really wants to quit, even at an ending, I would like an option to disable that for the "true ending." If the player dies, or more importantly, if the player gets a non-optimal ending but thinks that ending is the only one, it would be a good idea to ask the question to encourage the player to continue. It hints that there is more to see. However, if the player has won the game/finished the story, I don't see any reason to hold the player up.

    ReplyDelete
    Replies
    1. Yeah, the controversy is that it'd ask "are you sure?" every time. Personally, I kind of like the idea of making the player linger in their victory after having beaten the game, but this dilemma is why it won't be added to Roodylib right away.

      Delete