How to make text based games




















Create commands for the first room. Come up with ways for the player to interact with each object you mentioned. At the very least, they should be able to "examine" or "x" each one. Here are a few examples of commands the player can use and the text they see as a result: examine mattress — Stuffed with finest quality goose feathers, most of which are now floating around the room.

Soggy and smells of booze. The bathrobe has a pocket and a cotton sash. It feels like there's something heavy on the other side. Turn the first room into a simple puzzle. A classic beginning requires the player to find a way out of the room. This doesn't have to be a complicated puzzle, just a taste for what your game will be like. It also teaches the player to read carefully and look for hints. For instance, the player might be supposed to do this, after typing the commands above: pick up mattress — As soon as you lift it, a reek of tequila assaults your nose.

That explains why this mattress is soggy The metal bunk frame fell over during the storm, and the only mattress lies torn and soggy in the corner. A liquor cabinet is in the corner. A broken bottle is on the floor. Waste not, want not. Right now you have a a crowbar coupon and a whistle coupon. The coupon drifts away, and a moment later a hefty crowbar falls into your hand.

A growl on the other side startles you. One more attempt should open the door, but you'd better have a weapon ready. It swings open easily, to reveal a large grey wolf staring at you! Better think fast — you can only choose one option.

It whimpers and runs off. The way north is now clear. Part 3. Keep verbs and nouns obvious. As the creator, you'll become so familiar with the terms that they seem second nature. Other people only have a few sentences of instruction to work with. Whenever you add a new command or object, especially one that's vital to move forward in the game, make sure you keep it obvious and simple to use.

Always use valid object names in the room description. For example, if a player walks into the room and sees a description of "a painting," make sure "painting" is the term for that object in your game. If you carelessly use the term "picture" instead, players will have to guess at how to interact with it. Take some time to think about how a player might try to use objects. Make your puzzles feel realistic. Don't let your carefully devised puzzle break the reader's immersion in the setting.

You might feel terribly clever for creating a puzzle that involves a Viking helmet, a stick of dynamite, and a bee hive, but it's unreasonable to discover these items in a spaceship or a high school classroom. Your setting will feel less cohesive, and the items may as well have a neon sign flashing "use me for a puzzle. Make the puzzles feel relevant. There should be a reason your character needs to solve the puzzle. Be fair to players. Old-school adventure games are famous for cruel results such as "You pick up the rock, starting an avalanche that buries you.

Game over. Besides avoiding arbitrary player deaths, here are a few other design goals to keep in mind: [10] X Research source Don't make important events hinge on a die roll.

Provide hints for difficult puzzles, and don't put in more than two or three red herrings. Don't make a puzzle that can't be solved on the first playthrough, such as one that requires knowledge of the next area or a trial-and-error puzzle that kills you if you don't guess correctly.

It's fine to permanently close off an area partway through the game, but the player should be given fair warning before this happens. If a choice makes the game unwinnable, this should be obvious in advance, and it should end the game instead of letting the player keep trying with no hope of winning. Write the endings. Spend some time to make every ending interesting.

If the player loses, he should still get to read a sizable chunk of text that describes specifically what happened, and encourages him to try again. If a player wins, give her a long, triumphant ending, and consider allowing her to spend a couple additional actions savoring the victory in a special end-game room.

Find more advice and inspiration. There are dozens if not hundreds of articles available at Brass Lantern , Interactive Fiction Database , and IFWiki , where you can home in on specialized topics like how to write convincing characters, or how to program objects with complex interactions. Perhaps even more important is the large collection of text-based games at IF Archive , where you can discover what you enjoy firsthand, by playing the games yourself.

Here are a few excellent resources to start with: The IF Gems collection of quotes. Beta test. Once your game seems complete, play through it yourself several times.

Try to cover all the possible paths through the game, including doing things in a "weird" sequence that you didn't intend. Once you've corrected any errors that come up, rope in a few friends, family members, or online interactive fiction players to beta test your game the same way. Encourage them to give feedback on what parts were frustrating or not fun, and consider their suggestions for changes or additional options.

Save often or use the "undo" command, if available, so you can try different paths without starting from the beginning each time. Create the "Start" code. You're surrounded by enemies.

Add the action code. Play again? Click File. It's in the top-left corner of the Notepad window. A drop-down menu will appear. Click Save As…. It's in the File drop-down menu. Doing so will open a Save As window. Enter a file name followed by the ".

In the "File name" text box that's near the bottom of the window, type in whatever you want to name the game followed by. For example, to name your game "Dungeon Crawl", you would type in Dungeon Crawl. Change the file type. Click the "Save as type" drop-down box at the bottom of the window, then click All Files in the resulting drop-down menu.

Select the desktop as the save location. Click Desktop in the left-hand sidebar to do so. You may first have to scroll up or down on the sidebar in order to find the Desktop folder.

Click Save. It's in the bottom-right corner of the window. Doing so will save your game as a BAT file. Run your game. For example, you'll press 1 to start the game. Experiment with the code. Now that you have the basic groundwork laid out for the game, you can edit the code to change the in-game text, add options, and more. To edit your game's code, right-click the BAT file and then click Edit in the drop-down menu.

Make sure you read through the code to understand what each line of text does. After echoing, make a space and write what you want to display in a single line. Not Helpful 14 Helpful A bat file is a batch file, and it runs on cmd command prompt. You can put it on your desktop to make it easier to test your stuff.

Not Helpful 13 Helpful When I click to open the game it opens and immediately closes. Why does it do that? It is because the coding is wrong. Actually there are few lines on the codes that are to instruct us and make us understand, but which are not supposed to be written on the source code code area. So just scan through the code lines and delete those unnecessary lines. Doing this should make your game work. Not Helpful 44 Helpful That depends what you want.

You can find documentation and lessons online. Not Helpful 28 Helpful It's possible your coding does not pause. At the end of your command, type the word "pause" without quotation marks. Not Helpful 25 Helpful When you save the file as. Any help would be much appreciated. Try the following as your while loop:. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Text based games: moving room-to-room Ask Question.

Asked 1 year, 1 month ago. Active 1 year, 1 month ago. Viewed 5k times. You have reached the cellar and defeated the Dragon! Improve this question. Please read about How to debug small programs. You can also use Python-Tutor which helps to visualize the execution of the code step-by-step. Add a comment.



0コメント

  • 1000 / 1000