SonicWorldsNext icon indicating copy to clipboard operation
SonicWorldsNext copied to clipboard

Adding characters is annoying

Open NeonSRB2 opened this issue 7 months ago • 4 comments

Extra characters are somewhat a common want for fangames, even if I really haven't seen that many out there with new ones, people might want to add mighty or shadow themselves or something like that to their games. Unfortunately, it takes a while for that to happen, since characters are almost always referenced via hardcoded tables in the locations they're used. This ends up with having to run around the codebase trying to find all the character specific stuff going on almost everywhere to make the game stop crashing. That's... not desirable for an engine designed to be used for fangames (hence the lack of pixel-accurate precision), so ideally this should be cut down somehow, here's the idea:

  • Remove Player.gd's character table
    • It's redundant, and while it may save your fingers a tiny bit, it only adds another thing to add your character's entry to, and is slightly confusing since it lacks NONE as an entry and therefore not interchangeable. This change would mean that technically NONE counts as a valid character if you force it via code, but that would be much simpler to grasp in my opinion.
  • Make a new character node class to contain various properties that scripts can grab from spriteController
    • This includes palette textures, name, idle sequence, the works. This is probably the most important thing here since at the moment, if a new character isn't referenced in a certain table, the game crashes, which is kinda dumb.
  • Make the stats table independent of character
    • Stats right now are annoying for having character specific logic that really only matters for Knuckles and Knuckles only. I can see people wanting to mess with the stats, but since Knuckles is the only character in classic sonic to have character-specific stats, I think it's worth just making it hardcoded or a boolean to use his stats in the spriteController, as I feel it's safe to assume that most users won't want to mess with them, at least to be consistent with all the other characters.
  • heavy, HEAVY commenting
    • A wiki article on doing so would be best, but unless a team member makes the article after the merge request for this, I assume I'm going to be alone in explaining everything in the code itself. Information on the character system would best be told than just simply observing what is there until it works in some strange way.

At the end of this, Air.gd's abilities, Global.gd's character list, and Player.gd's switching logic should be all the code changes that need to be made for every character added. I'm not entirely sure why I decided to make this given I plan on doing all this stuff right now... but it is what it is.

NeonSRB2 avatar Jul 06 '24 02:07 NeonSRB2