Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Dear monks,

I am presently undertaking what will forever after be known as 'Tiefling's daft text adventure project'. I am well aware that the advice of many here will be simply 'don't'. I am not deterred. :-)

Some time ago, I wrote a simple text adventure in QBasic, and I was heartily pleased with it. I expanded it, incorporating a rudimentary combat system, and experience, so that it became a crude but playable RPG. But the incoporation of moving monsters made the code elephantine, and DATA lines were overflowing the code size allowed by the free version of QBasic. So I re-wrote the thing from the start. This time I used lots of data files, and used a pointed to move groups of monsters in serial rotation. It coped fine with the file of 1800+ rooms, 200+ objects, and the like, but I was tired of having to read every data item from disk. And then, before the new combat system had been coded, I overran the code size again, and also started getting other spurious, Gates-oriented errors.

I threw up my hands and asked a hacker friend what I should do.

'Use Perl,' he said 'because it has nice, friendly text-handling, which you need lots of, and moreover, you already have it on the Linux dual-boot I set up for you.'

'Excellent!' I said, and set to learning Perl. I studied the wisdom of merlyn, and began to grasp the wonders of the Rubbish Lister.

Then I returned to the text adventure. I managed to write code to convert my Basic-friendly data files to Perl-friendly ones. (I'd used '/' as a list delimiter - what was I thinking?) All went well. The 1800 rooms are now in a format that Perl will read, although I intend to modify that format later.

I got ambitious, and remain so. The new incarnation of the adventure will be a full port of Dungeons and Dragons Third Edition to Linux. (After all, TSR WotC Hasbro has gone all opensource friendly, with the d20 Open Gaming Licence.) So I'm writing the character generator. So far, so good.

But (quite aside from the ludicrous scale of the project) there are a few problems. Traditionally, character generators for CRPGs have had a 'back' function, allowing you to ditch the results of the latest stage and start again with the data from the previous step. I'm trying to figure out a nice way of implementing this. Also, vast amounts of data (character races, skills, feats, spells) will be common to most areas of the code for one reason or another. Everyone says 'use strict'. This will, in my case, mean placing vast strings of my definitions at the head of my program. Is this either (a) normal or (b) avoidable?

I know that these are the queries of an ignorant, over-ambitious novice. But too often, the Right Way to Do X sends me to learn about references, which are all Greek Martian to me, or something similar. I am a mere beginner, but I want to be enlightened.

Tiefling

In reply to Daft text adventure project by Tiefling

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (7)
    As of 2020-11-27 20:10 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?