It is now time to implement FIRE! It seems odd that just now, after eight months of development, we are implementing fire into this game, being what it is (essentially a caveman).
I think I have now come across one of the few same issues that I have spawned from the inception of this code. That is that base form aux tiles are not really treated as Item_Objects, but not visa versa, and that therein lies what I believe to be an issue. Essentially, to add burn, I went right to the Item_Object file and added Burn Hours and Item To Replace When Burned. This seems logical as if there is 0 for burn hours, the item is not burnable, anything else, it can burn for that long before being replaced with what would presumably be a useless version of the item originally burned. The problem, is Trees only exist in the fashion of being a aux tile, and that is it. Bushes could burn too, and they also only exist as a tile and not anything else.
So we will start another “controller” and call it the fire controller. The purpose of this controller is to be the center point of a class called ‘fire_locations’ which will be attached to all Item_Objects that are on fire as well as tiles that are burning. It will also keep time on burning items and tiles, and switch the items and tiles once burned ( adding and removing the fire object as well ).
That file is now started, a class as discussed, and some basic functions and a update that updates all the burning locations. Game runs normally and now we begin to try and figure out how this is all going to work.
I am thinking that an Item_Object can have a “UseType” enum, where I have placed some values such as Fire, Shelter/holding, mining, cooker, forge . So the bow drill can be of UseType Fire, meaning that when it is used ( so either the use button is pressed, the user than places the item on the map, a fire starts assuming something is there to burn ), or in the event it is a shelter, it is now a semi permanent item on the map. This use type will help determine what happens at interaction and production of other items.
We are starting to enter a crazy area of development, and I would hate to point out the flaws in my own coding design, but they are starting to become apparent now. I never once have thought about having prefabbed game objects containing the Item_Object script, versus constantly creating blank game objects and running the script and its appropriate actions/reactions on the fly. Honestly, I am not sure which one is better, but I fear/feel it will become more apparent as we continue on with this. It is only a prototype, and I guess that is where I can hang my hat.
So, now that I have just opened a can of worms, lets take a single worm and make him tick. Lets start a damn fire! ( last night, I realized a rain storm should put fires out lol ).
Success! Our little guy can build a camp fire and light it with his bow drill, and he can even light the forest on fire ( little shit! ). Lighting is not right, needs to flicker, isn’t lighting the player, not close enough to the camera, fire isn’t counting down its own clock, and the player can walk through the fire, pick up his campfire ( which goes into a void? Not back in the inventory, but of course, we don’t want this behavior to occur anyways. ) So yeah….. got some work to do! AAAAAHHHHAHAHAHAHAHAHA!!!!!!
View the full article