Tuesday, October 6, 2020

The Fears of an Ambitious Indie Developer

Whoa, this blog hasn't been updated in months now! With that last blog post, you might've assumed I went insane due to fears of color association or something. Well, despite a certain infamous game's "gremlins" showing me how dumb this world can be with restrictions and morals (which kinda discourages me), I haven't disappeared...though I now have fears that if Magical Mary were to become popular, that people would scrutinize every line of my code and hate me for the slightest offense, though people should be more open to others in my opinion.

My recent (real) fears and frustrations with people aside, Magical Mary's development has definitely slowed down, and this blog post will explain my mind's ideas of plans that are way too massive to go through with...

Starting Small

Before I get to the main point of this blog post, let's talk about a nice improvement made recently: the music system rewrite. For basically all publicly-released versions of Magical Mary (World of Kirbycraft and Mary's Magical Adventure included), level music has been queued up using an ACS script, named...well, numbered 254. (That's a very bad habit; Don't use outdated numbered scripts, people!) This script would look up the corresponding filename in a LANGUAGE lump (which was used to bypass having to make a string array that would be in memory constantly), then would forcibly start playing that song for the current player.

The one problem with this script was, well...what would happen if the player started drowning, which temporarily takes over the music? Also, how would it handle temporarily switching to "Fight Trap" during forced battles, only to return to the level's music after it's over? Well, it's complicated. Just...take a look at the scripts responsible. At least I'm not afraid to show this mess of code:

The infamous game has spaghetti code? Well, my code is like tangled-wires by comparison!

Yeah, I warned you, the old code really was the worst way to write a "music system". It's hard to even tell what any of the code does at a glance! Anyways, as for those two scenarios I mentioned, this is what both did:

  • Drowning - The game sends a weird command to script 254, which somehow makes it store every player's current songs into an array awkwardly named "pn_254_temp". It then overwrites the music with the drowning song (#11), which plays until the player dies, exits the water, or grabs an air bubble (which isn't even in any of the levels), at which point it restores the song ID stored in that array.
  • Forced battles - Rather than storing the current song in that array (which is so confusingly-handled that I honestly forgot about it when I programmed the ACS script for this), I'd just overwrite the player's music with Fight Trap (#4) then restore the level music using one of the ACS script's arguments.

Notice how both of these don't sound like they're the "right way" to handle music-switching. I bet other games have multiple slots for music, so jingles and temporary music can take over then give back control more naturally. I thought of this recently and decided to throw out the old, flawed system and add in a new, much better system that's still compatible with existing "script 254" calls.

With the new music system, there's five music slots, each of increasing priority, which the game constantly checks for, intelligently switching which slot it plays music from. Here's all of them, from lowest to highest priority:

  1. Level music - As it's always playing throughout the level and doesn't need to be changed often, this is the lowest-priority slot. (Yes, no longer does the drowning music override this!)
  2. Temporary music - This slot is for things like forced battles.
  3. Jingles - Though secret areas just use GZDoom's built-in code for that jingle, the sound-playing part could be scripted in the future, allowing them to...pointlessly cut off and restart the music. (There'd definitely be an option to disable that!)

    This slot would also be used for extra lives if they were still in the game. If you're expecting the drowning jingle, that doesn't use this slot, as it's too important to be cut off by secret areas and the like...
  4. Drowning music - To prevent it from being restarted by jingles and lesser-important things, which would make the jingle fall out of sync with the five-second countdown, there's a fourth music slot designated entirely for the scary drowning music...and to think I was scared of Sonic's infamous jingle but yet I put something like it in my own game...
  5. Transformed music - Though there hasn't been music heard while transformed in any version of the game, there's still a fifth slot for if I ever want to add it in. It's higher-priority than drowning music, as well...unlike Sonic, you can't drown when transformed in my game.
Here's the entirety of the updated music system. Some of the code might be illogically-written, but hey, for someone who hasn't gone to any kind of programming class, surely this is decent, right?


The Conflicting Thoughts

With the music system rewritten from (mostly) scratch, you may wonder, what about the other scripts? I'll be more honest than a certain infamous developer and admit that my game's ACS code is built upon older versions of itself; If I added a new feature, it would get added to an existing script or would be intertwined with other unrelated code. Some of the scripts in the game even date back to early World of Kirbycraft versions, complete with weird/incorrect indentation! Compare these two pictures, and you'll see the "PlayWindSound" script still in v2.1 can be found all the way back in World of Kirbycraft v1.0!

Magical Mary 1 v2.1-dev

World of Kirbycraft v1.0 (w/ SLADE open for proof)

 Okay, I've been avoiding naming him for all of this time, but this is probably the same way YandereDev programs his own overly-ambitious game, never refactoring his code, leading to him not wanting to work on his own game while he brings in money for barely doing much himself. I know that because...I think I have similarities like this to him; I've never refactored my code (with the exception of the music system) and surprise, surprise, it's led me to not feeling like developing my game!

 It may seem like something I shouldn't do, with how my mind is slowly becoming less interested in doing anything, but I have to fight against it somehow or I'll become useless...and worse than that developer up there, who at least has unfair free volunteers I'll never get. (Anyone reading this want to volunteer for me? I'd love it so I stand a chance!)

The Cycle (and a lesson)

Erm, anyways, my initial problem with Yandere Simulator aside, I feel that even though I don't want to do much work, I at the same time keep getting ideas that I should just refactor the code, rewriting some parts and pasting in the ones that I don't believe I could do better on. What stops me from doing this is just knowing that a lot of the game will become unplayable until the refactor is complete, and if not that, then the fear that some things may break unexpectedly or behave worse than the existing scripts.

This is the cycle that keeps going on in my mind lately; Part doesn't want to do anything, making it worse. Another gets mad at people in this world not being open to those that "crossed the line" without giving second chances where they may be deserved. The last part wants me to refactor my code, but then the worries I mentioned come to me, and the first part restarts the cycle, making me feel like watching videos over doing anything. Even years ago, I did more than this. Have the...other gremlins (since I'm one too) discouraged me from wanting to truly become popular, in fear that I could become like that developer and grow a group of people that genuinely hate me?

Ugh...I guess this is something to learn from; Reading about and seeing Yandere Simulator break in many different ways may be fun, but don't read too deep into it or you may become like me, discouraged that I one day could be in a similar situation to YandereDev, with a really ambitious game that I feel is too big to truly finish, but I don't want to cut it down, but some of my fans could turn on me. (Also, no, don't worry, I promise I haven't done anything "bad" like YandereDev and more recently, DrApeis. You could say the worst thing I've done is got cups out of trash cans.)

No comments:

Post a Comment