I recently got into PHP, mostly using HTML and a bit of Javascript before (so not used to all the programming functions and variables of PHP! But I'm getting the hang of it, slowly...), and I am curious about some things.

My first curiosity is whether it'd be possible, via PHP, to make ye olde fashioned Text Adventure (or whatever they call it these days)?

What I'm picturing is sort of... block of text at the top, then a form to type into, and once your commands are put through the form, the text block changes appropriately, etc. etc. And possibly your progress is stored as a cookie...?

At this stage, I want to know first and foremost if this is possible. If you're unable to help or advise me, but know that this is can be done (or indeed, can't), please say. Beyond that, any sort of help would be appreciated, thank you.

Also: sorry if this is in the wrong forum, this seemed like a General PHP issue, but I could be wrong.

    Absolutely. Dynamic scripts is what PHP was developed to accomplish!

      there are many good examples of php created MMORPGs, PHP and MySQL are very well suited to making text-based MMORPGs, although to create something like Jagex's Rune$cape, you should learn Java, PHP has no control over the pag after it is loaded, remember that!

      To make a good PHP MMORPG, you should also employ Javascript to do your clever form effects and AJAX (can't help you there) to make fast loading, dynamoc content... AJAX is very difficult, so I would recommend using Javascript for cool stuff!

      If you already know HTML and Javascript, once you know PHP and MySQL, you can start making your own MMORPG, but try not to get muddled when you are coding, I always put PHP code in my Javascript and Javascript in my PHP!

      Enjoy using the best language around (PHP of course!)

        peccavi, Ajax is simple! Once you get the hang of it, it's actually pretty basic. The only thing I dislike about it is the fact that it basically requires the constant use of innerHTMTL; feels unprofessional to me; don't ask.

          the thing i find annoying is that it gives you no errors!!!

            LOL. Yeah, that'd get on my nerves. As if error checking isn't annoying enough already.

              Instead of emulating it you could actually write your own server which could be accessed via a terminal (telnet / ssh).

                A browser-based adventure game need not feel like a "text adventure" in the traditional sense.

                The key things to look out for are:
                - Users using the "back" button to cheat
                - Other cheats

                If you're just doing a single-player game, there's no reason you can't run the game as fast as the user wants to go. You can use HTML forms (or javascript) to pick up objects, do actions etc, and have buttons to go N, S, E ,W etc.

                In a multiplayer game you'd need some kind of scheduling, for example, allocate the players a given amount of "movement points" and only let them carry out that many actions between ticks (when they are recharged).

                Mark

                  Write a Reply...