Forum
Projects Stranded III Dev. Blog - CommentsI won't implement the urge to go to toilet periodically in Stranded III because I think it isn't a fun mechanic. There will be related mechanics though. Even Stranded II already had the mechanic that poo spawned some time after you ate a plum.
edited 1×, last 15.05.23 10:02:58 pm
However, some system of animal manure for plant fertilizer may be handy. We mainly use that irl, and for practical reasons: animals make much more of it than humans.
Also, DC, about the AI idea I had: What kinds of AI-supporting platforms, if any, are there that could be be used to import some simple ML script or programs, for training, reinforcement, etc? I'm thinking of the possibility of pre-training animal behavior before release, and/or during runtime (I am unaware the latter is feasible, though). Of course, there is also the artificial life approach (https://en.wikipedia.org/wiki/Artificial_life), which is appropriate given that, for the behavior of animals, you are trying to create something that resembles life. There are many links within that article that may contain applicable knowledge as well. And I found ALife resources here: https://alife.org/online-resources/. That may come in handy if you consider that approach.
It will probably be possible to script AI with Lua though. I'm not sure but it might be possible to create a machine learning interface that way if you really want to.
ChatGPT to the rescue!
DC: I saw the problem you had and asked everyone's brainless assistant for solutions (I just copy-pasted your words into the prompt. I oughtta get an award for such monumental effort ). Luckily, it has some advice. Hopefully it works to help fix the difficulties you're having with the script editor.
ChatGPT has written
Implementing syntax highlighting and syntax checking in an in-game Lua script editor without actually running the script can be challenging but not impossible. Here are some suggestions on how to achieve these functionalities using MoonSharp:
Syntax Highlighting:
Tokenization: Use a lexer to tokenize the Lua script into individual tokens (keywords, identifiers, literals, etc.).
Color Mapping: Create a mapping between token types and their corresponding colors for highlighting.
Text Rendering: When rendering the script in the editor, apply the color mapping to each token based on its type.
Syntax Checking:
Static Analysis: Perform static analysis on the Lua script to detect syntax errors without executing the script.
Parser: Use MoonSharp's parser to identify syntax errors in the script. The parser may raise specific errors for invalid syntax constructs.
Error Indicators: When errors are detected, mark the problematic lines in the editor with error indicators and display the error messages.
Improving Highlighting and Performance:
Semantic Highlighting: Extend the highlighting to support user-defined methods and variables. To do this, you need to understand Lua's scoping rules and identify these elements in the script.
Caching: Cache the highlighted tokens to improve performance when rendering the editor. Recalculate the highlighting only when the script changes.
Background Highlighting: For large scripts, consider using a background highlighting approach. Instead of highlighting individual tokens, highlight entire lines or blocks based on their syntactical meaning. This can help improve performance.
Async Highlighting: Perform highlighting asynchronously in the background, so the editor remains responsive during large script parsing.
Please note that achieving perfect syntax highlighting and syntax checking in an in-game editor can be complex and may require substantial development effort. Since MoonSharp is an interpreter and not a static code analyzer, some limitations in achieving absolute accuracy are expected. Nonetheless, implementing the suggestions above should significantly enhance the editing experience for modders and improve the usability of the in-game Lua script editor in Stranded III.
Syntax Highlighting:
Tokenization: Use a lexer to tokenize the Lua script into individual tokens (keywords, identifiers, literals, etc.).
Color Mapping: Create a mapping between token types and their corresponding colors for highlighting.
Text Rendering: When rendering the script in the editor, apply the color mapping to each token based on its type.
Syntax Checking:
Static Analysis: Perform static analysis on the Lua script to detect syntax errors without executing the script.
Parser: Use MoonSharp's parser to identify syntax errors in the script. The parser may raise specific errors for invalid syntax constructs.
Error Indicators: When errors are detected, mark the problematic lines in the editor with error indicators and display the error messages.
Improving Highlighting and Performance:
Semantic Highlighting: Extend the highlighting to support user-defined methods and variables. To do this, you need to understand Lua's scoping rules and identify these elements in the script.
Caching: Cache the highlighted tokens to improve performance when rendering the editor. Recalculate the highlighting only when the script changes.
Background Highlighting: For large scripts, consider using a background highlighting approach. Instead of highlighting individual tokens, highlight entire lines or blocks based on their syntactical meaning. This can help improve performance.
Async Highlighting: Perform highlighting asynchronously in the background, so the editor remains responsive during large script parsing.
Please note that achieving perfect syntax highlighting and syntax checking in an in-game editor can be complex and may require substantial development effort. Since MoonSharp is an interpreter and not a static code analyzer, some limitations in achieving absolute accuracy are expected. Nonetheless, implementing the suggestions above should significantly enhance the editing experience for modders and improve the usability of the in-game Lua script editor in Stranded III.
Also, if Moonsharp just ends up being insufficient for your intended purpose, I had ChatGPT propose viable alternatives.
ChatGPT has written
Now, let's explore some potentially superior alternatives to MoonSharp for Stranded III, focusing on Lua scripting and Unity3D compatibility:
NLua:
Advantages:
Full integration with Unity3D: NLua offers seamless integration with Unity3D, making it easy to use Lua scripts within the game.
Faster Execution: NLua is known to have faster execution times compared to MoonSharp, which could improve performance for large and complex scripts.
Comprehensive Documentation: NLua has extensive documentation, which can be beneficial for developers when learning the API and troubleshooting issues.
Disadvantage:
Limited Cross-platform Support: NLua is primarily designed for Windows, which might be a disadvantage if you aim for multi-platform support in Stranded III.
UniLua:
Advantages:
Unity3D-Focused: UniLua is specifically designed for Unity3D, ensuring better compatibility and ease of integration with the engine.
Lightweight: UniLua is a lightweight and efficient Lua interpreter, making it suitable for use in resource-constrained environments.
Active Development: UniLua has an active development community, ensuring continuous improvements and updates.
Disadvantage:
May Lack Advanced Features: While UniLua is optimized for Unity3D, it might lack some advanced features that other Lua interpreters offer.
SLua:
Advantages:
Unity3D Asset Store Support: SLua has a dedicated asset store package, which simplifies its integration into Unity projects.
Good Performance: SLua offers decent performance, striking a balance between execution speed and resource usage.
Strong Community: SLua has an active community, which can be beneficial for getting community-driven support and resources.
Disadvantage:
Potential Compatibility Issues: As with any third-party asset, there might be occasional compatibility issues with Unity3D updates.
XLua:
Advantages:
Strong Performance: XLua is known for its excellent performance, offering fast script execution times.
Good Community Support: XLua has a large user base and active community, providing ample resources and help for developers.
Cross-platform Support: XLua supports multiple platforms, which is essential if you plan to release Stranded III on various operating systems.
Disadvantage:
Documentation: The documentation for XLua might not be as comprehensive as some other alternatives.
NLua:
Advantages:
Full integration with Unity3D: NLua offers seamless integration with Unity3D, making it easy to use Lua scripts within the game.
Faster Execution: NLua is known to have faster execution times compared to MoonSharp, which could improve performance for large and complex scripts.
Comprehensive Documentation: NLua has extensive documentation, which can be beneficial for developers when learning the API and troubleshooting issues.
Disadvantage:
Limited Cross-platform Support: NLua is primarily designed for Windows, which might be a disadvantage if you aim for multi-platform support in Stranded III.
UniLua:
Advantages:
Unity3D-Focused: UniLua is specifically designed for Unity3D, ensuring better compatibility and ease of integration with the engine.
Lightweight: UniLua is a lightweight and efficient Lua interpreter, making it suitable for use in resource-constrained environments.
Active Development: UniLua has an active development community, ensuring continuous improvements and updates.
Disadvantage:
May Lack Advanced Features: While UniLua is optimized for Unity3D, it might lack some advanced features that other Lua interpreters offer.
SLua:
Advantages:
Unity3D Asset Store Support: SLua has a dedicated asset store package, which simplifies its integration into Unity projects.
Good Performance: SLua offers decent performance, striking a balance between execution speed and resource usage.
Strong Community: SLua has an active community, which can be beneficial for getting community-driven support and resources.
Disadvantage:
Potential Compatibility Issues: As with any third-party asset, there might be occasional compatibility issues with Unity3D updates.
XLua:
Advantages:
Strong Performance: XLua is known for its excellent performance, offering fast script execution times.
Good Community Support: XLua has a large user base and active community, providing ample resources and help for developers.
Cross-platform Support: XLua supports multiple platforms, which is essential if you plan to release Stranded III on various operating systems.
Disadvantage:
Documentation: The documentation for XLua might not be as comprehensive as some other alternatives.
edited 13×, last 01.08.23 02:05:03 am