Dark Forest Crow Notes - Interactive fiction, text-interactions based and roleplaying games
Showing posts with label theorycraft. Show all posts
Showing posts with label theorycraft. Show all posts

Saturday, July 23, 2016

Modern text-based adventure games development #3: Solutions

    Time for another post of thoughts. Previously we discussed problems that are common for modern (and not only) text-based adventure games development. Again, this is not a tutorial. I'll write some tutorials for those who are planning to develop their own games later (yes, there are tons of such tutorials already on the internet so hopefully I will change my mind and will not do that).


Looking at fellow developers that suffer from poor development tools

So, text-based adventure games usually have such problems:

1.) Poor natural language processing capabilities.
2.) Primitive gameplay and game mechanics in general.
3.) Primitive characters or even no 'real' characters at all.

    Why is it so sad? I think the roots of these problems are in interactive fiction community ideology that is obsolete. Ken Poirier from a comment section on our facebook page also added that one of the problems with text parsers is that games are often designed to be compatible with the old z-machine system. Well, this is one of the reasons. You can read about z-machine here.


    All things listed above can stop you on your way to creation of your unique text-based game. So, what can you do about that?


    Again, if you want to create simple ('traditional') interactive fiction game as fast as possible - take a look at Twine or Inform and come back later. You can also skip everything below for now.

    I see only one way of text-based games development that can help you achieve good results without forcing you to study things you will never use again:


    You can develop your text-based game like it's a real game. Yes, strangely, but text-based games are computer games too, so you can just...program text-based games using any programming language you know. This is the only way to create something really unique and the only way that gives you complete freedom in your creativity, as well as useful experience, knowledge and portfolio.


    You may think 'but why do I need to create everything from scratch and create yet another set of crutches?', and I am ready for that.


    Below are some ideas about text-based games in general. Text-based games are simple (if we talk about development process) - you don't need graphics with outstanding landscapes or cute pixel 

art characters, you don't need marvellous music, you don't need top-notch voice acting - just something that allows you to print text on the screen. And maybe a good compelling plot. Maybe.

    Let's pretend we want to create a text quest or any kind of interactive fiction. If you played some text adventure games you could see that usually the gameplay of such kind of games goes in this way: 


    Process input text-> Display output text -> Repeat

    Actually, that's all. 


    So, do we really need some special software tools like Twine, Adrift or Inform to create such a game? A lot of people are working right now developing these tools to help you to do what exactly? - request user input via text field, process (in a very simple way) received input and then just display a response.


    That's all. Literally. 


    If you need something advanced - these people and these tools will answer you 'sorry, mate, we can't do that, do it yourself'.  Maybe they can offer you natural language processing? - No, of course no. Easy-to-implement ways to create game world that is more complex than connected rooms? - No. Tools to create your NPC with replics, emotional state, memory? - You know the answer.

    You may think again (I see you like to think) 'But actually you can simplify any kind of games in this way. Crysis processes some inputs, analyzes it, displays some korean soldiers, then you hear pew-pew and that's all'. No. It's not that simple: you need graphics engine, 3d models, you need sound libraries, you need voice acting, you need animations, you need physics, you need math, you even need artificial intelligence...Not that easy to create everything solo.

    I am just saying that fellow reader can create text-based games from scratch using any programming language with it's basic functionality.


    Text-based game usually takes input strings and displays strings as answers based on some conditions. For example, your game can have such kind of conditions: current game zone, player's stats, completed quests, previously received input strings, game difficulty settings, current input string.


    Then, if your game receives 'How are you, friend?' input string, it displays output string 'Go away, animal!' doing something like this:

