Doujin & Games

Wait, We're Building Our Own ADV Game Engine!? Yeah, We Can Do That!

Someone said they wanted to make a Phoenix Wright-style ADV plus point-and-click investigation game.
Listen to testimony, find contradictions, and present evidence. That kind of thing.
They want to do that system in their own game.

Existing ADV engines such as TyranoScript can cover part of it, but freely building in “testimony x evidence” judgments and switching to investigation mode sounds rough with off-the-shelf tools, or at least the staging they want seems hard to achieve there.
At the same time, building a whole engine from scratch is a lot.

So the plan is to design it starting from the scripting language.

System structure

[Web editors] -> [Script / config files] -> [Godot engine] -> [Game]
  • Game engine: Godot 4.x + GDScript
  • Script language: A custom design called “Scenario Script”
  • Editors: Web-based tools for script, characters, investigation areas, and evidence

The goal is to let even non-programmers write scripts. Programmers can focus on building the engine and editors.

The script language: “Scenario Script”

Dialogue

Use the character name plus a block wrapped in ---.

Kana-chan
---
Objection!
Please look at this evidence!
---

This also makes multi-line dialogue easy to write naturally.

Commands

Use the format [command_name arguments].

[show character_id]
[show character_id emotion=angry position=left]
[bg courtroom transition=fade]

Positional arguments and named arguments can be mixed together.

Labels and jumps

#chapter1_start

[jump chapter1_start]
[jump_if $flag chapter1_start]

Variables and branching

[set $talked_to_witness true]
[set $penalty 0]
[add $penalty 1]

[if $penalty >= 5]
[jump game_over]
[endif]

Main command list

Character display

[show ikesan]
[show ikesan emotion=smirk position=right]
[hide ikesan]
[hide_all]

Backgrounds and effects

[bg courtroom]
[bg courtroom transition=fade]
[shake]
[flash]

Sound

[bgm trial_begin]
[bgm stop]
[se objection]
[voice file_name]

Choices

[choice]
[option "Check the evidence"]
[show_evidence_list]
[end_option]
[option "Keep listening"]
[jump continue]
[end_option]
[end_choice]

Ace Attorney-style system

I figured this is probably the system they want.

Evidence system

[add_evidence knife]
[remove_evidence knife]
[show_evidence knife]

Evidence is defined in JSON. Each item has an ID, name, description, and image path. During the game, it can be obtained, inspected, and presented.

Testimony and cross-examination mode

[start_testimony testimony_01]

[statement id=1]
I witnessed the scene at 10 p.m.
[end_statement]

[statement id=2]
The defendant was holding the murder weapon, a knife.
[end_statement]

[end_testimony]

Testimony is composed of multiple statements. The player listens through them in order while looking for suspicious parts.

Presenting system

[present_point 2 knife]
Kana-chan
---
Objection!
The murder weapon wasn't a knife. It was a blunt weapon!
---
[show_evidence knife]
[set $testimony_broken true]
[jump testimony_success]
[end_present]

[present_fail]
Ike-san
---
That misses the point...
---
[add $penalty 1]
[end_present_fail]

With present_point, you define the correct answer as the combination of “statement ID 2” x “evidence knife.” Wrong combinations jump to present_fail.

The penalty system can be implemented freely with script variables. You can make it game over after five mistakes, or let the player retry forever.

Investigation mode

[enter_area office]
...processing during investigation...
[exit_area]

Investigation areas are created in an editor. Clickable regions are placed on top of a background image, and each region is linked to its own script.

Editors

The plan is to prepare four web editors.

  • Script editor: Command completion, real-time preview, syntax checks
  • Character editor: Manage standing sprites and facial-expression variations
  • Investigation area editor: Configure clickable regions
  • Evidence editor: Register item information

I’ll write about the details in another article once implementation gets further along.

Sample script

An example of what a courtroom scene would look like.

#chapter1_start

[bg courtroom]
[bgm trial_begin]
[show judge]

Judge
---
Now then, we will begin the proceedings.
Prosecution, your opening statement please.
---

[show ikesan position=right]

Ike-san
---
In this case, the defendant used the murder weapon against the victim...
---

[hide ikesan]
[show kanachan position=left]

Kana-chan
---
(I'd better check the evidence carefully...)
---

[choice]
[option "Check the evidence"]
[show_evidence_list]
[end_option]
[option "Keep listening"]
[jump continue_testimony]
[end_option]
[end_choice]

Implementation phases

This will be developed in four phases.

Phase 1: Foundation

  • Script parser
  • Basic commands (dialogue, show/hide, bg, bgm)
  • Dialogue UI

Phase 2: Core features

  • Variable / flag system
  • Conditional branching
  • Choice UI
  • Save / load

Phase 3: Game-specific features

  • Evidence system
  • Investigation mode
  • Testimony / cross-examination mode
  • Presenting system

Phase 4: Editors

  • Implementation of the various web editors

First up is Phase 1. Once the script is actually running, the rest becomes a matter of adding more commands.