Quote:
Originally Posted by cavedude
I'd rather see multiple keys in the DB, I only mentioned Perl because that's the only way a door can have multiple keys at present. Though, I am not sure about adding a new table. I can't think of any door that has 3 or more keys, so I believe we can get by with adding a second keyitem column to doors. keyitem2 I guess.
As for your problem with Perl controlled doors, try turning off your GM flag. I sometimes have the same problem, but when I turn my GM flag off it works every time.
|
Having the extra table would be a viable database solution, otherwise known as a transformation table. This fits better with a normalized database than adding an extra column. Having the extra column as you suggest would have compounded code to check the extra field, whereas with my suggestion we're using the same code to check for a key to work on the door. And like I said, we can just use a view if necessary to read multiple rows of the keys table onto one doors row.. But some doors may have 2 or 3 keys, so we'd need 3 fields? Then what if you need 4 keys? 4 fields? The best solution is just to have another table. Don't let it scare you -- in fact, many of the existing tables could really use some normalization, for both database optimization as well as database integrity. Usually any table with more than 4 columns would be better for the database to normalize it, which is the process of breaking a single table into many based on the kind of information they carry. Essentially break the table into many using some scripts, and then use a VIEW to the joined tables as if it was the original huge table, and you would be surprised by the performance boost. For really large enterprise-based databases this tactic is absolutely essential, by placing specific tables on their own devices (disk drives), usually in some RAID configuration as part of a cluster. Our largest table is Items, and by comparison its very small and hardly grows. But the idea is sound.
When I get a chance I'll do some analysis through the code and compare which would be easier. Going to be busy for this week though, so I probably won't get any time to implement anything until the 28th.
Also with having the extra table, you could create master game keys or master zone keys or anything you wanted, it would really simplify some aspects of custom servers.