Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Only calculating temperature when actually needed  (Read 1436 times)

☼Obsidian Short Sword☼

  • Bay Watcher
  • AKA: Obsidian Sword
    • View Profile
Only calculating temperature when actually needed
« on: September 07, 2022, 02:20:24 pm »

Temperature calculations definitely put a massive overhead on the game. It has to calculate the temperature of every single tile 100 times per seconds.

What could be done (Possibly before the steam release) is tweak the temperature code, So that it only needs to check the temperature of tiles that need to be changed, ie: tiles near a fire-imp or lava.

You could go even further, and only need to calculate(Recalculate?) if the fire-imp moves. Or if some lava fills a new air tile.

Tiles at maximum temperature don't have to be ticked as often either. And tiles like Nether-Cap, Which have fixed temperatures, don't have to be ticked at all!

This could double the speed of the game, And it should be an easy win(I could be wrong, but it should be).
« Last Edit: September 20, 2022, 09:47:49 am by ☼Obsidian Short Sword☼ »
Logged
Still an active reader of the forums.

The 10,000 Dwarf Challenge

A_Curious_Cat

  • Bay Watcher
    • View Profile
Re: Only calculating temperature when actually needed
« Reply #1 on: September 09, 2022, 05:53:30 pm »

What about fire?
Logged
Really hoping somebody puts this in their signature.

ayy1337

  • Bay Watcher
    • View Profile
Re: Only calculating temperature when actually needed
« Reply #2 on: September 09, 2022, 07:59:03 pm »

What about fire?

Keeping a list of things that are on fire and checking the tiles immediately adjacent to those is much quicker than checking every tile
Logged

rico6822

  • Bay Watcher
  • Constantly fails to become elephant man.
    • View Profile
Re: Only calculating temperature when actually needed
« Reply #3 on: September 10, 2022, 05:20:45 am »

Hopefully computers are getting tougher. I still think that not checking temperature changes all the time may cause a situation where it logically should be calculated and something unwanted happens because it didn't.
Logged
Does anybody know how to become an elephant man in adventure mode? I literally did all advanced world settings possible to increase chances.

SixOfSpades

  • Bay Watcher
  • likes flesh balls for their calming roundness
    • View Profile
Re: Only calculating temperature when actually needed
« Reply #4 on: September 10, 2022, 03:32:52 pm »

Seasonal effects (like surface water freezing in winter, or the summer heat drying up streams) can be assumed to be largely the same year by year--so, the game can continue to check for these exactly the same way it does now, in the first couple of years when your FPS is locked at 99 anyway. It simply performs the additional step of keeping a log of on which dates the temperature caused something to change. Then in subsequent years, it only checks the temperature on those dates, plus a day or two both before & after.
Logged
Dwarf Fortress -- kind of like Minecraft, but for people who hate themselves.

A_Curious_Cat

  • Bay Watcher
    • View Profile
Re: Only calculating temperature when actually needed
« Reply #5 on: September 10, 2022, 11:00:31 pm »

Speaking of temperature changes…

On my very first fort, I dug through some candy (after sidestepping a circus tent) and opened up the circus.  The clowns then proceeded to kill everyone in my fort except for one dwarf who was seriously injured.  I waited and waited trying to see if they would put this last dwarf out of their misery.  All of a sudden, my computer began shutting down with a message saying that the CPU was overheating.  I ended up partially disassembling the computer and cleaning the CPU fan and the computer worked fine afterwards.  The reason I’m mentioning this is because…

Do you think that maybe, just maybe, the stuff that I cleaned out of the CPU fan might’ve come from the underworld?
Logged
Really hoping somebody puts this in their signature.

☼Obsidian Short Sword☼

  • Bay Watcher
  • AKA: Obsidian Sword
    • View Profile
Re: Only calculating temperature when actually needed
« Reply #6 on: September 19, 2022, 10:19:57 am »

eurydike has some good ideas about it on this thread
Logged
Still an active reader of the forums.

The 10,000 Dwarf Challenge