Jump to content

Temperature


AdrianNumbers

Recommended Posts

Well im not really sure about this one since its technical and im no programmer. (and while writing it i realised its an overcomplicated solution for problem that might never show itself in any meaningfull way but oh well maybe it can be somehow inspirational for something entirely diferent)

I assume that each fireplace scans its surroundings for closed space every tick/few ticks/seconds/game hours (probably game hours) and then based on that game decides in what range it will warm player up. This could potentialy lead to lag spikes. I would like to propose a different aproach.

1. keep a list of fireplaces (from 9 chunks area around player) with they'r coordinates in dynamic table/matrix with player coordinates also included as markers.

2. each few ticks check if player is in radius of any lit fireplace by comparing player coordinates with lit fireplaces (unlit are ignored) algoritm would subtract player coordinates from fireplaces ones starting with closest and going outwarts until it the result of substraction was either >5 or <-5 ( 5 and -5 because of max closed space dimensions) then it stops 

3. if there is a lit fireplace in that radius only then it runs check for closed space and then checks if player is in that space if not second check for lit fireplaces is made this time with 2 and -2 instead and this one doesnt induce closed space scan if lit fireplace is found.

this solution could make keeping temperature more dynamic while less impactful on TPS sice we are only keeping track of player immediate surroundings, there is less calculations done at once and it can be made much more often as such. You could also add other heat sources like torches, lit forge, lit firepit, blocks of lit coke oven/charcoal pit/Cementation Furnace, lava. Its just a matter of adding more stuff to that table/matrix and new conditions/ranges for searching algorythm.

Anyway i can be entirelly wrong here so dont judge me too hard please. :P

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.