I was thinking of a text based game where the users type in various "things." But I know it will quickly degenerate into filth. Is there any way to stop something like this?


3 Answers 3


Users determined to use inappropriate words can be very creative in getting around even quite sophisticated automatic systems. Imagine you want to block the word, "pear". Can your filter deal with deliberate misspellings like "pair"? And what about false positives, like "appear"? What if the user's real name is actually "Pearson"? But offenders start using the player's name in place of "bad words"?

There are, however, several techniques that can help. The idea is not to prevent offensive behaviour, but rather to take the fun out of it.

  • Make expectations clear to users (terms of use, on-screen instructions)
  • Filter words that are obviously bad. So, you would filter "pear" but not "pair". You're dealing with casual offenders, you're setting the tone, but you'll still allow "pearson" to play.
  • As suggested in another answer, show the original words to the person who typed them, but the clean version to others. The genius of this technique is that users may not realise that their words are being filtered, so may not think to invent workarounds.
  • Automatically (and politely) remind offenders to stop. Explain why some people find their behaviour inappropriate
  • If it isn't an essential aspect of the game, allow users to turn off the chat facility so they don't have to read conversations that they consider offensive
  • Allow users to ignore certain players
  • Allow peer review. An additional advantage is this can also discourage other "bad" behaviour such as racism or trolling which is not based on word matching. Stack exchange is a great example of how this can work in practice.
  • Some games have force users to pick from stock phrases. This is generally perceived as boring, but can be appropriate in some situations.

None of these suggestions will outright prevent bad words, but they can go a long way to helping you keep your game clean.


It's effective in these kinds of systems to show the original words to the user who made the input, but the scrubbed version to everyone else.

  • \$\begingroup\$ Don't think it would take them long to realize this though :P \$\endgroup\$
    – Nick
    Jul 25, 2012 at 7:54
  • \$\begingroup\$ I'm thinking that the more profanity a user uses, the less likely that person is to notice myself. \$\endgroup\$ Jul 25, 2012 at 19:41
  • \$\begingroup\$ Georgek is correct. The best way to get someone to not abuse the system, is to trick them into thinking they got away with it in the first place. Even if they eventually find out they were fooled and find ways around it, it will NOT be easy for them to experiment. At the very least, you slowed them down and prevented it from being a huge problem. \$\endgroup\$
    – Carter81
    Sep 29, 2013 at 3:53

One simple option is to have a text file that contains a list of all words and phrases that you want to block. Scrub the input prior accepting it by checking it against the list of words in that file.

File contains:


Then scrub the input like so (pseudocode):

    // accept input and do whatever you need to
    print 'Hey, be nice!'

If input is "Apple", the blockedWords array read in from the text file will contain it and throw up the message.

  • \$\begingroup\$ One thing to consider is that people get creative on these environments, like type a-p-p-l-e or something \$\endgroup\$
    – Luke B.
    Jul 25, 2012 at 1:59
  • \$\begingroup\$ @LukeB. Yes. That's what I thought too. Almost impossible. \$\endgroup\$
    – johnny
    Jul 25, 2012 at 3:00
  • \$\begingroup\$ @johnny Games for kids usually limit what you can say to a number of phrases instead of free chat. I guess Toon Town and Wizard 101 use this method. \$\endgroup\$
    – Luke B.
    Jul 25, 2012 at 3:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .