Code Monkey home page Code Monkey logo

luastg-sub's People

Contributors

demonese avatar tru-dev 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

Watchers

 avatar  avatar  avatar  avatar

luastg-sub's Issues

"Not enough memory resources are available to complete this operation"

i've been facing this strange error during my experience in using LSTGSub. It did not exactly happen before, but it's a prevalent issue ever since, and it prevents me from loading my projects and testing what I have created. even just lauching the vanilla LuaSTGSub.exe to see the demo mode, the same error is given to me. my laptop specs are included in the engine.log file attached.

engine.log

[Shader] 为着色器编译提供更多功能

目前想到的:
1、通过 hlsl 宏定义,提供常用的宏用于简化寄存器声明等
2、提供 hlsl 的 #include 功能,方便编写复杂的 shader
3、允许开发者编译 shader 的时候传递自定义宏定义,允许将不同的功能模块写进同一个 shader,然后通过不同的宏定义编译出不同的 shader 字节码

提供随机数发生器的更多功能(保存状态和从状态恢复)

说明
目前随机数发生器只有从某seed开始不断取后续值的功能,遇到需要从中间某状态恢复的需求时则较为困难

现有方案的局限

  • 无法复制随机数发生器的状态,只能从种子开始连续取随机次数个随机数

实际使用遇到的问题

  • 为了从某个游戏状态中恢复,随机数发生器作为一个外部系统需要同时可以和其他游戏状态一起回滚

其他事项

  • 建议使随机数发生器的状态可序列化,这样方便进行文件写入等操作

提供使用sprite自行组合animation资源的方法

说明

由于 animation 资源的加载方案只有基于区域完全密铺的方案,导致 animation 资源在实际上是一种对资源空间利用率非常低的结构

现有方案的局限

  • 资源必须满足 m*n 的密铺结构
  • 没有类似于 margin 的参数,导致无法剔除无用像素

实际使用遇到的问题

  • 为了提高利用率会对图像做一些特殊排列,但是不一定能满足 m*n 的密铺,可能会缺少几帧
  • 为了提高空间利用率,帧位置可能会出现在不同的位置,且不一定是整齐的
  • 为了提升渲染效率,需求剔除空白像素,但由于缩放渲染的时候的边缘问题因此常规需要添加间隔来避免边缘问题
  • 为了能使用对象自身的渲染方法/避免自行渲染帧/避免自行设置帧导致各种特殊问题,导致必须使用 animation 资源

结论

综合以上来说,我认为需要实现一个新的针对 animation 的加载方案来解决这些问题

Using rendertargets as texture in fullscreen, then changing focus, causes weird behavior

I've been experimenting with using rendertargets as textures, and one thing that's bothered me is that if you click on another window in fullscreen (I use two monitors) it breaks depending on how it's rendered.

If using lstg.RenderTexture: Sampler state set in lstg.SetTextureSamplerState breaks.
If using lstg.LoadImage on the rendertarget, then rendering that image: The image freezes.

If you could fix this that would be amazing, I'd like to use this concept to better organize how stuff is rendered in game, and this is practically the only thing that would prevent me from doing so.

BUG: Using _a/_r/_g/_b on an object with an advanced render class crashes the game

When modifying an object's color using self._a, self._r, self._g and self._b (but not self._color), LuaSTG crashes with no error and no information on the .log file.
Code in image below: (zclass is identical to Class, however, it sets the [".render"] key of the class to true automatically, tests done on the code packaged with the latest release in Github, v0.18.10.)
image
image
The engine.log:
engine.log

[Initialization] 允许在配置文件中配置引擎的文件系统根路径

当前引擎默认使用工作路径作为文件系统根路径,但有时候会有特殊的需求,比如保持文件系统根路径为exe可执行文件所在路径,或者32位、64位版本的引擎分别放在x86、x64文件夹内时,需要将文件系统根路径设置为相对exe的上一级路径。

本提案为config.json配置文件添加一个字段,用于引擎初始化时配置文件系统根路径。

示例:

{
    "filesystem_root": "${EngineExeFileDir}/../"
}

TODO: 文本渲染的改进

  • 有些字体只用到ASCII部分,也分配1024x1024的大纹理缓存可能太浪费了,应该考虑弄一个公共字形缓存
    • 新问题:如果用了公共字形缓存,那么当一个字体被卸载掉,那些占用了的空间应该如何回收?
  • 字形缓存有多张纹理的时候应该合批渲染
  • 应该新增 Label 对象?避免每次绘制都重新计算一次布局
    • 也许可以不新增对象,而是通过缓存字符串来映射

Silent crash when PostProcess is misused

Using PostProcess(shdr,rt,id,blend,{ num1, num2, num3, num4 }) instead of PostProcess(shdr,rt,id,blend,{{ num1, num2, num3, num4 }}) causes the application to silently crash, without any errors or mention on engine.log.

[Display] 添加固定设计/渲染分辨率的画布模式,避免繁琐的渲染分辨率处理

