Page 1 of 1

Story as In Game purchase

Posted: Sat Jun 03, 2023 4:01 am
by Cussa
I am planning to do a game app that has several stories inside it.

My idea was that when you purchase the story, it allows you to download that story and play it inside the game.

Basically, this means that instead of sending the Dialogue database inside the game app, I would like to distribute it via internet, accordingly to the fact that you have purchased that story.

I tried to see if this would be able to be done, but didn't found a way.

My innitial tought was to export the database as a JSON, with the sprites/pictures with it (or even the file itself, if possible). In the game, when you ask to start a story, I dynamically load the story based on the file downloaded via internet.

Is that possible?

Re: Story as In Game purchase

Posted: Sat Jun 03, 2023 8:12 am
by Tony Li
Hi,

Instead of using JSON, you could distribute the database and images as Addressables. Sequencer commands can load addressables, so you can use the SetPortrait() sequencer command to set the characters' portraits, AudioWait() to play audio, etc.

But if you wanted to distribute the database as JSON, that's fine, too. Use JsonUtility.FromJson<DialogueDatabase>() to convert it back to a dialogue database.

Re: Story as In Game purchase

Posted: Mon Jun 05, 2023 3:06 am
by Cussa
Tony Li wrote: Sat Jun 03, 2023 8:12 am Instead of using JSON, you could distribute the database and images as Addressables. Sequencer commands can load addressables, so you can use the SetPortrait() sequencer command to set the characters' portraits, AudioWait() to play audio, etc.
Could you share some docs about how to use that this way?

Re: Story as In Game purchase

Posted: Mon Jun 05, 2023 8:09 am
by Tony Li
Hi,

Addressables require some programming. You can read more about them here: Addressables.

Briefly:

First, you'll need to prepare your database so its internal IDs don't overlap other databases. The easiest way is to set a unique Base ID value, as described in Working With Multple Databases.

Then you'll load your dialogue database from the Addressables system and then call DialogueManager.AddDatabase() to add it to the Dialogue System's runtime environment.

If the database uses AudioWait() sequencer commands to play audio, they will automatically look for the audio clips in the addressables that you've made available to the Dialogue System.