Posts by paulevs

    Perhaps heating a house could be possible by having the game calculate an area around a heat source

    The thing is that calculation of area is not fast task. The hardest part is defining a shell formed by all construction elements around source, and calculation of that shell (most likely) can't be done in real time. That means that heat will be not obstructed by walls (as Red mentioned above), and most likely will be not in closest future

    Just some small experiments with custom sky :)



    It is also noticeable that modern water don't have reflections. I remember that someone reported that earlier. Reflections in general works - materials like marble and custom shaders have them and they work fine, but they are missing on water

    Java doesn't have structs like C# - so creating new vectors or quaternions always result in a new object on the heap

    That's why Project Valhalla exists ;)
    Well, if most names are related to original Java API that's fine, this should help old users to switch to newer API

    Why this method is actually called lookAt (since there is a method with same name in Transform and it accepts target look point)? In quaternion there is a method called lookRotation, it is probably a better name for it since it clarifies that it doesn't look at position, but instead rotates to some specific direction

    I think I will repost here a simple solution that should help, it calculates quaternion from target position and original position:

    Java
    private Quaternion rotateTo(Vector3f objectPos, Vector3f lookPos) {
    Vector3f dir = lookPos.subtract(objectPos).normalizeLocal();
    float yaw = (float) Math.toDegrees(Math.atan2(dir.x, dir.z));
    float pitch = (float) Math.toDegrees(Vector3f.UP.dot(dir));
    return new Quaternion().fromAngles(pitch, yaw, 0);
    }

    Sometimes yaw can be inverted (depends on left/right axis rule used by game engine), in that case you can just swap x and z args. And if yaw has constant offset (for example 90 degrees) you can just add that value. Input of fromAngles method is in degrees. The last value in fromAngles is roll - rotation around direction axis


    UniLib is the Universal Library for Rising World plugins. It has modular structure, which means that its functionality is separated into smaller subprojects: if you don't need the whole library functionality for your plugin you can just select modules that you need. Modules are supposed to be used as embedded libraries (packed inside plugin jar).


    Links:
    - Project License: MIT

    - Project Sources

    - Project Wiki


    Releases:

    - JitPack

    - GitHub


    Available Modules:

    1. unilib-database-utils

    - Database management module

    - Create databases, tables and requests with builders

    - Locate databases in world, plugin or custom directories

    - Store different data types (including Vector3f and Vector3i)

    - Update, remove and add new data into tables with builders

    - Don't require SQL syntax knowledge

    2. unilib-config-utils

    - Config management module

    - Create simple configs in .conf format (in plugin folder)

    - Store primitives and custom classes

    - Comment any entry with as many comments as needed

    3. unilib-terrain-materials

    - Terrain Material data storage module

    - Contains all terrain materials as constants with IDs, names and average colors

    - Have additional methods to get terrain by ID/name or get grass by length


    Planned Modules:

    - math module - some useful mathematical operations and fast trigonometric functions

    - blueprint module - integrated version of BlueLib to work with RW blueprints

    - noise module - module with different noise functions (perlin, simplex, voronoi)

    - sdf module - module with SDF functions (mostly ported from BCLib with adaptations)

    - worldgen module (when API will be updated) - to manipulate worldgen (probably will be not necessary)

    However, in the meantime, you could load the object you're looking for as Prefab: You could load the asset from the game files (for the brazier, it would be PrefabAsset.loadFromGame("Models/Objects/Brazier/brazier1.prefab"); - but you could also get the relevant paths from the definitions). You could then disable the childs manually with prefab.setActive() (the brazier has two childs called "fire" and "light") and add your own, custom childs

    This is actually how it works now - I'm creating a new prefab from object prefab path and destroy original object. The thing is that the child count is always zero, so I can't control anything inside brazier prefab (iterating over child list also does nothing since there are always zero childs). Another thing is that while torch prefab don't have flame and light source (it is in deactivated state) the brazier always have both flame and light

    Or if your player is stored in field you can use a method:

    Java
    player.showMessageBox(MessageBoxButtons.Yes_No_Cancel, "Title", "Question", 0, this::processMenuButton);
    Java
    private void processMenuButton(int button) {
    switch (button) {
    case 0 -> player.sendTextMessage("YES!");
    case 1 -> player.sendTextMessage("NO!");
    case 2 -> player.sendTextMessage("CANCEL! (Or just timeout)");
    }
    }

    Hi, this can be a simple lambda:

    Java
    event.getPlayer().showMessageBox(MessageBoxButtons.Yes_No_Cancel, "Title", "Question", 0, button -> {
    switch (button) {
    case 0 -> event.getPlayer().sendTextMessage("YES!");
    case 1 -> event.getPlayer().sendTextMessage("NO!");
    case 2 -> event.getPlayer().sendTextMessage("CANCEL! (Or just timeout)");
    }
    });

    An example of object that is not possible to handle with "fake object method" is a brazier. It has internal light and fire effect that can't be disabled without access to GameObject, so braziers looks weird with two lights and two flames inside. Ideal solution will only change color of light inside specific game object on scene directly, that's why I'm mentioning access to GameObject :)


    How this can look like (using new plugin API)



    It will be probably possible to make that idea completely on new API, but it don't have some required functionality, for example it will need to get GameObject in the scene (at least by position), otherwise it is not possible to change element properties. That example was created with "fake" objects, and it will work only with some types of lights, not with all

    Also make sure to provide the correct property name

    Thank you, adding underlines worked, I just thought that using same name as property have in shader graph will be enough



    Another small thing that was probably not reported - any definitions that are provided by object.getDefinition() will be null in the world if it will be reloaded. They works fine only with first world loaded after game was launched

    I couldn't reproduce it on my end unfortunately

    After some code and log analysis I found that it happened when Prefab was not loaded from asset bundle (incorrect argument for loadFromAssetBundle) and setMaterialParameter was called for that prefab.


    When prefab is loaded correctly the bug is missing, but setMaterialParameter is not working for me. I'm trying to set color parameter, probably this is a reason

    Good day, I tried to use setMaterialParameter method to change some variables in prefab material, but this results with game freezing and locking OS completely, while logs are overfilled with these messages up to 2GB very quickly:

    Quote

    API: Cannot find game object 3655, adding to queue...

    API: Update prefab (MaterialParameterVector4) -> (DarkColor)

    Looks like the game falls into infinity cycle

    New update is here! This version will require RW Unity 0.6.5.1 or newer since it uses new API that we get in it


    Changes:

    • Options to change color of bars and their background in the config (requested by Yaromid)
    • Option to change size of custom icons
    • Fixed many small visual offsets in built-in UI
    • Healing bones should be displayed correctly (new game API)
    • Stamina bar is fixed (new game API)
    • Error UI for admins if plugin was not updated correctly

    Download: Version 0.3.0 (bars color update, RW 0.6.5.1)

    It's our intention to expose that to the API, but we're still not 100% sure how the game should handle that specifically (because these values may change depending on the player position and the weather).

    Probably it is possible to have some sort of delay for these changes, and after some time values will smoothly become game controlled again if the plugin will not update them again.

    Or it can be possible to get default values calculated by the game and operate them on plugin side


    Not sure how such an API should look like...

    Probably it can be a custom function that will look for LOD component in GameObject and if it found one will change it or put into internal list to control later (for example when setting are changed). If the function will be not called the LOD will stay same as in prefab, and when called it will be synchronized with the game


    Yes, that's definitely planned :)

    That's good, so we will be able to override built-in definitions, but what about completely custom? Like new types of wether or objects?


    We're still not 100% sure if it's better to have events (when a chunk or world part is generated) or a way to implement and register a custom world generator module (where you could just override methods like "getTerrain()" or "getChunk()")

    Looks like events will be more compatible with each other, while custom module should be a bit faster. If the system will have events then different plugins can apply their own changes to world separately: for example one plugin can alter cave generation and another one can change ocean. If this will be done in modules they should be somehow connected with each other and "know" about changes done by other plugins, otherwise there will be only one plugin that can change world in the pack