固定设计/渲染分辨率的画布模式其实在很多 2D 游戏(比如 galgame)和弹幕风中都有使用,其特征为,画布大小固定,渲染分辨率固定,且对平台相关的窗口大小、显示设置等无感知,也与它们无关。

由于该改动过于巨大,可能会涉及引擎大量组件的更改和 Lua API 的巨大变动,计划开一个新分支用来实现该特性。

设计上:

  • 窗口显示模式大改, 不再支持显式指定窗口大小, 窗口大小也不再固定,允许自由调整大小
  • 全屏显示模式大改,自动选择合适的方式进行全屏显示,且不再支持显式切换独占全屏
    • 1、对于 Windows 10 1809 及以上的系统,采用 DirectComposition 底层系统 API 进行独占全屏模式显示,以获得最高的效率
    • 2、根据设置的画布大小,挑选适配的显示模式,尝试进入传统独占全屏模式
    • 3、在第 2 条失败的情况下,对于 Windows 8.1 及以上的系统,采用 DirectComposition 底层系统 API 进行全屏无边框窗口显示,以获得最高的效率(已放弃,它在 Windows 8.1 上并不比传统的全屏无边框窗口好)
    • 4、在第 3 条不满足的情况下,回退到传统的全屏无边框窗口进行显示
  • 变更 Lua API 的行为:
    • 显示框架变更:
      • lstg.SetWindowed 允许运行时调用,且切换全屏显示模式时不再直接进入独占全屏模式,而是自动选择最优的全屏模式(暂时不改,维持 API 行为一致性)
      • lstg.SetVsync 允许运行时调用(暂时不改,维持 API 行为一致性)
      • lstg.SetResolution 允许运行时调用,且不再修改窗口大小,而是修改画布大小(暂时不改,维持 API 行为一致性)
      • lstg.EnumResolutions 被废弃
      • lstg.ChangeVideoMode 不再修改窗口大小,而是修改画布大小,切换全屏模式时不再直接进入独占全屏模式,而是自动选择最优的全屏模式(此 API 的行为表现上应该和以前不会有差别,即使实际行为已改变)
    • 鼠标输入变更:
      • lstg.GetMousePosition 获取的鼠标坐标是相对画布的
      • lstg.Input.Mouse.GetPosition 获取的鼠标坐标是相对画布的
    • 渲染器变更:
      • lstg.CreateRenderTarget 创建的“自动大小”(不填写大小参数)渲染目标,其大小和画布的相同,而不是和窗口的相同
      • lstg.SetImageScale 不再支持修改全局渲染缩放(为了兼容,可以不抛出错误,而是打印警告)(暂时不改,维持 API 行为一致性)
      • lstg.Snapshot 固定截取画布的内容

进度:

  • 方案设计
  • 测试版开发
  • 公开测试
  • 发布正式版,并宣布特性为稳定(stable)

在启动过程中的某些报错运作不正常

在launch文件中的直接报错不会导致程序退出,而是在报错后继续启动程序(虽然实际并没有用,但一直会开着)

同时,在 luajit/luajit#1021 提出的问题会影响到引擎的工作,会在不触发任何报错的情况下直接导致引擎退出,同时在日志中无法查阅到任何信息(包括进行引擎销毁等行为),疑似直接导致引擎闪退而不是正常的报错退出流程

[PostEffect] 开放更多的纹理寄存器

目前纹理寄存器只开放了 1 + 4 个,一开始我觉得已经够用了。
但是万万没想到,紫毛福瑞居然和我说不够用。
那就得考虑开放到 1 + 15 了。

目前需要考虑的问题:
1、如何解决兼容性问题?引入新的 API 来实现?
2、是否应该通过 hlsl 语言的宏定义功能来简化 shader 编写和内建变量的配置?

一些关于未来的功能开发的建议与需求

1.对于RenderTexture时的异形顶点渲染方案

参考弹幕风与LuaSTG-X中的顶点动画渲染设计,提供对于各种非常规四顶点情形下的纹理渲染支持,降低用户自行模拟所带来的额外性能损失

2.对于指定Texture的纹理寻址方式设置需求

很多情形下(例如符卡背景)会存在需要循环寻址的需求,而现有的解决方案是手动重复渲染或者使用尚未公开说明的特定API实现,而该API实现会影响全局状态,需要自主还原,带来许多不必要的麻烦与性能损失,因此需要有一个可以针对指定纹理的寻址方式修改需求
其实对于大多数用户来说使用时更倾向于Sprite内部的循环寻址但是这个总感觉非常微妙,这种东西另外再考虑吧

更多需求待后续添加,我也有点忘了

Models disappear when captured through RenderTarget

I added a model to the stage background of my script, and when the boss comes in it disappears. It seems to be related to the RenderTarget more than the PostEffect shaders.

To reproduce, try rendering a model resource between calls to PushRenderTarget and PopRenderTarget.

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.