Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (741)
Games in Android Showcase (225)
games submitted by our members
Games in WIP (823)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Pezna Story Engine - A tool for creating non-linear, complex stories for games.  (Read 14336 times)
0 Members and 1 Guest are viewing this topic.
Offline vbrain
« Posted 2015-06-29 18:07:15 »


A PSE story called "The Concise Tragedy of Romeo and Juliet

When creating a game with a story, creating and implementing the dialogue into the game can be very tedious. This was a problem I faced when I wanted to make a game with branching dialogues that could alter the course of the story depending on the player's choices.

I searched for tools that could do what I needed, but they always fell into these categories:
  • Crappy - Did not have as many features as I needed.
  • Overkill- Was too expensive and had many features, but not the features I needed.
  • Tedious- Repetitive dragging and dropping and clicking, constantly moving the mouse to click buttons and menus, etc.

There was no program that fell into just one category; each met at least two categories. The only reasonable thing to do was to build my own. Thus, Pezna Story Engine was born.


A portion of a story file that was used to rigorously test PSE.

I needed a program that would let me create characters, variables, choices for the player, and dialogue branching. I needed the program to be like a text editor that I could simply start writing in, and not have to painstakingly drag, and drop, and click, and arrange. In some of the programs that I found, by the time you finish clicking, dragging, and arranging, you've forgotten important details about the story you want to write. If your mind is anything like mine, you can get a dozen different ideas a day, and when trying to flesh out an idea, a bad user experience is not ideal. For the amount of flexibility and customisability that I needed, I had to create my own scripting language.

That is essentially what Pezna Story Engine is, a tool that interprets a simple scripting language designed for creating non-linear, complex stories for games.

Created with non-programmers in mind, it is extremely straightforward and easy to learn.

For the list of current and planned features, please visit the features page. PSE is still under development, and has not been released yet because there are many features that still need to be added.

I will talk more on the syntax and structure of a story file in later blog posts. Hopefully, I'll be able to release a demo within a month. Please follow me on twitter @pezna_official

Click to Play

Typing out an example story.

Click to Play

Test running the example story within PSE.

Website: http://pezna.com
Twitter: http://twitter.com/pezna_official
Offline noctarius

JGO Knight


Medals: 61


Manager Developer Relations @Hazelcast


« Reply #1 - Posted 2015-06-30 13:13:45 »

Very nice tool, I like the script language but how do you expect people to use it? Is there a runtime to integrate into your own game? Smiley

Offline Sickan
« Reply #2 - Posted 2015-06-30 13:45:14 »

Are the variables you can set on a character dynamic? Or are you limited to a subset specified by you? Nice work, however.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline vbrain
« Reply #3 - Posted 2015-06-30 17:05:39 »

Are the variables you can set on a character dynamic? Or are you limited to a subset specified by you? Nice work, however.
No, the character variables are not dynamic. Their type is determined by the initial value set to it.
If you give a character the property name="James", you can't later set it to a number, like name=15.
Currently, there are only 4 variable types: integer, string, boolean, and character. I'm going to add a float type later on.

Very nice tool, I like the script language but how do you expect people to use it? Is there a runtime to integrate into your own game? Smiley

Yes, there will be runtimes to integrate the exported file into your game. I'm working on the Java and Python runtimes concurrently with PSE.
The thing is that I'll need volunteers to port the Java and Python runtimes to other languages. I'll get over that hurdle after I implement all the necessary features.
Offline noctarius

JGO Knight


Medals: 61


Manager Developer Relations @Hazelcast


« Reply #4 - Posted 2015-06-30 18:32:29 »

I guess h meant dynamic like "don't need to be previously defined for a scope", what you describe is type inference on assignment Smiley

About ports: Well I could do it, unfortunately I won't have time - have my own multi-language project running ^^

Offline vbrain
« Reply #5 - Posted 2015-07-01 04:46:37 »

I guess h meant dynamic like "don't need to be previously defined for a scope", what you describe is type inference on assignment Smiley

Oh, right. The variables will be dynamic. Currently, all variables are global variables. I'm planning on creating local variables for act and scene blocks in the future.
Offline Ashedragon

JGO Coder


Medals: 27
Projects: 1
Exp: 4 years


The best person you could possibly be is yourself.


« Reply #6 - Posted 2015-07-01 23:24:54 »

This is kinda neat. Will the entire story be in one file?

boo
Offline theagentd
« Reply #7 - Posted 2015-07-02 03:17:52 »

How exactly is this supposed to work? It sounds like a perfect fit for a visual novel engine, but how would I (theoretically) integrate it into one?

