beyond-all-reason / beyond-all-reason/RecoilEngine
(infotexture) LuaShader access to GameRulesParam unsynced
- Dominant language
- C++
- Stars
- 679
- Forks
- 290
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 40
Description
I dont know if this is possible, or viable, but communicating to shaders via configints seems a tad difficult.
The reloading from file on switch is actually fine imo.
Having access to GetGameRulesParam would be nice (if that is even possible).
Only waste time on this if its easy.
```
namespace Shader {
bool LoadFromLua(Shader::IProgramObject* program, const std::string& filename)
{
// lua only supports glsl shaders
assert(dynamic_cast(program) != nullptr);
if (!globalRendering->haveGLSL) {
return false;
}
LuaParser p(filename, SPRING_VFS_RAW_FIRST, SPRING_VFS_MOD_BASE);
p.SetLowerKeys(false);
p.SetLowerCppKeys(false);
p.GetTable("Spring");
p.AddFunc("GetConfigInt", LuaUnsyncedRead::GetConfigInt);
p.AddFunc("GetConfigFloat", LuaUnsyncedRead::GetConfigFloat);
p.AddFunc("GetConfigString", LuaUnsyncedRead::GetConfigString);
p.AddFunc("GetLosViewColors", LuaUnsyncedRead::GetLosViewColors);
p.AddFunc("GetSelectedUnitsCount", LuaUnsyncedRead::GetSelectedUnitsCount);
p.EndTable();
```
Contributor guide
Research direction
Start at Shader::LoadFromLua and inspect how the existing Spring functions are registered through LuaUnsyncedRead. Determine whether GetGameRulesParam can be exposed safely in this unsynced shader context, then verify the behavior with the relevant shader or Lua tests if the repository provides them. Done means shaders can access the requested game-rule parameter without breaking the existing reload path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, lua
- Domain
- computer-graphics, game-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100