365. MR/MV Coordinate SystemTo: sam@rinkworks.com Subject: MR/MV co-ordinate numbering system (was For 'F"mapmaker"B) Date: Tue, 24 May 2005 15:17:17 +0100 (BST) On 21 May, Sam posted to the Forum for Banan's benefit: > > Small correction. The numbers onscreen go from 1-30 > > and 1-20, not 0-29 and 0-19. > > Oh yeah. Heh -- the *code* counts coordinates from 0, > but I forgot that I add one before displaying it to > the user. That confuses me every single time. > > S "has to think of a better numbering system" am Dear Sam, I suggest that in whatever administrative tools you use (the equivalent of admin.sma for your Smash games), and in whatever layout files you have, if you're editting them directly, you should see locations described in the same co-ordinate system that users see, i.e., 1-based rather than 0-based. It's a pretty obvious requirement for the games engine ... but only in hindsight. The big problem in making the conversion now, I suppose, would be converting your existing configuration. I don't know whether the simple trick of { read_level_file_using_old_code(), write_level_file_using_new_code() } will do the trick? (And I'm sure you could find lots of volunteers to do the conversion by hand -- since that would involve getting free maps :-).) Thanks once again for a great site, It's hard to convey my reaction on this one. It's one of the few times I've been at a loss for words for how to respond. I guess mostly I'm just aghast at how much this guy assumes he knows about the code for the Murkon games and all that. Why is matching up internal and external numbering systems a "requirement," let alone an obvious one? It can't be a *requirement* if everything works, and the only negative side effect is that I (and only I) get confused once in a while when someone tells me what coordinates they're seeing, and I'm looking at my code. However inconvenient that discrepancy may be to me personally, the fact is, computer code tends to be cleaner when you start with zero, and humans tend to want to start at one. So you write code with 0-based numbers and add one whenever you display that to the user. It's a pretty standard practice, not just in games but in software in general. Moreover, the suggested method of converting the internal numbering scheme automatically is so far off the mark, it's crazy. It's not the level data that matters so much; it's all the pervasive logic code that loops from 0 to n-1, and the display code that applies the +1 adjustment. I dunno -- maybe the main thing is that I was just astounded that I wrote a demonstrably working game, and somebody who's never seen the code, never found a bug, and can't back up his own point came along and told me it was all done wrong. It's no more or less outrageous than any of these emails, really. Makes me wonder what the difference is when I take affront at one such email and just bust out laughing at another. |
|