Myomyomyo.
Offline vbrain
« Reply #8 - Posted 2015-07-02 04:43:23 »

This is kinda neat. Will the entire story be in one file?

The entire exported story will be in one file.
But during development of the story, you will be able to split it apart into stub files. This will also enabled more than one person to work on different parts of the story at the same time.

How exactly is this supposed to work? It sounds like a perfect fit for a visual novel engine, but how would I (theoretically) integrate it into one?

How would you integrate it into a visual novel engine? or a game?
Either way, it will be the exact same way: with events.

1  
2  
3  
4  
5  
6  
7  
8  
# create an event variable
event show_image "default value"

#later on, trigger event
trigger show_image

# or
trigger show_image "new value"


Events are not yet available in PSE, but will be available when the demo is released.
PSE is simply designed as an engine to create the text and flow of a story. After it is exported to a JSON file, and imported into your game with the use of a runtime, you will use listeners to be alerted when an event occurs. You'll create code to navigate through the story.

A basic story implemented in a game could be as simple as:
1  
2  
3  
while (story.advance()) {
   showLine(story.getCurrentLine()); //showLine will display the line and any choices it has, it will send the selected choice back to the story.
}
Offline vbrain
« Reply #9 - Posted 2015-07-03 04:40:48 »

Update 1 - (Website blog post)

Stack Overflow Error in Loops

Update 2 fixed this problem by implemented while-loops.
Currently, in PSE, there are no while-loops. To imitate a while loop, you would need to use an if-statement with goto and label statements. For example:
1  
2  
3  
4  
5  
label start
if (num < 50):
    num += 1
    goto start
end if

I thought that something like this would be sufficient for everyone's needs, but while running some tests yesterday I discovered a problem with this code:



After creating and exporting a story, you load the story file into your game using a runtime library. It reads the exported file, and let's you navigate through the story. Because of the way I created the Java library, with recursive function calls, a stack overflow error was produced after about 2000 loops. This was because it never had a chance to "return". I then replaced the recursive function calls with a loop, but a stack overflow error now occurred after about 4000 loops. This happens because of the way "goto" statements are implemented. Explaining everything in text is going to be difficult, so I'll just leave it at that.

To solve this problem, I'm going to have to create while-loops in PSE, so that users do not have to use gotos to make loops. I'll still look for a way to solve the problem with if-statement loops, but if there is no practical solution, I'll simply discourage people from making loops with ifs, labels, and gotos (at least, loops with over 4000 iterations).

New GUI

I've worked on the GUI a lot in the last 2 days. When compiling and running a story within PSE, a new window would appear with the Run Console. Not anymore. Now, the Run Console is below the text editor.


The current look of PSE's GUI.

The panel on the left is the variable panel. It shows all the variables within the game, and their history (what values they previously held).

The panel to the right of the text editor will be the auto-generated flowchart that will help you visualize the flow of your story.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline vbrain
« Reply #10 - Posted 2015-07-03 23:24:38 »

Update 2 - (Website blog post)

Events

This is something I've been putting on the back burner for a while, but today I decided I would finally implement this into PSE. You can use events to alert your game if an important action needs to occur. For example, if you want a transition after a line is displayed, you could do something like this:

1  
2  
3  
4  
5  
line: person "Hello, World!"
event "transition 1"
# or, if a variable (string, number, boolean) has been initialized
# you can send its value with the event
event variableName


While-loops

The problem  I had in the previous update with a stack overflow error has been fixed with the introduction of while-loops.

1  
2  
3  
4  
5  
line: person "I will count to 10!"
while (var <= 10):
    var += 1
    line: person var+"!"
end while



Using events and a while-loop in PSE.

What are your thoughts?

Be sure to follow me on twitter: @pezna_official
Offline noctarius

JGO Knight


Medals: 61


Manager Developer Relations @Hazelcast


« Reply #11 - Posted 2015-07-04 08:03:35 »

Your event should not just have a name (variablename) but also parameters, that way you could (for example) notify the game of choices made inside the the questions, to hand out items or stuff. WDYT?

syntax could be as simple as:
1  
event varname param1 param2 param3

Offline vbrain
« Reply #12 - Posted 2015-07-04 12:44:01 »

Your event should not just have a name (variablename) but also parameters, that way you could (for example) notify the game of choices made inside the the questions, to hand out items or stuff. WDYT?

syntax could be as simple as:
1  
event varname param1 param2 param3


That's a good idea. I'll put it on my list of things to do.
Offline vbrain
« Reply #13 - Posted 2015-08-06 00:23:04 »

