Giter Club home page Giter Club logo

ayaka's Introduction

Ayaka

Ayaka was initially a project for OSPP 2022.

For Simplified Chinese version README, see 简体中文

About the name

The frontend is Ayaka. The runtime is Ayaka. The script is Ayaka. Just Ayaka.

What we've done

  • A cross-platform visual noval (VN) runtime with rust
  • A well-defined and easy-to-author VN config file format, based on YAML.
  • An embedded custom script.
  • CLDR-based i18n support.
  • A flexible plugin system based on WebAssembly. It provides hooks of the runtime and interop functionalities with the script.
  • A decoupled framework - the frontend, backend and plugins are decoupled.
  • A CLI frontend to check grammar errors and debug quickly.
  • A GUI frontend powered by Tauri and Vue, with Live2D support.
  • A prototype LaTeX frontend to generate PDF from the config.

Docs

Ayaka Book

API docs

Screenshot

Orga

License

This project is licensed under the MIT license.

ayaka's People

Contributors

berrysoft avatar dependabot[bot] avatar laoshubaby avatar tim-paik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ayaka's Issues

New proposal about `exec` and `switches`

解耦合 exec

exec 做成 line plugin。允许一个插件调用另一个插件( #14 )。

简化 switches

不再允许每个选项后面给出代码,这样能够解决 #24

每个选项默认绑定其顺序对应的数字名称变量,默认值为 true;被选择的选项将进入 $?。例如:

- exec: $1 = false
- switches:
  - Switch 1
  - Switch 2
  - Switch 3
- exec: $n = $?

在上述示例中,第一、三个选项可用而第二个选项不可用;$n 的值可能取0或2。

有关默认值的考虑:

  • 如果设定成 false 可用而 true 不可用,太扭曲了。
  • 但是一个 bool 值默认是 true 也很扭曲。
  • 因此决定,如果这个变量是 null 的时候为 true,其它情况与正常变量保持相同。这并不构成 Ayaka Script 的例外规则,而是 switches 的特殊规则。

Import other YAML files in config file.

Berrysoft/gal#21

We'd like to consider if the config.yaml could include other files. This will make the project easier to organize.

Consider this folder structure:

config.yaml
  └─paras
    ├─ja
    │ ├─start.yaml
    │ └─end.yaml
    └─zh-Hans
      ├─start.yaml
      └─end.yaml

However, we need to consider these problems:

  • Is this structure forced or alternative?
    • If alternative, we need to extend YAML grammar, and it is not that easy.
  • When are the files loaded?
    • If they are not all loaded at first, we need to refactor many APIs to async.

缺少锁文件

需要 package-lock.jsonyarn.lock 等固定依赖版本

Ayaka Script 与国际化支持

Ayaka Script 是完全没有国际化支持的。与之相关的资源文本虽然有国际化支持,但是在执行脚本时只是将当前语言的资源字典以及 fallback 传给了解释器。这相当于没有国际化支持。

同时,Ayaka Script 的嵌入方式非常自由,因此给国际化也带来了很大的压力。

我现在计划分离 Text 的 parsing 步骤,将 Action 分成两部分,一部分 ActionParams 是不变的属性与计算好的结果,不随语言变化;一部分 Action 在需要显示的时候即时获取,以保证所有的显示内容与当前语言匹配。但是由于 Ayaka Script 没有国际化支持,这个重构面临着某些强耦合。

代码示例1:

- \exec{ format.fmt(#r1, 123,456) }

提问:如果 r1 在不同的语言下有不同的值, format.fmt 在何时执行?

代码示例2:

- \exec{ format.fmt("{}", random.rnd(10)) }

提问:如何保证 random.rnd 只执行一次?

代码示例3:

- a = \exec{ $a }
- b = \exec{ $b += 1; $b }

提问:其它语言的文本怎么写?

我们也许需要一种新的语法来解决脚本语言的问题。

Allow prefetching for plugins.

WASMI is a little slow in debug mode, with ayacript. One possible solution is pre-parsing the scripts when loading configs.

请求解答一些疑惑

From: ljlorljl [email protected]
Topic: 请求解答一些疑惑

尊敬的王 宇逸学长:
很高兴能看到您在2022年11月5日发表的演讲:使用Rust开发的视觉小说引擎,因为您的引擎开发项目能够促使下一代视觉小说引擎的开发(目前大多数视觉小说要么使用老旧的吉里吉里,要么使用大才小用的unity),我十分赞赏您开发的Ayaka。我将您的演讲实况转载到了哔哩哔哩(视频链接:https://www.bilibili.com/video/BV1wM411m7oN ),同时在评论当中b站用户提出的问题我想请您解答一下:
你们思路有大问题,,,,

  1. 你为什么要引入新语言,你们有专门的调试器吗?有专门的文档吗?如果我是视觉小说作者,我要考虑的是上手成本

  2. 为什么要引入Web?直接走DX或者Vulkan不好吗?一个视觉小说,最重要的是一定的效果表现力。如果说rust生态有局限,重写就没有意义,如果说课程要求,当我没说。live2d是个好选择,但有时候有没那么必要。

  3. 在我看来,视觉小说应该注重资产管理,你们有没有资产管理的工具?有没有场景调试的工具?有没有预制一些动画特效和转场效果?

  4. 视觉小说的对话树你们有吗?帮助大家简化设计的工具有吗?如果你是从根本上解决这些问题,拿熟悉的语言去重写一个引擎是有必要的,否则就是重复造轮子

    期待您的答复!

此致
LJL

Replace Ayaka script with Rhai

Rhai is a powerful script language, which is highly customizable. Considering that lalrpop will not compile in the future, we can switch to rhai in a future release, maybe 0.3.

Prepare for 0.2.0

We need to publish v0.2.0 at March 21st.

  • Add more metadata. #120
  • Create tag & release.
  • Publish to crates.io
  • Update documents. Not now. The reader of our book can start from source.

Remove WASI support

After #57 merged, the only reason to use WASI is random numbers.

It is a change to remove WASI support. It will reduce the size of runtime, and resolve the conflict between Wasmtime and Wasmi.

Pack resources to a single file

Now we simplify put all files on the disk, and try to find them at runtime. It is not suitable for deployment.

We plan to take steps one by one.

  • Don't check files' existance through WASI fs. #57
  • Use tar as the pack format. #57
  • Resource override rules. #63
  • Add compression?

支持多个 WASM 运行时

现在纯用 Rust 创作并支持 WASI 的 WASM 运行时有三个:

  • Wasmtime
  • Wasmer
  • Wasmi

此外还有一些其它语言创作,但是提供 Rust 接口的 WASM 运行时:

  • WasmEdge

考虑抽象出来一个 crate,并且至少提供上面三个的实现。

我的仓库里面几个分支已经成功实现了 Wasmtime 以及 Wasmi(Windows 下需要别的 crate 的补丁)的支持。这之中 Wasmi 的跨平台支持是非常诱人的,因为它是个解释器。

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.