Coder Social home page Coder Social logo

loganendreman / cyoawesome Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mcfunkypants/cyoawesome

0.0 0.0 0.0 26.79 MB

An easy-to-use html5 text adventure game engine. PLAY THE DEMO:

Home Page: https://mcfunkypants.github.io/CYOAwesome/

License: MIT License

HTML 23.22% CSS 7.95% JavaScript 68.83%

cyoawesome's Introduction

WRITE A STORY, MAKE A GAME

CYOAwesome is a game engine that runs on text. It's perfect for interactive fiction, visual novels, and gamebooks where you choose your own ending.

No coding required: just type a story in plain text. Great for writers.

You can write a story and it will auto-magically create a multiple-choice adventure game for you. You can optionally sprinkle in a bit of logic inside square brackets to handle keys, stats, quests, sound, and images.

GETTING STARTED

Games all have scenes and items. Between scenes, the game waits for the player to make a choice. Once you change scenes, all past options become unavailable, except if a scene has no choices in it. In this case, the text is used to add to events taking place in the current scene.

HOW TO WRITE A SCENE

Simply type your story in the body of index.html. The engine will parse it, then hide it and run the game. Linefeeds and blank lines matter. Capitalization does not.

To start a new scene, just type a line of text that is ALL CAPS. To link to it in your story, type that same string of character with any capitalization. This makes story creation fast; you can stay in the creative flow.

TIP: Don't use common words or you may get links you don't intend.

EXAMPLE SOURCE CODE

Here is a simple adventure game to use as an example:

ROOM

You see a door and a key.

DOOR

[has key?] You escaped! Congratulations.
[else] The door is locked. 

KEY

[get key] You now have [key] key[s].

MULTIPLE CHOICE BUTTONS

If you don't want "automatic" linking in the text, just name your scenes with words that won't appear in the text (MY_SCENE_NAME with underscores, for example) and add multiple-choice buttons instead:

- description of choice 1 [SCENE_IF_CLICKED]
- description of choice 2 [ANOTHER_SCENE]

DIALOG

If a line starts with a double quote " character, the text is styled differently. Anything on that line is considered part of character speech, including any [image.png] logic, which is perfect for adding visual novel style facial expressions. For example:

"What are you talking about?" [betty_angry.png]

HOW TO ADD GAME LOGIC

To set or check a variable, all you need is to put your logic inside square brackets. The code gets run at the moment the text rendering gets to it. Here are some examples:

[get gold]
[gold + 1]
[has 5 gold?]
[drop 2 gold]
[no gold?]
[saw scenename?]
[imagefile.jpg]
[soundfile.mp3]
[1st]
[else]

QUICK LOGIC TIPS

TIP: items (gold, key, kisses) have to be only one word.

TIP: the SAW command checks our scene visit count.

TIP: to allow backtracking, set things only once with [1st]

TIP: else is run if the previous ? condition was false

MORE EXAMPLES

I tried to make it pretty permissive of coding style, so you can also type stuff like this!

[if you have the key]
[if the player has a key]
[do we have the key?]
[got a key?]
[pick up 250 silver!]
[grab an apple]
[lose 5 hp]
[hp++]

CONDITIONAL LOGIC

With the else command, you can react to booleans (yes/no):

[1st time?]
[else]
[has key?]
[else]
[if saw monster]
[else]

ITEM QUANTITIES AND PLURALS

You can write quantities in the story like this:

You are holding [gold] gold coin[s].

cyoawesome's People

Contributors

mcfunkypants avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.