A Conversation for The H2G2 Programmers' Corner

Text Based Games and HTML Parsers

Post 1

26199

Hmm, does anyone have any experience in the world of online text-based games? I mean MUDs, MUSHes, MUCKs, and all the other oddly messy sounding bunch... grin...

I'm writing one, y'see, I wondered if there were any old hands hanging around these parts...

And if not... the formatting in my game will internally be specified using HTML like tags... then converted to ANSI or other formats before it gets sent to the players... now, I've already written something which'll do that, but, it kind of lacks sparkle... does anyone have experience in neat and intelligent ways of doing that sort of thing?

Any sage advice appreciated smiley - smiley

26199


Text Based Games and HTML Parsers

Post 2

Dancer (put your advert here)

Actually, the best way to do this is keep your information in XML and use an XML parser to create the data to be sent.

Xerces is a good free parser, You can download it from http://xml.apache.org

Yours
smiley - hsif
Dancer


Text Based Games and HTML Parsers

Post 3

26199

Hmm. That does sound like a good idea smiley - smiley

Although it needs to do clever things, like tags that randomly display one of a set of strings, and tags that display different text depending on certain in-game conditions... are those kinda things doable in XML?


Text Based Games and HTML Parsers

Post 4

MaW

Depends how you handle it. Straight XSLT transforms might not be able to do it, but with a decent parser I don't see any reason why you can't take the document tree which the parser generates, play with it a bit (dealing with those elements) and then use XSLT to output it, or just traverse the tree with your own algorithm to generate the output.

Alternatively, you could develop and implement your own markup system specifically designed for your needs (okay, so I always go for the hard way...)


Text Based Games and HTML Parsers

Post 5

Peet (the Pedantic Punctuation Policeman, Muse of Lateral Programming Ideas, Eggcups-Spurtle-and-Spoonswinner, BBC Cheese Namer & Zaphodista)

I wrote a couple of "educational" text adventures for Aberdeen Council back in 1986... I was just using "The Quill" on Sinclair Spectrum machines, plus an editor I wrote in QL BASIC... smiley - erm


Text Based Games and HTML Parsers

Post 6

26199

Hmm, nod, I'll certainly look into it... I'm starting to gain a healthy appreciation for the idea of letting other programmers do a good deal of the work for you... grin... alright, so doing things yourself from scratch is fun (well, not quite from scratch - I'm not writing my own compilers in assembler smiley - smiley), but so is an end result that does what you want it to do...

Thanks for suggesting it, anyhow, it may save me some hassle smiley - smiley

Hmm, I take it you two are strangers to the genre, seeing as you haven't commented on the whole game aspect?


Text Based Games and HTML Parsers

Post 7

26199

Three, hi there Peet smiley - smiley

Hmm... well, that's a start smiley - smiley

Have you played with multi-player text adventures at all?


Text Based Games and HTML Parsers

Post 8

Peet (the Pedantic Punctuation Policeman, Muse of Lateral Programming Ideas, Eggcups-Spurtle-and-Spoonswinner, BBC Cheese Namer & Zaphodista)

I played a little MUD on a DEC 20/50 in 1980... smiley - winkeye

With multiplayer stuff, you need to decide on the communications model you will be using. A single central server guarantees that everyone sees the game messages in the right order, but it's a "brittle" system. All players are relying on a single machine having the bandwidth available to cope with them.

A distributed server system such as used for IRC is far more robust, but introduces the concept of "lag", where different players may see messages appearing on screen in different orders. With a large number of players, this system is far more stable, so if you think it's going to be popular, the game should be designed with lag in mind from the outset.

smiley - geeksmiley - ok


Text Based Games and HTML Parsers

Post 9

26199

Hmm... I don't think 'm planning on ever really having more'n a hundred players there at once... so in terms of bandwidth, that's going to be fairly minimal... hmm...

I'd love to do a peer-to-peer based game, but that's moving away from the traditional single-server model, which is what 'm going for this time... hmm... maybe a future project smiley - smiley


Text Based Games and HTML Parsers

Post 10

Martin Harper

Bandwidth isn't the issue - it's lag. That's the time taken between sending a message and it being received - and it's pretty much independant of the size of the message - at least for the type of game you're talking about. The internet distance between players is far more important - if everyone's going to be on the same LAN, you can get away with a lot more...

To my mind, effectively dealing with lag is a critical issue for online multiplayer games. If you don't deal with it, or deal with it poorly, the game's sunk without trace.


Text Based Games and HTML Parsers

Post 11

Peet (the Pedantic Punctuation Policeman, Muse of Lateral Programming Ideas, Eggcups-Spurtle-and-Spoonswinner, BBC Cheese Namer & Zaphodista)

smiley - geeksmiley - ok


Text Based Games and HTML Parsers

Post 12

26199

Hmm. I suppose that is true... certainly, players in MUDs I've been to that have fast connections... cable modems, etc... have advantages over those on 56K modems, simply because they suffer less lag.

Then again, I hate 56K modems, so maybe I should just hope the world will get rid of them while I'm not looking smiley - smiley


Text Based Games and HTML Parsers

Post 13

Peet (the Pedantic Punctuation Policeman, Muse of Lateral Programming Ideas, Eggcups-Spurtle-and-Spoonswinner, BBC Cheese Namer & Zaphodista)

It's best to assume tht everyone's on a 28.8 modem, and in a different time zone... If you design the game with that in mind, it should work under pretty much all "real-world" circumstances. smiley - smiley


Text Based Games and HTML Parsers

Post 14

DoctorMO (Keeper of the Computer, Guru, Community Artist)

Don't forget the Hack protection. !smiley - smiley

-- DoctoRMO --


Text Based Games and HTML Parsers

Post 15

26199

Hmm, 's probably about the safest type of multi-player game for that one... all data stored on the server, nothing local... and only text-based server-client interaction.

Still, yus, 's always something to worry about, there'll be someone who tries to cheat, or just tries to upset the server...


Text Based Games and HTML Parsers

Post 16

DoctorMO (Keeper of the Computer, Guru, Community Artist)

or figures out a way to couse a /0, all well. I just went though a search engine writen in CGI and buffered all the things that people shouldn't have access to, but they can if there cleaver enough or stupid enough.

-- DoctorMO --


Text Based Games and HTML Parsers

Post 17

MaW

You might also improve speed a bit by compressing all the text going back and forth with zlib or something (just remember to use a very new version of zlib, there are security holes in some older ones).


Text Based Games and HTML Parsers

Post 18

DoctorMO (Keeper of the Computer, Guru, Community Artist)

MaW ---> Theres a person in the Programming Corner waiting room, awaiting his membership. <----

Thats a quaint idea.

-- DoctorMO --


Text Based Games and HTML Parsers

Post 19

26199

Ah, but in the great tradition of such games, you should be able to play using telnet...

Still, I'll do my own client as well, an' there's no reason that shouldn't have compressed text... hmm... it could be useful in some cases, bulletin boards full of messages, that kinda thing...


Text Based Games and HTML Parsers

Post 20

MaW

Yes DoctorMO, and what does that have to do with me? I don't run the Programmers' Corner.

Definitely worth looking at, 26199


Key: Complain about this post

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more