if (player is in zone1)
  if (player's charisma is equal to 1)
    if (player completed quest 'Have sex with Bishop's wife')
      if (previous player's replic was 'Hello, mister Bishop!')
        if (current input string icontains 'how are you')
          if (difficulty is equal to 'hardcore 18+')
            do_some_stuff(x)
           display("Go away, animal!")
          else
           do_other_stuff(y)
           display("Go away, retarded sickfuck!")

Just a bunch of simple if-clauses. Looks ugly. But this is the example of what is actually going on when you play any game - it receives some input signals and based on that signals and some constants and variables produces output:

if (variable1)
  if (variable2)
    ...
      if (variableN)
        do_simple_things()
        set_some_variables()
        display(x)

    Of course you will not write code like that. Well, if you are new to programming, you can even start with this code. In case of text-based games the amount of if-clauses is not huge. Good object oriented design will eliminate the need of this stuff and checks will be hidden. How to reduce the amount of explicitly-written conditions and write good object-oriented/meta abstract code for videogames? How to create your own game world model? What about roleplaying system? Items, objects interactions? Eventloop? Topics that are already covered in myriads of artices. But actually you can do that, and the process will be easy since it's just a text-based game. You'll still be able to focus on storytelling, replics and descriptions of things (usually it's 90% of interactive fiction development). And the development experience of doing these simple things yourself (even if you think that you produce worst code in the world) will be priceless. 

   What about natural language processing? I'll definetly write an article about some simple and useful algorithms you can use. The simplest thing you can do right now to improve players experience is to introduce synonyms checks and even simple regular expressions checks. That's right, son, don't just write 

    if inputString is equal to 'go north'

write 

    if inputString matches setOfRegexps

where setOfRegexps contains things that match 'I go north', 'I fuckin want to go north', 'I go to the north', 'I run north', 'I jump to the north'.

This is possible solution too:

    if inputString.icontains(mapOfSynonyms['go']) && inputString.icontains(mapOfSynonims['north'])

where mapOfSynonims is a map/any data structure that contains sets of your synonyms: [{'go', 'run'}, ['north', 'N'}]. Surprise - most of modern text-based games don't do that.

    Text-based game that understands 'hello' but can't understand 'hello, how are you?' fails one of the main tasks of text-based game - text processing. It was 'okay' 30 years ago. But now you need something more to impress players.

I didn't want a list of tutorials here again but, well, I feel I still need a list of resources for complete newcomers in gamedev world:

1.) Good python tutorial. Contains code for a text-based game with rooms and items.
2.) Question on stackexchange with example of game code with tons of if-clauses and tips for the ways of improving it.
3.) C++ article about writing of text adventure game from scratch.

    If you choose the way I described above - you can even say someday 'Hey, guys, I don't want text-only game anymore. I want to add awesome graphics and sound' - and you will do this, and the code you written for your text-based game will not be useless.

    That's all for now.

    Do you feel comfortable playing text adventure games with 'traditional' design? Maybe you faced problems with processing of different types of inputs with the same meaning in other types of games?

Monday, July 18, 2016

Modern text-based adventure games development #2: More problems


    In my previous post I stated some common problems you may face during the development of your game that contains text (wow, text?).

    Even if your game of this type has decent storyline, compelling characters and good writing (perfect example of bad writing is this blog. Joke, this blog is the best.), probability of success is still low. And if your writing is poorly done, cool landscapes and voice acting will not save you - because you have no graphics and no sound at all.

    I also mentioned visual novels - well, this can be a good choice for your state-of-the-art story/dialogs-driven game. Community of visual novels players is larger than interactive fiction players community (I am not even sure if IF-players community is alive) Add pretty faces of characters painted by decent artist, add sexy voice of your cousin and - voila - the best game of all time is ready.

    It's not that easy in real world. There are hundreds of visual novels with awesome arts and ourstanding voice acting - and with writing that looks like a writing of a retarded monkey translated via google (again, this blog) With stories that are so primitive that you think 'One more word and my brain is dead'. 

    So, good story, characters and dialogs are must-have for text-based game. Suppose that we already have it.

    What other kinds of problems do we have?


 - We have text only but still text component of the game is poor.


    Game understands 'go north' but fails to process 'lets go north'Game understands 'look' but can't do a shit when gets 'look around'

    It's not only poor natural language processing but the traditional mechanics of such types of games itself - it's a tradition in IF community to let player say 'go north' but forget about processing of other types of this phrase like 'I want to go North'. Just start to play Make it Good or any other interactive fiction game here and you will understand what I am talking about. 

    Your game has no graphics, no sound - and still it can't even process input strings that are slightly different from the strings that are direct orders - well, how can we say then that your game is a true text-based game?


 - Limitations of frameworks. 


    Almost every framework for IF development has typical and primitive understanding of what is a text-based game: such kind of a game must have rooms with a maximum of 4 doors or directions like north, south, west, east; such kind of a game must have 'look' and 'examine' mechanics; if you want to add roleplay to your game you better shoot yourself instead of doing this.
    These framework will not let you create your own game world - because creators of these frameworks surprisingly can't understand that 'text-based' doesn't mean 'has simple mechanics and primitive world model'.


 - No real characters. 


    That's right, guys, I reviewed Galatea recently and, actually, this is the best example of NPC in interactive fiction we have right now. Such a shame. 
    You can't say 'Hello, girl. How are you? What is your name?', you need to write ugly stuff like 'Ask X about Y' and repeat it again and again for any kinds of things you want to discuss.

    And it's not only the result of poor functionality of IF development frameworks.


Summary of the main problems I see so far:

1.) Poor natural language processing capabilities.

