jonm / SillyMUD

SillyMUD, a derivative of DikuMud
Other
8 stars 5 forks source link

Some mobs have bad stat blocks #59

Open dangitall opened 8 years ago

dangitall commented 8 years ago

Issue:

Mobs with an S designation in tinyworld.mob should have the following format for the second line of stats according to the code in db.c:

%d %d %d %dd%d+%d %dd%d+%d

But at least a handful of them have:

%d %d %d %d %dd%d+%d

That is, the 4th stat is just a number instead of a die + bonus spec. This is causing random values to be read off the stack in db.c. It seems to work almost all of the time, shockingly, but I've seen it crash the game on occasion.

Possible fixes:

There are 141 mobs with the S designation and 36 of them have this problem:

grep -A 1 'S$' tinyworld.mob | grep -v 'S$' | grep -v -- '--' | grep ' [0-9]\+ [0-9]\+d[0-9]+[0-9]\+$' | wc -l
dangitall commented 8 years ago

I started digging into the mob spec (oh god why?) and it looks like S indicates "special". My first guess is that the broken mobs above should really be N which seems to indicate "plain ol' mob".

dangitall commented 8 years ago

Also in addition to the 'Possible fixes' above, a 'definite-should-also-do' would be to notice, log, and skip bad mob entries when they are loaded rather than bringing the whole game down.

jonm commented 8 years ago

My vote here is probably just to notice and skip these mobs for now, although changing them to N mobs, assuming they meet the expected schema for that, seems also ok. Really we ought to take them one by one, see what zone they are in and what levels it targets, and then decide what to do with them, but I'm not sure we have the patience for that. :)

Over the longer term, I have also been thinking we should changing the file format for some of the data files either to a structured text format (JSON/XML) or to something like a SQLite database.

dangitall commented 8 years ago

Yeah I was thinking the same thing (JSON/XML). The format now is...fascinating. You'll see a PR documenting it soon.

dangitall commented 8 years ago

At least one other mob (#24773) has stats that don't conform to a valid spec at all. I'm sure there are more. This code definitely needs rewriting/better error handling.

dangitall commented 8 years ago

PR #86 fixes the crashes, though the invalid mobs still exist.

dangitall commented 8 years ago
Bad stats for mob Radioactive Rat near pos 141448
Bad stats for mob antelope near pos 142034
Bad stats for mob atomic near pos 143453
Bad stats for mob baby eagle near pos 141837
Bad stats for mob baby otter near pos 142392
Bad stats for mob duodrone near pos 144547
Bad stats for mob giant lizard near pos 141250
Bad stats for mob giant snail near pos 140910
Bad stats for mob great quasit near pos 145509
Bad stats for mob green turtle near pos 141648
Bad stats for mob large orge near pos 154582
Bad stats for mob mongolman near pos 143953
Bad stats for mob monodrone near pos 144324
Bad stats for mob mudman near pos 144120
Bad stats for mob ogre cook near pos 155124
Bad stats for mob quadrone near pos 144998
Bad stats for mob roc near pos 145705
Bad stats for mob small wasp near pos 143054
Bad stats for mob stirge near pos 142881
Bad stats for mob tridrone near pos 144773
Bad stats for mob weasel near pos 143223
Bad stats for mob young mule near pos 142227