[Suggestion] Colorful Flames

The next update will be available on Wednesday, December 18, in the early evening (GMT+1).

This update will not yet replace the Java version, instead it is the actual content update. We'll provide more information about the transition together with the update.
  • At this moment we have a flame with only one color in the game - orange. What if it will be possible to change flame color? If I remember correctly there were plans to add dye system into the game, probably some sort of dye dust can be used to colorize flames? Or some special item, probably temporary.


    There are several benefits of colored flames. For example you can make good looking fantasy builds (with interesting/magic atmosphere), or use torches with different colors as markers for different things.


    Example of RL colored flames


    1024px-Coloured_flames_of_methanol_solutions_of_metal_salts_and_compounds.jpg

  • 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

  • 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 :)


  • Basically it would be indeed quite useful if there was a way to access built-in game objects :thinking: The only problem would be to implement that in a consistent and reliable way... objects like furniture are bound to a chunk, so if the chunk is regenerated (e.g. if the player comes back after walking away), the object prefab would be loaded again (missing any changes you've done to it in the meantime) :/


    But probably it would work if the game always keeps track of all modifications that had been done through the API - if the game then reloads the object prefab, it would have to go through that list again and re-apply all changes. This approach may have some minor performance implications (especially when doing lots of modifications)... but we'll think about adding such a feature ;)


    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 ^^

  • 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

  • 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

    Yes, unfortunately you can't iterate over prefab childs (i.e. childs which are part of the prefab asset) :/ The API only provides direct access to childs for user-created game objects (i.e. only elements which were created through the API and added as child to a parent manually). Actually the API isn't aware of the actual prefab asset hierarchy (because prefabs are and other assets are only loaded clientside). This may change in the long run, but we don't have an ETA for that yet...


    To overcome this limitation, the Prefab class accepts a path for most methods - you can optionally provide the path to a child element there (i.e. a child which is part of the prefab asset itself). In case of the brazier, the childs are called "fire" and "light", so you could disable them that way:

    Java
    Prefab prefab = new Prefab(PrefabAsset.loadFromGame("Models/Objects/Brazier/brazier1.prefab"));
    prefab.setLocalPosition(player.getPosition());
    //Disable fire
    prefab.setActive("fire", false);
    //Disable light
    prefab.setActive("light", false);
    player.addGameObject(prefab);


    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

    This is a small oversight, basically it doesn't matter too much because the game overrides the state anyway when spawning the prefab ^^

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!