Mob, Room, Zone lookup

Posted by Fletchling on Fri 22 Dec 2006 09:01 PM — 3 posts, 14,427 views.

Australia #0
Nick, and assorted Mush Gurus,

I'm about to start a project that builds a table of 8 columns, including mob names, room names, zone name and other related information. The uses are pretty obvious and varied for playing. Ultimately the table will have about 28k records or so.

The things I want to do in general include;

1. Populate the db with info from the mud,
2. Manually populate the db via an alias,
3. Update records via an alias and triggers,
4. Perform lookups of some fields based on the content of one or more other fields,
5. Delete records via an alias,
6. lots of other similar....

Viable spproaches I can think of so far include;
1. Tables of tables,
2. CSV text file,
3. ODBC connection to Access or MYSQL.


I'm using 3.82 (about to upgrade to latest version after backup) and Lua. I have legitimate access to all MS products. My question is which approach I should take that doesn't lead me into a dead end or slow performance. Any links to previous forum posts and guidance/tips appreciated.

Thanks.
Australia Forum Administrator #1
For a comparatively small database a Lua table should work fine, and be very fast. Your only main issue would be to save it from time to time, something you wouldn't need to do with a database.

However I think it would save pretty quickly, and you could either save every time you make a change, or on a timer that fires every couple of minutes.

Lookups should be very fast, and if performance is an issue, which I doubt, you can make lookup tables. That is, for any given table one field can be the key (eg. room vnum). You could make a second table which keys exits (eg. to find which rooms lead to another room).

However a linear search may well be fast enough.

As an example I loaded up my file of rooms used for a recent post about pathing. This consists of 1549 rooms, their descriptions and exits.

I then did a linear scan (that is, examined every entry) looking for the word "Dairy" in the room name with string.match.

The whole process, including loading the 127 Kb rooms file, and scanning each room, happened so fast it was hard to measure, but was certainly under 1 second.

Thus I think you will find that Lua tables will give good performance, and be flexible enough to allow looking at the data in any way you want.

Australia #2
Thanks for the advice Nick.

Lua tables need to be serialised to save between sessions?
If so, is there a maximum size for serialising, bearing in mind the 28,000 records ultimately?