Content: Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Background: Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Pattern: Blank Waves Notes Sharp Wood Rockface Leather Honey Vertical Triangles
Welcome to TerraFirmaCraft Forums

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

  • Announcements

    • Dries007

      ATTENTION Forum Database Breach   03/04/2019

      There has been a breach of our database. Please make sure you change your password (use a password manager, like Lastpass).
      If you used this password anywhere else, change that too! The passwords themselves are stored hashed, but may old accounts still had old, insecure (by today's standards) hashes from back when they where created. This means they can be "cracked" more easily. Other leaked information includes: email, IP, account name.
      I'm trying my best to find out more and keep everyone up to date. Discord (http://invite.gg/TerraFirmaCraft) is the best option for up to date news and questions. I'm sorry for this, but the damage has been done. All I can do is try to make sure it doesn't happen again.
    • Claycorp

      This forum is now READ ONLY!   01/20/2020

      As of this post and forever into the future this forum has been put into READ ONLY MODE. There will be no new posts! A replacement is coming SoonTM . If you wish to stay up-to-date on whats going on or post your content. Please use the Discord or Sub-Reddit until the new forums are running.

      Any questions or comments can be directed to Claycorp on either platform.
zomseffen

[Request API Feature]

9 posts in this topic

Hello,

I'm currently trying my hands at a addon that would include a more complex enviromental temperature model,

i.e. rooms can be warmed up by campfires ect.

The problem with that is that currently there is no way, that I could find, to replace or alter the temperature calculation in a way that TFC's original blocks also use it.

I would request a slight change to the class so that there is a protected set-able static instance of the class.

All static methods of the class would refer to the instance and the original code would be shifted into a privat method.

I would attach a file where I did exactly that, but I can't.

If you want it I can send it, but I wouldn't bother with git as it is only one file and I changed a lot of other stuff in my worspace to test stuff.

 

Thanks for reading.

1

Share this post


Link to post
Share on other sites

Current version of the mod is the final version. Devs will no make an update anymore.

It is impossible or very hard to make a complex environmental model even with changes in API and classes accesses. The problem is in temperature cache - it is keeps temperatures in two dimensions: X and Z. So if you'll try to get a cached raw temp in coordinates X Y Z, you'll get the same temperature on the same X Z and any height. Changing current temperature cache model means change value retrieving and calculating methods - that's not possible without ASM or making big changes in the TFC Core. And implementing the third dimension in the temperature cache can affect performance significantly.

0

Share this post


Link to post
Share on other sites

So I guess I will need to make my own fork...

At least if I want to continue with my idea.

 

It would not be that hard to extend the Temperature model.

For the simplest extension, that features actual heat sources I would add a cache containing listed heat sources (i.e. when you build a campfire it registeres itself under its coordinates) and each check for temperature would include a check of nearby heatsources and a heat calculation with those.

The calculation could be as simple as calculating the distance and multiplying this with a heat-factor.

0

Share this post


Link to post
Share on other sites

I was also thinking about mod adding temperature, but after code analysis I think, that fork is a best way.

In my opinion, the simplest method of heat source calculation is to use light level. In TFC most of lights sources are also heat sources, so it is somewhat accurate.

By the way, lava or hot springs should increase nearby block temperature if there is no rainfall (and affect vegetation).

0

Share this post


Link to post
Share on other sites

And just with this comment you said why light level doesn't work.

Hot springs do not spread light.

Also heat distribution in reality isn't as disturbed by non see-through materials as light.

 

For the new heat mechanic to affect vegetation is actually one of the main reasons for my  API request, since it as it is right now would be impossible.

0

Share this post


Link to post
Share on other sites
3 hours ago, zomseffen said:

Hot springs do not spread light.

Also heat distribution in reality isn't as disturbed by non see-through materials as light.

Yes, and it is a reason, why I stated, that it should be taken into account separately. BTW, there is already code for this in TFC, but not in climate, only in player body temperature:

https://github.com/Deadrik/TFCraft/blob/master/src/Common/com/bioxx/tfc/Core/Player/BodyTempStats.java

Probably a reason why lava/hot springs is not affecting vegetation temperature is that worldgen need to know annual average temperature, therefore it cannot take into account variable such blocks.

 

If talking about heat distribution, it goes mainly by IR radiation, exactly like visible light. Convection go up, diffusion is small due to low heat conductivity, therefore using light level is good approximation (except before mentioned hot springs and lava).

 

For the new heat mechanic to affect vegetation is actually one of the main reasons for my  API request, since it as it is right now would be impossible.

I thought, that you wanted to implement body temperature, something like Enviromine for TFC?

0

Share this post


Link to post
Share on other sites

The code in TFC is not fuunctional as extraFoodConsumption and extraWaterConsumption never are set to anything other than 0 (see line 61 and 62 the computation is commented out).

The worldgen would not be affected much (except around lava and hot springs maybe) as everything that would change the temperature from the standard equation i.e. campfires can only appear after it was generated(placed by players).

Just now, ciekma said:

I thought, that you wanted to implement body temperature, something like Enviromine for TFC?

Yes I want to make something like that, but it would make no sense to ignore the existing temperature mechanic as it would seem strange if a plant freezes to death in a room you heated up as to not freeze yourself.

 

0

Share this post


Link to post
Share on other sites

All the body temperature and ambient temperature were half complete. The ambient temperature used to be calculated and displayed in F3. However it was an insane resource hog and when we disabled it in our fork we saw a huge performance boost on our server. So it was disabled in the official version. 

0

Share this post


Link to post
Share on other sites

Yeah I can see why it was a resource hog.

Basically it iterated through each block in a 15x7x15 block around you whenever it wanted to apply local heatsources.

I will try another approach. I will let each heat source register itself to the chunk it is in.

Then I will only need to look for the neighbouring chunks around the player and their registered heat sources, which will be, in most cases, less than 15x7x15 and therefore more effective.

0

Share this post


Link to post
Share on other sites