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

Saturday, October 1, 2016

DF: Reborn second character revealed + Chad Hines joins our team!


I'm pleased to announce that Chad Hines aka @continuitydrift joins Dark Forest: Reborn crew as a writer. 

So, if you see some crap in our writing (and especially in this blog), it's not him!

Chad helps us to transform DF: Reborn concepts, scenes and dialogs into beautifully written magic of English language. Moreover, as a professional writer and creative guy, Chad not only improves our existing ideas, but also brings tons of new ones. Check out his wonderful novel!

DF: Reborn second character revealed



Her name is Taliet, and she stepped into the Dark Forest: Reborn world from another realm (writing on GIFs below by C. Hines).


Taliet was a part of a secret experiment of high-tech civilization that went terribly wrong. She managed to escape, but at a ruinous cost.


Should you manage to survive her traps and win your way into her presence, her fear may be overcome at last by curiosity, and she will question you eagerly, and inspect with her weird glass fingers everything you carry.

Tuesday, September 20, 2016

Automated testing of choice-based text adventures (ChoiceScript / Selenium example)

If you write something complex and unique (I am sure you do), you need to test your creation. Testing of text-based games is a trivial task for software developer. This article contains some advices for regular writers without programming experience and for users of Twine or ChoiceScript.

Of course, there's an official way of ChoiceScript automated testing using Randomtest or Quicktest. My way is different and includes interactions with browser. 

You can achieve something like this (5 minutes effort)
Interactive fiction or text adventure game is just a combination of states (contexts/levels/zones/rooms) with several choices
(triggers/associations).

What do you need to test? Your game takes user strings or choices as an input and generates some strings as an output. Usually, the only thing you need to test is the behaviour of your game in case of different inputs:

expected input -> expected output + postconditions

Your task is to prepare a set of different inputs and corresponding expected outputs. Your goal is to be able to send an input to your game and check its output automatically. It's very important to be able to check the functionality of your game instantly so if you change something in the middle of your 100 rooms/states and 100000 words before the release, broken transition from state 42 to state 24 will not be a surprise for you and for your players.

Example of abstract test cases


Your game starts with the question 'Do you like apples?' and some choices: 'Yes', 'No', 'I prefer oranges'.

- Choice 'Yes' leads to the state with text 'That's great!' and sets the variable 'PlayerLikes' to 'Apples'
- Choice 'No' leads to 'That's sad. I am going to shoot you down.' and sets the variable 'IsPlayerAlive' to false
- Choice 'I prefer oranges' leads to 'I love oranges too, puddin!' and sets the variable 'PlayerLikes' to 'Oranges'

Possible test cases:

- If player chooses 'Yes', text 'That's great!' is displayed.
- If player chooses 'No', text 'That's sad. I am going to shoot you down.' is displayed.
- If player chooses 'I prefer oranges', text 'I love oranges too, puddin!' is displayed.
- If player chooses 'Yes', variable PlayerLikes contains string 'Apples'.
- If player chooses 'No', variable IsPlayerAlive is equal to false.
- If player chooses 'I prefer oranges', PlayerLikes is equal to 'Oranges'.
- If player chooses 'No', game is finished.

Actually, 'text is displayed' means 'game switched its state/room and performed the first action in that state - displayed some text'.
It's all the same if your game parses text. You always have a limited number of choices (input phrases) and limited number of 
transitions and postconditions (set variable X to Y and so on).

It's not always necessary to write every possible test case - just choose the most important and crucial ones. Your test suite should perform these operations automatically and display a report with each test case's status: success/fail.

Selenium


How to achieve that? I'll show you how to create your automated tests for web-based interactive fiction and text adventures using special set of tools - Seleninum. I will cover the simplest way of writing tests with the help of Selenium plugin for Firefox. You can achieve the same effect using standalone version of Selenium toolset, but it won't be that easy.

Let's rock:

0.) Install Firefox ;) 

1.) Install Selenium IDE plugin. Go to addons.mozilla.org and press the 'Add to Firefox' button.


2.) After the installation process, check 'tools' menu: Selenium IDE field will appear.


3.) Press 'Selenium IDE' to launch test suite.