2.) Primitive gameplay.

3.) Primitive characters or even no 'real' characters at all.

    I think that modern text-based game must contain not only decent storytelling and writing, but also it must:

1.) implement game mechanics that is more complex than just 'man goes through some rooms and examines things'

2.) have at least one compelling NPC with opportunities to chat and opportunities to establish relationships.

3.) offer natural language processing (it's a text-based game so one of the main tasks is to process text, surprisingly for typical IF authors)

IF developer in a cruel world of gamedesign

    Moreover, good characters design is a must-have for every game in my opinion. It's one of the best means to bring some life into your game world. Through characters players can observe the effects of their actions on your game world in a natural way. 

    When a player comes back into your game and your character says 'Hello, bro. I am so glad you are here again!', your game makes a step forward to player's heart.

    That's all for now. Any other kinds of problems you see that I didn't even notice? Maybe story-driven text-based games are obsolete and it's useless to discuss such things?

Thursday, July 14, 2016

Modern text-based adventure games development #1: Problems


I decided to write yet another abstract post with my thoughts about text-based and interactive fiction games in general.

Am I really trying to think and to do something right now?

What are the problems of such type of games? What are the problems of developers who tries to create their state-of-the-art text-quests? I think this topic is very interesting. Moreover, almost every modern computer game contains some text, dialogs, lore, any kinds of descriptions so my monologue will not be only useful for developres of text quests and writers of interactive fiction.

You may take a look at some of my thoughts about typical examples of old and modern text-based games here: Galatea, Make it Good, Star Wars: Escape the Flagship.

So, you want to create your text-based adventure game. If you want to create it for yourself and your friends only (joke, developers of text-based games have no friends), then you just develop it. Then one or two guys in the world play it. Everybody is happy.

But what if you want to create something enjoyable for more than just one miserable person who plays your game only because he feels sorry for you (actually because he thinks you are a psycho who can do something bad if he will not check your game out)? 

You have a lot of problems then, son.

Because, guess what, text-based game is a text-based game and you are not a Hemingway. You need a good writings, you need a good plot, you need some compelling characters, you need good additional interesting mechanics ideas. Just go to textadventures.co.uk and launch some games - you will see a lot of problems. I hope. 

Some games there have good story but awful writings and awful English (even worse than mine). Some have perfect English but boring plot and obscure characters. Others have good plot and good English but simple and boring mechanics. Who is the audience of these games? Like with any other types of games, you have three main circles of players:

1.) Creator of the game.
It's not as bad as you may think (and even not that bad as I think). Some writers write novels just to read them after a year or so. Art for single person in the world is still an art.

2.) Creators of the games of similiar type.
Interactive fiction community is the best example in this case: they use similiar tools, they write their games, they play their games. Community is pretty closed and bounded (I am not saying this is bad).

3.) Usual gamers.
Mmmmm...usual gamers...Millions of players...success.

You can easily reach the audience of type 1 and 2, but what about type 3? Do you have some awesome pixelart pictures with landscapes and characters to impress those people? Do you have some insane chiptune soundtracks? Voice acting? Maybe you have beautiful animation?

No. You have text. Player writes some text as an input and the game displays some text as an answer. Nothing more.

Probably, you have a good story. Maybe some plot twists. Decent dialogs. But you can't show your compelling story or charming characters. You can tell something interesting about your game but it's not easy at all to impress people using text only. Especially in modern world of powerful graphics engines and pixelart freaks (I love them).

I will continue my analysis soon and will describe some features that are must-have for modern text-based games.

Do you think authors of visual novels have their answers for these questions? Visual novels have huge audience.