How to Make HTML Games

by James HighlandUpdated September 28, 2017
Ciaran Griffin/Lifesize/Getty Images

HTML is the language of web design. Web browsers interpret HTML to display correctly formatted text and graphics. The overall structure of a web page is created in HTML. Other programming languages are usually used to create more interactivity on a page. PHP, JavaScript and Flash are examples of the tools used to generate dynamic websites. However, it is possible to take HTML to its limits. Enjoyable games may be created solely through HTML, for example. It is also possible to use HTML to embed games from other sources.

Interactive Fiction

Outline a "choose each step" style of interactive fiction. One way to use the limited programming abilities of HTML is to string a collection of independent HTML "chapter" web pages together in a "choose your own adventure" type of experience. Write a story with several critical plot points and choose alternate outcomes based on the decisions by the reader.

Open a text editor. Type the first "chapter" of your story.

Add two or more links at the end of the chapter to offer choices to the reader. Format each link as "Choice A" for the first choice, "Choice B" for the second choice, etc. Type the full description for each plot choice in the areas labeled as "Choice A" or "Choice B."

Save the file as "index.html."

Create a new text file. Type the content associated with the first choice you provided the reader.

Save the file as "1.html."

Create a new text file. Type the content associated with the second choice you provided the reader.

Save the file as "2.html."

Create more chapters and plot points if desired. The end of each chapter can provide the same HTML code for selecting choices. New text files are created for each choice provided. Simply increment the HTML file names with "3.html," "4.html," etc. to create multiple chapters.

Double-click "index.html" to begin the interactive HTML experience. It will open in a web browser and present the first chapter and set of choices. Each click will automatically open the other HTML file corresponding to that selection.

Board Games

Locate a board game script online. Many are available for free (see "References").

Create a new text document.

Copy and paste the HTML code form the board game script into the text document.

Save the HTML file using any file name you wish. Use the ".html" file extension.

Double click the ".html" file you saved to begin playing the game.


Photo Credits

  • Ciaran Griffin/Lifesize/Getty Images

About the Author

James Highland started writing professionally in 1998. He has written for the New York Institute of Finance and He has an extensive background in financial investing and has taught computer programming courses for two New York companies. He has a Bachelor of Arts in film production from Indiana University.

More Articles