Launched Selenium window
Let's write some tests? I picked a game I found on the ChoiceScript forumGuenevere. You can use any ChoiceScript game you want: Children of the Gods: The Hero TrialsThe Seven Heirs of Ophaesia, ${your_game_name}.

The main thing you need on the first step is the link to your game.
Fill the fields 'Command' and 'Target' in the Selenium IDE window:


You need to set 'Command' field to 'open' and 'target' to 'link to your game' like on the screen above. Now press the green arrow to launch your first test.


Your first test checks the ability of your game to show its start page.

Recording your actions


Let's add some transitions. Press the record button (red, top right corner). Selenium will start recording your actions. Time to play!


I am pressing random buttons, but you can plan your actions and record the most important or buggy way of playing your game. Press the red button again to stop recording.

Selenium is ready to reproduce recorded actions.

I switched the execution speed to 'slow' and pressed the green arrow button to perform my test:

It's alive!

I guess you understand that now you can actually create a test that goes through the entire game. You can write as many test cases as you want. You may notice a list of strange lines of text on the right side of the Selenium plugin window:


It's the list where you can find every command executed by Selenium. You can add your commands by 'recording' them or you can add them manually. 

Additional test cases


Let's add a command that checks the presence of a particular string on the screen:


Don't forget to save your test:



I described the simplest way to automate testing process of your choice-based interactive fiction.

Here is the list of useful resources:


That's all for now. 

Cheers.

Sunday, September 11, 2016

Combat system in Dark Forest: Reborn

'Well...that geyser of blood emanating from my chest is proof I have high blood pressure.'

'Unfortunately, his spine is now clearly visible from the front.'

Fallout   

This post is a demonstration of Dark Forest: Reborn combat system. Our system is unique and provides user with the 'do whatever you want and still get game reaction' experience

The world of Dark Forest: Reborn is cruel. You will face local conflicts with highwaymen, clashes of criminal groups and even war. Every event in the game tests your abilities. Will you be able to stay Human?

Let us pretend that misterious forces took your poor body and placed it on the battlefield. Your forces are carving towards the centre of enemy army through the infinite waves of mad savages. They surge forward and it seems their strength is infinite. Your rusty sword is the only weapon you have.


John had only one choice
What will you do? 

- You can try to run away.
- You can join friendly forces in their attack.
- You can try to hide.
- You can cry and ask for help.
- You can just wait and do nothing.
- ...


Every choice will give you additional choices. Your main task is to survive, but it is a really difficult task in the world where your allies are dead and the battle is lost. Let's try to help?


As you can see, you have freedom. Do you want to hit his head using your sword? No problem. His arm? Left or right leg? Yes! If you are strong enough, you can even finish him with a single fatal blow. 

Not enough strength? Try to use words or even so called 'green magic', a gift from high-tech civilization.
You should be fast. The world of Dark Forest: Reborn is a living world - your opponent will not wait for your actions and words, he will keep fighting and hitting you until your death.



Will you be able to protect your allies? Will you save your friends, or maybe your decision will be to kill yet another enemy general? Your glory is important as well: if you show yourself as a good warrior, you will gain reputation that will help you in future adventures.

You should understand your strong and weak skills and abilities. Plan your actions. Don't use everything you have on weak enemies. Save something special for their bosses!


Your energy and time are limited resources. Sometimes it's a really good idea to try to find your opponent's weak spots first.



More details about our combat system will be revealed soon. We're also going to discuss other ways of solving your problems in Dark Forest: Reborn. Smashing everything to pieces is fun, but sometimes you don't want or just can't do such things.

Thursday, September 8, 2016

Teaser of an upcoming Dark Forest: Reborn saturday announcement


Dark Forest: Reborn contains a lot of unusual and cool features that you won't find in any text-based game.

Here is the subset of our special strings for an upcoming Saturday announcement that will feature yet another unique game mechanics of Dark Forest: Reborn:

- This is your fatal mistake.
- Die, human fool!
- Your heart is mine!
- Blood! Your blood? Mine blood!
- Enjoy the last few seconds of your life...
- Blood and oblivion!
- I will loot your pathetic corpse!
- This is green magic! You can't!
- I can't see! You coward!
- My face! My eyes! Why!?
- Where are you? Help me! Help!

Basic set contains up to 1000 lines of text, and it's only the beginning.

