[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUDs
. -> [Folder]  MUD Design Concepts
. . -> [Subject]  Handling player/area files - Easiest method?
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?

Handling player/area files - Easiest method?

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Posted by Dralnu   USA  (277 posts)  [Biography] bio
Date Mon 15 Dec 2008 11:24 PM (UTC)
I'm in need of suggestions of ways (be it via markup language or something else) to handle the storing and usage of info in flat files for use in the MUD.

I have looked at XML and S-Lang (which looks like a Lua-style scripting language), but I am unaware of any other options.

I find XML to be far to verbose and to much of a pita to work with unless much of the work is automated, and S-Lang, being a scripting language, brings me to wonder whether I could write this info in Lua.

Databases, on the other hand, are something I'm not going to use right now.
[Go to top] top

Posted by Nick Cash   USA  (626 posts)  [Biography] bio
Date Reply #1 on Tue 16 Dec 2008 04:49 AM (UTC)
While I could argue that a database would save you a lot of trouble from the beginning, I understand reluctance to use it for something as simple as a mud.

I know there is a good table system in Lua that could probably simplify your storage and loading of data if you were willing to use Lua. David and Nick and probably elaborate more on that then I can.

There are libraries out there that can automate XML formatting for you so you don't have to bother with it, so you might consider that. However, if you are looking for portability, working with third party libraries can sometimes be a pain and potential roadblock.

~Nick Cash
[Go to top] top

Posted by Nick Gammon   Australia  (21,534 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Tue 16 Dec 2008 05:16 AM (UTC)
Take a look at this thread:


That describes using Lua to read in stuff (eg. configuration) into a C (or C++) program.

Lua really has all you need to do that sort of thing - in fact it started its life as a simple system for reading configuration files.

The good thing about the Lua data structure is you can nest things (eg. a table of all rooms, and for each room it could be a table of all the attributes of the room, and the contents of the room could be a further table).

Probably your only stumbling block is to move data from the Lua script space to your program space - although one approach would be to not bother - whenever you want data (eg. about a room) you simply pull it in from the Lua space.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #3 on Tue 16 Dec 2008 05:30 PM (UTC)
Nick pretty much said what I was going to say. The only thing I might add is that it's not too bad to just use Lua as a parsing library. Basically, instead of the silly (read: error-prone and hard to use) parsing that SMAUG does, you can use Lua's tables as a natural file format. You could then move the data into C/C++/whatever, or as Nick said, leave it in Lua. (But that can make the interface a little annoying, depending on how you set things up.)

I agree that XML is rather excessive for these purposes.

The nice thing about using Lua is that you'll be building a framework for having a whole scripting language at your disposal. If you start thinking about how to tie it in from the beginning, you will save yourself all kinds of trouble when it comes to putting in a scripting language.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

[Go to top] top

Posted by Dralnu   USA  (277 posts)  [Biography] bio
Date Reply #4 on Wed 17 Dec 2008 03:55 AM (UTC)
I was planning on using Lua as a scripting language to avoid having to mess with anything similar to smaugspells or whatever it was called. Knowing I can use Lua to load everything is even better.

Thanks for the thread.
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum

[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]