09 Mar, 2009, JohnnyStarr wrote in the 1st comment:
Votes: 0
Quick thought,
I've thought allot about a web (browser) based OLC.
Starting as a simple site to add rooms, items, mobs etc.
Well i played around with a Rails site, and i was thinking about having this
grand SQL backend etc. but i realized, since the mud project i'm using will
use YAML as the database, why not just make a site that reads one YAML file
at a time? Like, load up some objects in the session, change things around and
on update, update the file?

Is this a bad idea?
09 Mar, 2009, Barm wrote in the 2nd comment:
Votes: 0
I'm using YAML for my project. It's so much nicer to hand edit than XML.

My directory structure is broken into modules, with each module containing directories of items, npcs, help texts, player classes, etc as individual YAML files. At some point I'll probably serialize the objects they create for faster loading (with an option to re-build from scratch). Players will be stored in a SQLite database since they'll require continuous updating. If I add OLC later I'll stay will YAML and just move storing it in text files to storing it in SQLite tables.

This is what my data directory looks like atm. The config.yml in the middle holds server configuration. Ignore the player directory, it's going away.

|– base
| |– faction
| | `– pirate.yml
| |– gender
| | |– female.yml
| | |– group.yml
| | |– male.yml
| | `– neutral.yml
| |– guild
| | |– fighter.yml
| | |– priest.yml
| | `– wizard.yml
| |– help
| | |– create.yml
| | |– done.yml
| | |– gender.yml
| | |– guild.yml
| | |– help.yml
| | |– name.yml
| | |– password.yml
| | |– race.yml
| | |– review.yml
| | |– topics.yml
| | `– wizard.yml
| |– item
| | |– bag.yml
| | |– candle.yml
| | `– coinpurse.yml
| |– npc
| |– player
| | |– anonymous.yml
| | |– jack.yml
| | `– jill.yml
| |– race
| | `– human.yml
| `– room
| |– load_character.yml
| |– lobby.yml
| `– new_character.yml
|– config.yml
`– test_module
|– faction
|– guild
|– help
|– item
|– npc
|– race
`– room
|– crypt_stairwell.yml
|– lower_chamber.yml
|– start.yml
|– stone_landing.yml
|– upper_chamber.yml
`– vault.yml
09 Mar, 2009, elanthis wrote in the 3rd comment:
Votes: 0
staryavsky said:
Like, load up some objects in the session, change things around and
on update, update the file?

Is this a bad idea?

Yes, it is a very bad idea. You should never, ever have two different apps directly editing the same datastore, especially when we're talking about non-ACID-compliant data stores like text files.

SQL is much safer, although it is still not perfect.

You really want to have your web interface talk directly to the MUD for data lookup and manipulation. This guarantees that your running MUD always has a 100% consistent view of the data. The easiest way of doing this is to add an HTTP port to the MUD that allows your web app that the web OLC system can use for reading and writing data. It could be a YAML-based RESTful interface or an XML-RPC interface or a JSON RESTful interface or whatever you find easiest to work with. In "enterprise software development" parlance, this would be called a multi-tier architecture. Your architecture would look like: web olc <-> mud server <-> data storage (instead of having web olc <-> data storage and then a separate mud server <-> data storage).
09 Mar, 2009, JohnnyStarr wrote in the 4th comment:
Votes: 0
Wow, thanks for that information. I appreciate it.
So when it comes to using the site to access the mud, can i send
direct commands? thats totally awesome, never heard of it.
09 Mar, 2009, David Haley wrote in the 5th comment:
Votes: 0
HTTP is just a text protocol, so yes, your MUD can act like a web server. Is that something you really want to do now? Probably not, at least not until you have solid basics :wink:
09 Mar, 2009, elanthis wrote in the 6th comment:
Votes: 0
HTTP is easier to code than TELNET. It actually _is_ a line-based protocol, so the code in most MUD servers can easily be repurposed, or so I hear. ;)
09 Mar, 2009, JohnnyStarr wrote in the 7th comment:
Votes: 0
my idea was just to use YAML to load / edit .yml files that i would use.
I dont see the difference in this and Diku's .are files.
my view is it wouldnt necessarily be OLC in that its real time, it would just
be a cool way to do it then when i have my files up to date i could just do a
reboot / reload of the data.
09 Mar, 2009, elanthis wrote in the 8th comment:
Votes: 0
Nothing wrong with YAML.

The problem is synchronization. Say your MUD starts up, loading from the files. Then you use OLC and edit some files. Now you reboot the MUD, which saves the current state back to the files… overwriting your changes. Unless you separate the transient data into separate files and then never allow the MUD itself to change area data, OLC would thus require that you shut down the MUD, make edits, and then start the MUD back up. Not a problem if you make the OLC system talk directly to the MUD, plus you get the realtime updates thing for free.

That can actually be really useful. Imagine being able to view a list of _active_ mobs in the OLC interface, create single-instance items in the world, view active players, etc. Really useful.
09 Mar, 2009, JohnnyStarr wrote in the 9th comment:
Votes: 0
Totally rockin' idea Elan, what kind of coding would i research
to do this? is that like HTTP socket programming or something?

PS, i use a hosting company to host my mud, so would i have to
have them give me port access for HTTP? Thanks
09 Mar, 2009, David Haley wrote in the 10th comment:
Votes: 0
You would have to learn about socket programming in general, and then about HTML so you know how to generate valid HTML, and then about the HTTP 1.0, 1.1 or 2.0 protocol (probably 1.x is sufficient) so that you can deal with the protocol communication.

And yes, you need always need ports open to do anything useful with networking.
09 Mar, 2009, elanthis wrote in the 11th comment:
Votes: 0
HTTP is the clearest option. Nothing stops you from just using something over TELNET, e.g. ZMP. That would require a lot more effort though. HTTP is fairly simple, assuming that you have no need for advanced features.
09 Mar, 2009, JohnnyStarr wrote in the 12th comment:
Votes: 0
yeah well this sounds like the best approach so far.
I mean i dont see anything better than building an internal OLC interface via command line, but it would just be cool to do it through http too.