Sorry, I’m not a mod and definitely wasn’t trying to call out you, or anyone in particular! Just pointing out that while responding to the stuff folks have posted is naturally what tends to happen in a thread, in this case discussing whether or not something is bad maybe goes against the amnesty vibe that will hopefully invite more folks to share their crimes (a more serious thread about ambitious coding projects that didn’t quite work out does sound interesting, though – I’d just agree with Aster that it might make sense to separate it out).
To keep the ball rolling, I thought of another one from my first game: I created a puzzle midway through where I needed to check whether the player’s action was a noisy one. Inform creates a clean, elegant way to handle this – just create a kind of action and then use an after or report rule to check – except that I’d built my entire conversation system as a series of one-off “Instead of asking NPC about TOPIC” rules, and instead rules sidestep that whole elegant system. So I coded up a global variable to mark noisy action and then manually set it in every single one of those stupid rules (my coding style involves a lot of copy-and-paste).
Nope I don’t see anything wrong with that either. My One King game of IFComp was coded like a table driven state machine. Limited in scope but good enough for what I wanted to achieve in my first game…
1 Spent the better half of a month on creating a maze - only to find out Inform had trouble finding its exit - so I created another program to ‘solve the maze’ and create a list of hints to help Inform guide players to the exit. Maybe I’ll add it to my next IFComp game - if beta testers manage to find the exit, that is.
2 Had this super clever idea of using Inform Doors in an unorthodox way - making them undescribed when closed - so I could use them to implement magic portals, the boat crossing the river, secret exits and the like - real clever, I thought - until I realized I forgot about the gate at the South Bank - which DOES function as a normal door and should be mentionable by the player. So I panicked and add extra tests to oh please recognize the gate even when closed
3 Did someone mention switch statements? I think the most complex bit of code is my undo function which needs to undo whatever the player did last, and depending on the state of the game: stop right there (normal play), keep undoing until detecting a room change (undo flow), keep undoing until the very start of the game (when re-entering the palace). And oh yeah when fake restarting the game undo everything… I probably would have made it easier on myself if I had split it up a bit into more manageable pieces.
So you made big modifications to doors to make them work differently, then had to make modifications to the modifications to make one work just like a regular door? That is hilarious, and I’m also kind of jealous I’ve never thought to do anything like that
Yeah of course I totally overlooked I could just have created a portal as a kind of door and make portals undescribed when closed. Much cleaner (I call this “eagle-eyed hindsight”).
And oh yeah the very last door the player passed through (ending up in the bedroom with Lydia) is a scenery door. Nobody noticed AFAIK and it was a simple copy paste error (I forgot to delete the original definition as scenery, and Inform accepted all of it without a complaint).
I don’t know if it technically counts as a coding sin, but I was once working on a tile-based 3d game and wanted a 500x500x500 grid to be loaded into memory. So far so good, the problem: I made it in Java, which has quite a bit of overhead for each object… The whole 3D array ended up hogging 8GB of RAM… If I ever manage to actually make that game I’ll use a language where I can manage memory better and probably use a smaller area. In my Java version I settled for 150*150*50 I think, which also had acceptable memory costs.
Still using <center> to centre the text or an element because I can’t be bothered to use the stylesheet or in-line CSS. Not sketchy per se, but bad form for sure.
Honestly, this whole file to try to make a parser work in SugarCube with the built-in macros (it’s allllll widgets and it’s not even organised correctly but it works… ish? if you put the correct commands it does?).
Not organising the Stylesheet until 2-3 updates down the line so you end up with a bunch of unset to override previous rules because you can’t be bothered to edit the correct line.
Empty <<if>> or <<else>> cases! Especially in Headers/Footers (I mean not anymore, but used to be a thing.
Created an ungodly amount of variables to track some actions that could have been tackled with a simple function… (or forgetting about a variable meant to track something and creating a new one).
This is not at all something I would do now, obviously, but when I was little, I didn’t understand how to properly draw graphics to the screen; for some reason I thought you would hand-draw a whole frame for every possible game state.
So I did. It was a top-down maze game. I routed between all states using goto, and every state had its own individual keyboard input logic and game logic and everything, copy-pasted everywhere.
Again, I was like… 9 or 10 when I did this, and had just started teaching myself to code.
EDIT: Oh also I misunderstood something at the time and assumed variables had to have single-character names, so I thought I had to figure out how to use only 26 variables.
This is a fun one that comes up a lot in the Neo-Interactives: my debut game, Sweetpea, uses no variables to state track, even though you do navigate around the house and interact with objects like a box, photos, and so on.
I didn’t know how to accomplish that, at the time- and so instead, I simply branched off passages and did plenty of copy, paste, and editing. The trickiest part was making sure that things didn’t contradict each other too heavily if you went out of order among the hallways or windows or rooms.
This is why Sweetpea has an odd bug- it’s not gamebreaking, but it will keep you stuck in a loop if you don’t exit out and proceed to the next stage of the game.
It’s kind of emblematic of what I love so much about Twine: that it’s so accessible to non-programmers. Even if you have no idea whatsoever what a variable is, or how to use one to check stuff against, you can still make a silly little game- a silly little game that people liked enough for it to win both Author’s and Audience’s choice for the Outstanding Horror 2022 IFDB award. :3
Wow, that’s some tough competition! I think I’ll retake my vote and vote for @anon66621404, I think not using variables to track state at all is worse than using a switch and gotos to manage state…
Well, not with goto, but that’s similar to how Android apps (used to) work: You have a stack of Activities (basically app screens) and the top one gets displayed and all input. When the top one finishes it “returns” (or "goto"s) to the one behind it, and it can start new ones above it and hand control over to them. It works similar to a call stack in that way.
Off-topic: Android apps today
Nowadays though the overhead of starting new Activities is usually avoided: You use Fragments instead, which do mostly the same thing, but only use one “screen” from the OS POV, so it has better performance.
To be fair this was definitely the case in at least some dialects of BASIC. Pushing and popping variables on the TI-83+ in order to free up some letters for other use was a pain in the ass.
In my Inform code I have a habit of colossally over-engineering things to avoid messy hacks, which means my coding sins tend to be in the direction of “why did you build an entire subsystem for this instead of just special-casing it when you only need it once”.
But that’s why, in the original release of Enigma of the Old Manor House, you would end up in darkness if you shut yourself in the wardrobe, even if you were carrying the lit lantern. I’d ripped out Inform’s default light-handling code and implemented my own version that suited my purposes better (a terrible idea when you’ve got a four hour deadline) and had forgotten that it was still possible to end up in “Inform darkness” by shutting yourself in a container!
It will come as no surprise to anyone who has made it through reading any of my trainwreck “help me” threads that all my code is an unmitigated disaster. Like, all of it. An example would be: everything. If there’s anything good there, it’s because another person wrote it for me to get me to be quiet and go away. But I don’t care how bad it is. I’m absolutely tickled pink if I get something working on my own, even if it’s awful, and all I care about is that it works.
Honestly this thread has made me feel so much better. Since I’m self-taught I always worry about my code architecture, but I can see now that I’m not alone.
I think the worst thing I’ve done was in SUPER MEGA TOURNAMENT ARC! where I did a training montage that featured something like 15 nested linkreplace macros. I had to add so many comments to keep track of all the closing tags.