Burn Some More!

The player can seemily burn everything, and at times, nothing. I had changed the WhichTile() function to look at any part of the map and instead of relying on the sprite name of the tile, to instead look at the perlin and its value. This was so the player could be placed on a non-water tile ( and presumably , anywhere ) but some of that info is done on the fly, and so it isn’t always static. Since the player will never be able to conduct an action outside of the immediate vicinity , I need to set that function to first check and see if the map is loaded before going out on a whim and checking the perlin versus the sprite.

So that helped. The player can’t light just anything on fire. The major issue here is having the maps be somewhat random in parts, which makes it hard for the script to know exactly what will be there versus what is actually there when it is loaded.

Now we need to figure out if the fires are actually timed or not. They seem to burn forever.

It turns out they are timed, and I think I have done this before where I tested to see if something was timed and instead of doing the right thing and speed up the game_minute , I just change the time, which always seems to bring about issues. They are timed, so thats great. Right now, when time is up, the fire object is destroyed, so its time to flush that out a bit. Tile fires need to replace the tile, and item fires need to replace item, and then we need to spread the fire, and then set a way to extinguish, both from rain and from a bucket of water (?)

We now have the tree tiles being replaced with dead forest tiles, which isn’t beautiful, but it is functional. We will need to create a list of aux tiles that can burn that are not ever items ( which also means any seeds items that can grow into something that exist in the aux tile realm, they will need to eventually turn into those tiles versus being one of the items ). I realize how much of a problem this is, and I am still trying to find time to at least figure out where my thinking went wrong and how one would develop differently. For now, for the prototype, we are just going to keep clicking away.

I had a issue getting items to light on fire. I ended up spending more time on a null_reference_exception steming from starting a list off by making it equal ‘null’ versus casting a new List<whatever>(); Once I realized it, I almost slapped myself. This is like, the fourth time I have done this. Hopefully the last.

So now items can burn, and burn out, but then they disappear. It appears I just didn’t have it implemented. Now, sweet tits. The camp fire burns and then is replaced by the appropriate item ( a burnt camp fire ). Funny thing, I made another camp fire. set it on top of the burnt one, and then lit it, and when it was lit, a bunch of clones of the camp fire started being made. wtf?

Simple fix, just check to see if the item could burn before igniting (weird , ya think we would have checked…..)

Then it seemed I coulden’t light a forest fire, and it was a preventive check gone bad. Stop checking to see if lists are null, david! Check the length/count of the list is greater than zero!!!

Okay, now fires burn and yeah, they burn. So lets burn some wood, instead of a campfire. I have a stack of four, and place them all on a tile and light it with the bow drill. It creates four fires in the exact same spot….. hmmmmm okay, I guess that works…. oh but wait, when the burn is over, since there is no item to be replaced, it trys to replace it with a million blank mapped items….. oh dear.

So a break insues, I come back, and try to recreate the error. I run the game, build one campfire, build another, and forwhatever damn reason, I decide to build another and CRASH!!!!!

wtf….

okay, no biggy, I needed to restart unity anyways. What the hell was that?

Fixed, fixed , fixed, blam!

Apparently, the build manager wasn’t updating the list at certain times, so trying to build something that isn’t afforded by resources will crash the game.

Items and tiles burning through the night were getting there burn clocks reset when the game clock went through midnight. Kind of a dumb one, but yeah, it works now. Next time I make a game a clock, I need to remember to make a game clock class that includes a day on top of the time in order to effectively tell time difference.

The FINAL part of fire is spreading fire. I want the forest to burn constantly unless stopped by the player with water or by rain. Each tile surrounding the fire with burnables should have a random time at which they will then ignite. Including bushes and vines.

So making fire go out because of rain is actually quite simple. Done. So, how do we spread the fire. I am thinking, for now, only tile fires can spread, so forest fires and bush fires. We can deal with item fires causing forest fires later, and visa versa .

I have created a global var in the fire manager called fire_spread_time and was thinking this would be the maximum time that it would take for the fire to spread. Each fire could have this time set and when it runs out, it randomly start one to three fires in neighboring tiles. This is where having more environmental variables would have come in handy, such as wind. But we are just going to go with bat-shit-crazy physics for now. My worry with this method is that a single tile could be surrounded with fire and never catch on its own, for now reason, making the mechanics of the wild fire seem, well, not so wild.

So lets back up. So a spread timer makes sense, in that we could set it to zero if it is a campfire ( a controlled fire ) , and it can get reset if there is more surrounding tiles that could be lit that didn’t get lit on the first spread, mainly because other tiles could set that tile on fire. ( this is starting to sound like a moltly crue song ). Lets set this up and see how it plays out.

The forest fire is spreading, but it isn’t exactly random, and I am not sure why. I am not to concerned about that right now. Also, items that are on fire do not light in a forest fire ( definitly something I should implement , but not right now ) and items on fire do not light a forest fire.

In anycase, I think this is done for now. Lets move on to the rest of the todo list and try to get further along.

Leave a Reply

Your email address will not be published. Required fields are marked *