[SOC] incorrect syntax is actually correct.
(**nothing in this issue report is meant to insult or demean any of the people who have worked on SOC and SRB2. I'm sure that none of them could've known about this issue and just how bad it is.**)
According to the Wiki, Action A_SpawnObjectRelative
should cause an error due to missing a =
separating Action
and the A_
value. Additionally MapThingNum =253
also should cause an error. MapThingNum 253
? that's invalid syntax!
In fact, here's 2 excerpts from the wiki explaining this exact fact about SOC syntax:
The character sequence of each text block's parameter must be correct, including the number of whitespaces. Things like
StateS_POSS_STND
orSpriteName= POSS
will not work.The syntax of the blocks is fairly rigid: No additional characters, whitespaces or line breaks may be inserted anywhere inside a block and the existing whitespaces may not be omitted. For example, the lines
Duration= 1
orDuration = 1
would cause an error.
Furthermore, after digging into the game's code I see nothing in the game code that would change any of this. The game seemingly uses =
to differentiate between a field and the value for that field. without it I see no way it could possibly tell.
Though, I did notice that the implementation of the check seemed to differ in really strange ways between each block reading function.
why am I saying all of this?
Because the game doesn't throw errors when you break the formatting like that.
In fact, mod authors have (at least in MRCE's case) been bending the syntax for years! How am I so sure about this?
That's over 400 instances of incorrect Action
lines present in MRCE's SOC files. Some instances are present in objects that have changelog dates going back to 2010. Furthermore, I took one of the major bosses and started randomly adding and removing whitespaces along with omitting the =
on a few lines. No problems. the boss loaded fine and everything worked.
For those who can't read RegEx. That search only returns lines that begin with
Action A_
specifically.
Why is this so big of an issue?
With both code and a wiki dictating that this format should be so rigid that even slight differences in whitespace should be causing syntax errors, the fact none of that occurred for so long that a mod as large and complicated as MRCE has so many instances of this bad syntax has very very frightening implications.
There is a very real possibility that this issue is unfixable in the 2.2 patch cycle without mass mod breaking changes.
There is no way to tell just how many mods have been using this syntax and for how long. There is no telling how many mods are going to break if the SOC parser is fixed to properly follow it's own specifications correctly.
Let's think back for a moment, to what I noticed in the source code. This does not affect every block. In fact MainCfg is immune to this syntax flexibility and will not work without abiding by the rigid syntax. State of course we already know can be bend due to the Action incident in MRCE.
Object additionally suffers these same bugs. I'm sure you can notice the glaring issues with the whitespace and even missing =
and yet no issues occurred during load.
Overall, this seems like a pretty big issue that even if unable to be fixed, is still really important to know about. It directly affects the usability of SOC as it presents inconsistent treatment of syntax in general. I feel like it should be made known that the syntax should not be this flexible and inconsistent.