A Tragedy Occurred

I lost everything in a hard drive crash about a month ago.
Luckily, I made backups in June 8.
However, those backups do not contain major progress that I made in the months of June and July. I have just gotten a new, crappy laptop and I'm just beginning the process of recreating what was lost. Pray for me.
Offline noctarius

JGO Knight


Medals: 61


Manager Developer Relations @Hazelcast


« Reply #14 - Posted 2015-08-06 07:30:56 »

Your not using a code repository like github? oO

TBH that would be a reason not to buy the software, very unprofessionell Smiley

Offline vbrain
« Reply #15 - Posted 2015-08-06 17:47:14 »

Your not using a code repository like github? oO

TBH that would be a reason not to buy the software, very unprofessionell Smiley

I am now, not making that mistake again. Not sure why I didn't before.
Offline noctarius

JGO Knight


Medals: 61


Manager Developer Relations @Hazelcast


« Reply #16 - Posted 2015-08-07 05:19:13 »

Well I would call this Pain-Driven-Development Wink

Offline Lucasmontec

Junior Devvie


Medals: 3
Exp: 5 years



« Reply #17 - Posted 2015-08-27 18:23:23 »



Just passing by...
I have a similar project Cheesy
Offline Icecore
« Reply #18 - Posted 2015-08-27 19:23:14 »

Personaly i like projects like this.
even if I do not use them for self,
I like ideas that stand behind them, how they evolve and what they have become )

Last known State: Reassembled in Cyberspace
End Transmission....
..
.
Offline Lucasmontec

Junior Devvie


Medals: 3
Exp: 5 years



« Reply #19 - Posted 2015-08-27 21:05:37 »

I'm making a full text engine plus a compiler and a language for that engine.
I plan to post in this forum soon, but I need to make the web system first.  Grin
All started trying to make a text game...
Offline vbrain
« Reply #20 - Posted 2015-10-20 17:37:48 »

Update 3 - Flowchart, Events, and Internal Variables - site blog post

It's been a while since I made an update. PSE is still alive and kicking, and I've made some awesome additions.

Flowchart

The flowchart is a visual representation of your story. Every node represents a statement in your story. The first node is the story object, the next level of nodes are acts, the next are scenes, and each scene has its statements below it. It is still in its beginning stages, and is nowhere near finished. The aim of having a flowchart in PSE is to allow the you to visually see how your story flows. It allows you to see which places have more "substance" than others.


Flowchart prototype of a story.

The edges (connecting lines) are currently not organized, and therefore it looks very ugly in its current state.

Events

Previously, event statements could only take a single value/variable. Now, they can take multiple values separated by commas.


An event that sends multiple values when it is triggered.

Internal Variables

Internal variables are variables that are initialized automatically by PSE, not the user. They contain information about the story, and the current position with blocks. Currently, the only internal variables available are:

  • story.name - This variable contains the name of the story
  • act.name - This variable contains the name of the current act.
  • act.label - This variable contains the label of the current act, if it has a label.
  • scene.name - This variable contains the name of the current scene.
  • scene.label - This variable contains the label of the current scene, if it has a label.
  • choice.text - This variable contains the display text of a selected choice. Note that if this is used outside of a choice-block, it will contain the display text of the last selected choice. If no choice has been selected in the entire run of a story, it will be blank.

Only story.name can be used outside of a scene-block. For example, you can initialize a variable to the name of the story, but you cannot initialize it to scene.name because there is no current scene.


Example of internal variables being used.

Be sure to follow me on twitter: @pezna_official
Offline ShadedVertex
« Reply #21 - Posted 2015-10-21 11:46:11 »

This looks amazing, keep up the great work!
Offline vbrain
« Reply #22 - Posted 2015-10-22 21:58:17 »

This looks amazing, keep up the great work!

Thanks. I hope to release a demo soon.
Pages: [1]
  ignore  |  Print  
 
 

 
xxMrPHDxx (21 views)
2017-11-21 16:21:00

xxMrPHDxx (14 views)
2017-11-21 16:14:31

xxMrPHDxx (16 views)
2017-11-21 16:10:57

Ecumene (114 views)
2017-09-30 02:57:34

theagentd (150 views)
2017-09-26 18:23:31

cybrmynd (260 views)
2017-08-02 12:28:51

cybrmynd (251 views)
2017-08-02 12:19:43

cybrmynd (247 views)
2017-08-02 12:18:09

Sralse (260 views)
2017-07-25 17:13:48

Archive (881 views)
2017-04-27 17:45:51
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!