Taggrin Posted May 16, 2016 Share Posted May 16, 2016 Personally I am a huge fan of games from the 80s and 90s. I thought it was time to revive an old genre: text adventure games. In this game you are stuck in an abandoned nuclear power plant and you have to find a way out. For the people who are not familiar with these types of games: you type in commands to control the game. After each successful command you will receive a new dialog so you continue. Most commands are pretty short, for example 'GO EAST', 'GET KEY', 'OPEN CHEST'. Just write down what comes in your mind, think logical! I also added some Unix bash, memes and other things as "Easter Egg" commands. Try to find some! You can play it on my website: http://taggrin.com/games/radiation.html For hardcore text adventure players: the "fastest" route you can take is 48 steps, but you probably will take a lot more during your first play. It is not really necessary to use Phaser for this type of games as the same can be done in vanilla JS, but to make it really easy to load in some sounds and images I used it anyway. ecv 1 Quote Link to comment Share on other sites More sharing options...
danyburton Posted May 17, 2016 Share Posted May 17, 2016 It's quite enjoyable, although I don't have time to finish it. maybe later Quote Link to comment Share on other sites More sharing options...
Umz Posted May 17, 2016 Share Posted May 17, 2016 It's a good one. Never been a fan of the text adventures myself, but it looks and responds well, and that's what counts right. How are you doing the text input? Directly on canvas or the absolute box thing? Quote Link to comment Share on other sites More sharing options...
Taggrin Posted May 17, 2016 Author Share Posted May 17, 2016 55 minutes ago, Umz said: How are you doing the text input? Directly on canvas or the absolute box thing? The game is constantly looking for any key press (onDownCallBack). If the keycode matches A-Z, 0-9 or space it will append that symbol to a text object and update the text so it shows on screen. Umz 1 Quote Link to comment Share on other sites More sharing options...
ecv Posted May 24, 2016 Share Posted May 24, 2016 This is one of my favorite genres. I've spent so many hours playing these games. So far I'm liking yours, although I already got stuck, but I'd rather not ask for advice cause I don't wanna spoil the fun for others. I love the music, it definitely adds to the atmosphere, and the sound FX are cool too. The game's been quite logical so far, which is great and not so common. Lots of old titles had scenes that were anything but logical. Now for the suggestions and stuff you might not wanna hear: Entirely a matter of preference, but I wonder if the game would gain with graphic backgrounds. Maybe the first text adventures didn't have, but I can't recall any which did and spoiled my fun. Perhaps even looping videos to add more depth, which is perfectly doable nowadays. Two things annoyed me: you need to write the complete commands and there's no input history you can access by pressing up. If you made a typo, you'll need to type again, and in long words like screwdriver and flashlight, it's a nuisance. There should be no need to say "go north" when "north" is just as good, despite not being grammatically correct or complete. "N", "W", "E", "S" were pretty common. I once tried to make a text adventure for android (which I abandoned as usual, such is my curse) and I recall simply matching through regular expressions worked quite well. Yet another suggestion: divide user input from game replies. This way one doesn't need to retype "look" or so, so often to read again. The elevator: it took me about 10 minutes to figure out the correct command to make it work. I mean, I had tried "GO FLOOR 2" already, "inspect elevator" (in case I could find a darned button), "press 2", "press number 2", "go up", "go 2", "2", etc. That was frustrating and I think it could have been solved if regular expressions were used. Anyways, I enjoyed the game, and I plan on continuing playing tomorrow, see if I can move on, cause I just wanna headbutt the darned clock. I'm genuinely interested in the source code or rather discussing the general workflow/design. I have a rough idea of how these are planned, but the relationship between objects, other objects and verbs, remains kind of mysterious to me. I've never read text adventure code but super simple ones. Cheers and keep making more Quote Link to comment Share on other sites More sharing options...
Taggrin Posted May 24, 2016 Author Share Posted May 24, 2016 10 hours ago, ecv said: This is one of my favorite genres. I've spent so many hours playing these games. So far I'm liking yours, although I already got stuck, but I'd rather not ask for advice cause I don't wanna spoil the fun for others. I love the music, it definitely adds to the atmosphere, and the sound FX are cool too. The game's been quite logical so far, which is great and not so common. Lots of old titles had scenes that were anything but logical. -snip to avoid post flood- Anyways, I enjoyed the game, and I plan on continuing playing tomorrow, see if I can move on, cause I just wanna headbutt the darned clock. I'm genuinely interested in the source code or rather discussing the general workflow/design. I have a rough idea of how these are planned, but the relationship between objects, other objects and verbs, remains kind of mysterious to me. I've never read text adventure code but super simple ones. Cheers and keep making more Thank you for your really detailed review . First of all the backgrounds: it is actually something I considered. My initial idea was to draw some simple 8bit style rooms or even use ASCII art. However, in the end I decided not to as in general I take way much longer to draw sprites for a game than to actually code it (I made the "engine" of the game in like 2 afternoons). Since I want to get more games on my websites I decided to scrap that idea. Instead I added some sound effects, music and the old TV effect to the game to make it feel more alive without taking too much time. Commands are a real pain to think of. First you might come with the idea of pulling a lever, but then later you also think that some people may use the command "use". Also some people might say switch instead of lever. I tried to think of as many common phrases as possible, but it will always happen I miss a few. I agree the elevator could use some more valid options. The arrow up for history is simply missing as this game is not played in a real terminal. I cheated some way to make it look like a terminal, but it does function far from that. As for the workflow: it pretty much is a ton of loops and if/else checking where you are and what you say. I have a room variable (0 to 17) which helps identifying where the player is. If the player would say "GO EAST" it first splits the command. The first split is "GO" so it knows it has to move and then it will check the other positions in the command. If that is empty it will ask "Go where?". In this example it is "EAST", after which it will check which room the player is in. If it is possible to move east in that room it changes the room variable and prints the lore. If not, it will instead note the player that you can't go there. At the end of the direction checks there is an else catching other words which do not do anything, like "GO TO CAR", after which it will reply with "Only understood as far as 'GO'.". And that works pretty much the same for all commands. Check the first word, then the other words and the room number, act on a match and handle mismatches. Items work similar but instead of having a room number restriction they use booleans to check whether you have an item and whether you have used the item already or not. I believe it is around 2000 lines looking for specific patterns. I have no doubt there is a better way to code it, but hey this was easy to do and it works! ecv 1 Quote Link to comment Share on other sites More sharing options...
ecv Posted May 24, 2016 Share Posted May 24, 2016 Thank you very much for sharing this. That was interesting. So you're using procedural programming for this. That's a lot of work and a lot to be careful about, man. But it's great, I like it. I just finished the game! That was a bit short but, yes, I still think it's very well designed and logical. The message about the clock not having a battery cover was misleading for me. I was thinking there must be a battery inside, just there's no dedicated battery cover to access it, just the whole clock cover, or something, when actually it meant that there was a battery slot with a missing cover that was supposed to go there. Hehehe If you got any other text adventures I can try, let me know. Thanks! Quote Link to comment Share on other sites More sharing options...
copman Posted May 24, 2016 Share Posted May 24, 2016 really good! i like this! reminds me of games for the old commodore computers! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.