5/7/2023 0 Comments Vvvvvv drillerThis would be as simple as loading the lookup table from e.g. Rather than maintain the lookup table in code as a state array, you may want to refactor it out into a data file so that your fancy GUI editor could be used to modify which handler gets called from each state. "start_game", "start_fade", "next_state_if_fade_complete", "victory"). For example, let's assume for a moment that, using the same strategy as we did for ROOM_0024_ENTER and ROOM_0024_EXIT above, we could distill all of the state logic down into a small number of handlers (e.g. There are of course many more generic approaches, most of which depend on you recognizing patterns of repetition in the state handler logic and finding creative ways to refactor that repetition out into a useful data representation. Nevertheless, it nicely demonstrates an additional way to alleviate duplication and make the code more readable. I've named this next_state_if_fade_complete based on the assumption that this is what fademode = 1 means in the VVVVVV source, but there's definitely some guesswork hidden in that assumption. You'll notice that I took the liberty to refactor ROOM_0024_ENTER and ROOM_0024_EXIT out into a single function, since their logic was identical. I looked at the first few cases of the switch statement: I figured I may as well take this opportunity to check it out. I had heard about the source release of VVVVVV, but hadn't yet had time to read the code. How do u make a story game that doesnt have an 8 thousand case switch statement like vvvvvv? What's the proper way to do it?Īfter asking a few clarifying questions, I determined that what our friend infinitive meant by "story game" was really anything that requires a large number of states with a moderately complex graph of events connecting those states. Here's the link if you want to browse the code yourself:Ī user named "infinitive" in TheCherno's Discord server asked: Shortly after the announcement, a Reddit user by the name of "sevenseal" posted this Reddit comment: On January 11, 2020, Terry Cavanagh announced at AGDQ that he would be open sourcing his well-known puzzle platformer, VVVVVV, in celebration of the 10-year anniversary of its release.
0 Comments
Leave a Reply. |