Rewriting the cutscene code

Hi Jay,

I’m afraid this will be the post that undoes me, shows me for the sham that I am when it comes to anything technical, which will end with me sticking to posts concerning game design only in the future.

I’ve been rewriting the code that handles how unique story/tutorial events are triggered. There’s absolutely nothing new to see on the game’s surface, but at least now I can add new text to the game with no new code (how it should have always been) or, in cases where a simple check for whether a previous condition has been fulfilled is needed, minimal new code. Or, to be more precise, most of the new “code” gets embedded directly into the story text as my own secret language to handle a range of common scenarios:I have no idea if this is the proper way of doing things, but it works well with my process, with the sacrifice of some legibility. As a self-taught programmer, I have a hard time telling whether anything, like getting text into a game and figuring out when to trigger it, actually just takes that much or if I’m doing it the wrong way. The script is getting ugly—certainly the chosen symbols could use some work—I was running out of those that are readily available on the keyboard. It seems like that ugliness would have to happen somewhere, though, and by having it happen here, at least it’s all in one place and manageable if anything goes awry. (The code that interprets all of the symbols is, naturally, in the worst mess of all, but as long as it works, I can sequester it away and never touch it again, until of course I need to touch it again—OK, my next step should be to rewrite the interpreter.) It seems definitely wrong or at least unpleasant to write or copy/paste directly into Unity,  so the external file is a must, and because events are triggered once the player reaches certain lines of text, it follows that functions should be called directly from here as well.

Doing all of this has helped me think about a few different ways I want text/story to be presented in the game (to be discussed in a future post), and setting that up will probably entail rewriting all of the code I just rewrote again. Ah, if only I had the foresight to know exactly what I wanted in the game, and if only I also knew all of the programming techniques I now know, and will know in the future, so that I could have written everything perfectly the first time and not currently be building upon such shaky foundations.


Leave a Reply

Your email address will not be published. Required fields are marked *