Top 10 Steps To Making A Text-Based Game

Text-based games are a long forgotten genre but there are still plenty of fans out there. Whether you’re on a nostalgia trip or just want to make one as a hobby, it’s much easier than you think. I’m talking about creating one from scratch, your own code. Not a ‘mafia’ style clone game!

Getting started is the hardest part, once you’ve got it all set up then it’s easy sailing (except bug fixes). To help you get going, here’s the 10 biggest steps you need to do to make a text-based game!

For an example, see my game:

There may be some terms you’re unfamiliar, this is not a thorough guide, just steps. You’ll need to do your own research to understand them, but if you follow these steps you WILL have a text-based game.


10. Choose a domain

Your domain name is your website address, so this website’s domain name is ‘’, my game’s domain is ‘’. You should choose a domain as similar to the title of your game as possible, as it allows players to come back to it much easier. There are still plenty of domains out there and they cost about $10 per year. Use the box below to see if the one you’re thinking of is available!

9. Get a web host

A web host is needed to host your website, it keeps it up 24/7  and allows you to manage resources. A simple hosting package can cost so more than $50 a year but, if your game takes off and starts getting a lot of traffic, you’ll have to get a dedicated host. A dedicated host can cost a lot but unless you have hundreds of daily players, it won’t be an issue. Make sure you choose your host carefully though, I can tell you from first hand experience that a bad host is a nightmare. I recommend GoDaddy or Bluehost.


8. Learn the required languages

The languages you need to learn are php, HTML & CSS. The former (php) is for server sided stuff (determining a battle outcome) while HTML/CSS are for browser-sided stuff (like showing the outcome to the user).

This is the only difficult step, learning to code can be hard if you don’t have the motivation. If you have the desire and optimism, you’ll be creating your first page within a few days. Text-based games are relatively simply coding-wise. If you want to learn, you have to find your own way really, everyone learns differently. You will have to design a simple layout at first, but that is nothing more than a few boxes in HTML/CSS.

Just make sure you add the necessary security to your code or hackers will find a way to cheat or obtain information.

You’ll also need to learn some basic SQL and create a database for your game (your host will 100% have a guide for this).


7. Login & Registration

You’ve learned how to code, you have your website live and it’s just a layout with no content. You’ll now want to make a registration and login system. So make sure the page you’re working on has a connection to your database. Then create a registration form in HTML/CSS, when a user clicks the register button, use php/SQL to transfer the inputted data to a table in your database, the table that will hold the user info.

Then create a login form with HTML/CSS, when a user enters their details, use php/SQL to check the database to see if the user exists. If they do? Great! Redirect them to a different page (usually a home page) and start a php session, they’re now logged in. If you save the user ID and username to a php variable, you can display said ID/username on the page to make sure login is working.

Make sure you encrypt passwords.


6. Add Resources

You have users logging in but they can’t do anything. Now you should start adding more columns to the database table the users are located in, with the resources you want. For example, in Velrania I use Gold as the main currency, with others like Wood & Minerals. You might want to add a new table for these stats as it can get clogged up if everything is in a single table.


5. Keep track of everything

You’ll never know what you need to add in the future so keep track of everything you can. Add tables for last login date, amount of logins, login IP addresses, how many times visited each page etc. Do this relevant for everything you may need in the future, you do this with php/SQL. It won’t be a massive burden on your host, SQL commands perform well and databases don’t take up much data. It really helps for the future, you can use this data to add new features easily.


4. Create Profiles for Users

Of course, users need profiles. It’s just nice for players to view eachother, even if there isn’t much content on the game. Profiles are very easy too, a few boxes containing data from the database will do at first. This isn’t a feature you would usually give priority to, but it’s an awesome way of getting to know php/CSS/HTML/SQL.


3. Add ways to earn/spend resources

There’s plenty of different methods of earning/spending resources, you can make shops, quests, achievements etc. The easiest way to learn how to do so is by simply making a button in HTML that, when clicked, increases a resource by 1, using php/SQL. Then move on to decreasing a resource by 1 and increasing a different resource by 3. So then you have a button that trades for example, 1 Gold for 3 Wood. From there you can start to create more features to interact with your resources.


2. Create social features

Now that you have a basic set of features going, you’ll need a way to interact with your playerbase. Having in-game social options gives your players a direct way of communicating from their in-game accounts. Start off with a simple mailing system between users:

  • Create a table for ‘Mail’, have colums for the ‘FromID’, ‘ToID’, ‘Subject’, ‘Message’ and ‘Date’.
  • Add an option on a profile for sending mail, add a form with the options to choose who to send it to, the subject and the date.
  • When ‘Send’ is clicked, use SQL/php to create a new row in the ‘Mail’ table which inserts the form details into the relevant columns.
  • Add an option for a player to view their mail, use php/sql to retrieve the mail details from the database and use HTML/CSS to display the mail to the user who is viewing it.

The next features are a chatroom and forum. These are actually a bit advanced to create so I recommend leaving them until you’re much more experienced, especially the forum.


1. Go From There

If you’ve completed all of the previous steps then you’ll be ready to do whatever you want. Go forth and add any feature you can dream of, make the layout as you want it and revel in the glorious satisfaction of seeing your game come to life!


Leave a Reply

Your email address will not be published. Required fields are marked *