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

Gammon Software Solutions 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
Username:
Register forum user name
Password:
Forgotten password?

Handling player/area files - Easiest method?

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Dralnu   USA  (277 posts)  [Biography] bio
Date Mon 15 Dec 2008 11:24 PM (UTC)  quote  ]
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.
[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)  quote  ]
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
[Go to top] top

Posted by Nick Gammon   Australia  (19,495 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Tue 16 Dec 2008 05:16 AM (UTC)  quote  ]
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
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Reply #3 on Tue 16 Dec 2008 05:30 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Dralnu   USA  (277 posts)  [Biography] bio
Date Reply #4 on Wed 17 Dec 2008 03:55 AM (UTC)  quote  ]
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.
[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.


3,045 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [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.

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Web site powered by FutureQuest.Net]