Step 4: A scripting language

posted in orphu
Published May 02, 2019
Advertisement

For a game that tells a story... What do we need? Let's see... We need a way to tell the characters and events in the world what to do and when should they do it. And that's it for the most part. Sounds easy, right?

The easiest approach, for me at least, was making a set of commands to be triggered by an event. I started by learning how other tools do the job. A tree with nodes specifiing orders was visual and clean. So I started with the minimum amount of commands and later on, I could add more as I see I need them. A few ideas:

- We want our characters to speak casually.

- We want our characters to have long and convoluted conversations with npcs.

- We want to be able to tell our characters to move.

- We want to be able to tell our characters to play an animation.

- For cinematic purposes, we need ways to control the camera.

- We need to read and write state variables.

- We need some kind of flow control, making it a true scripting language.

This was the starting point. Reusing some old code I wrote for making all types of editors, I quickly had a tool for editing script trees. Each level loads a file with the scripts for the scene, and then, when triggered, a unity script executes each node following the tree flow. When it worked I was surprised how easy to use and powerful this tool was. An example:

 

level2.jpg.7b154929fd8b59163cee976e80991c8a.jpg Some work in progress for a level.

Another one, just for the laughs:

 

And then, with the right tools developed, the time for my first cinematic arrived...

Previous Entry Step 3: Combat & AI
2 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement