Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ MUDs
➜ MUD Design Concepts
➜ Handling player/area files - Easiest method?
Handling player/area files - Easiest method?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Dralnu
USA (277 posts) Bio
|
Date
| Mon 15 Dec 2008 11:24 PM (UTC) |
Message
| 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. | Top |
|
Posted by
| Nick Cash
USA (626 posts) Bio
|
Date
| Reply #1 on Tue 16 Dec 2008 04:49 AM (UTC) |
Message
| 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
http://www.nick-cash.com | Top |
|
Posted by
| Nick Gammon
Australia (23,057 posts) Bio
Forum Administrator |
Date
| Reply #2 on Tue 16 Dec 2008 05:16 AM (UTC) |
Message
| Take a look at this thread:
http://www.gammon.com.au/forum/bbshowpost.php?id=6400
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 | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #3 on Tue 16 Dec 2008 05:30 PM (UTC) |
Message
| 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
http://david.the-haleys.org | Top |
|
Posted by
| Dralnu
USA (277 posts) Bio
|
Date
| Reply #4 on Wed 17 Dec 2008 03:55 AM (UTC) |
Message
| 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. | 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.
19,112 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top