// Subset given above is also an easter egg for those who love post apocalyptic games ;)

Thursday, August 18, 2016

Dark Forest: Reborn announcement

Dark Forest: Reborn - Escape from the last underground citadel of devastated Earth and find your new world where you will save, romance, trick, betray or even kill people...using magic of words in this immersive text-based roleplaying game!

Intro


Hello, lovers of games with deep storylines, compelling characters and interesting gameplay. Long time no see. 

We have been discussing interactive fiction and text-based games: old-school stuff, games that are already forgotten, etc. Our articles contained mostly abstract analysis and criticism, so some of you might be wondering 'Wtf? Everyone can criticize! If you think you know how to create perfect adventure game, why not go and create it!?'. 

Well, guess what, friends? We are creating perfect text-based adventure game right now. It is called Dark Forest: Reborn, a next generation text-based rpg of romance and adventure.
Awesome logo. We payed 10$k for this. Really.

Key features of Dark Forest: Reborn


- NPCs that support natural language interactions and relationship modeling using a modern chatbot's AI core.

This simply means you will interact with cool characters using phrases like ‘Hello!’, ‘How are you?’ ‘I am your friend, trust me!’, ‘Do you prefer human meat or maybe I should bring some fruits?’.

You will test your perception, charisma and conversational skills. Based on your words and actions, our characters will decide if you are nice person or not. If not, watchout!

- Choices and real consequences. The game won’t tell you how to play.

- Nonlinear and replayable game world that adapts to your personality.


Do or say an evil thing and the world around you will look (or even become) evil.

- Real-time combat system with a bit of gore and awesome finishing moves.

- Game setting inspired by Arcanum and old fallouts in the style of Andre Norton and Stephen King’s fantasy novels.


Plot


Distant future. Humanity is doomed. Earth is dying. You are imprisoned in a sealed citadel deep underground. Old machines give you everything you need to live. You spend your time trudging through the citadel and researching its chambers. You have almost accepted your lonely fate, when a tragic accident changes everything.

It appears that a group of brilliant Earth scientists were living in this citadel before you, until the day they all mysteriously disappeared. They left behind, however, a monstrous ancient device that gives you a second chance, a way of once again reaching the world outside.

The world of Dark Forest: Reborn is full of ancient swamps, poisonous hills and abandoned strongholds of fallen civilizations. During your journey you will face strangers, and change their fates forever. Some of them will curse you. Some of them will be ready to give their lives for you. After your adventure you will be judged, and the fate of every character and the world of Dark Forest: Reborn itself will be revealed.


Characters


Dark Forest: Reborn mixes classic text adventure game mechanics with mechanics of interactions with NPCs via natural language dialog.

For example, in location 'House of Cannibals' you may find daughter of the Cannibals, Qara, 21 y/o slender black-haired girl with tired face who lives with her family in the depths of the forest. Your main task will be to escape the House of Cannibals. Qara's motives are not clear so it's up to you to choose your way of completing the quest: you can try to capture her and force her to help you, you can try to gain her trust or just ignore her and escape the House of Cannibals on your own. Everything depends on your personality, kindness, cruelness or even madness.

Maybe Qara doesn’t like her family and wants to escape the House of Cannibals too? Or maybe she just wants to eat your entire body alone? She definetly prefers red wine so maybe your fate is just to become a part of her dinner...or maybe this girl will be your best friend. Or even girlfriend.

Test your perception, charisma and conversational skills and find out the truth!


No, no, this type of 'flirting' with NPCs like Qara is not okay. You will learn it after the meeting with her family.


This style is more suitable.


Concept arts


If you think interactive fiction and text adventure developers have no concept arts - you are wrong.


We have no cool pictures to impress you. Our game will create cool pictures in your mind instead.

System requirements and release date


Too early for this information. One thing is clear - Dark Forest: Reborn will run only on the most powerful graphics controller you have - your imagination.

Our crew


One software developer experienced in gamedev and natural language processing aka DarkForestCrow – at your service, two writers, one native English speaker/writer will be found soon (that bastard escaped from our catacombs).

We are friendly, our NPCs are not!




Support Dark Forest: Reborn now!


Subscribe to receive important updates and news and be our first player! 

Follow us on TwitterFacebook and IndieDB.

You can also find the list of our contacts here.


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?