Today was a fairly productive day. I tackled trees, scriptable items, and a few inventory bugs.
I pretty much did trees the same way as vegetation - create them as tiles and give them special properties to have the player ignore them when checking for collisions.
I also created scriptable items! This means that when consuming an item I can run a script - eating, drinking, potions and various effects are now possible. I created a test item 'Nifedipin' that allows me to noclip in the world. This is pretty useful when taking screenshots and generally flying around. Back on track: I created scriptable item functionality without adding any more variables to the long list of existing variables for the items.
TL;DR - There are a ton of variables in the item array and I decided to reuse them.
Notice the variables block_tile, block_obj, and block_hard. These are all variables that aren't being used because the it's an item that can't be placed. Because they aren't being used, I can use them for the scriptable items.
Block_tile tells the engine that it's a scriptable item, and from that point the game recognizes that there's a script in the block_obj variable and a parameter in the block_hard variable. Then I simply plug these variables into something like this:
Until next time!
Today was extremely productive. I created the biome system... and it's much closer to being done than you'd think. When starting the biome system, I wanted them to be chosen based on temperature, so that deserts don't spawn next to tundras. As of right now, there are 19 different biomes, and they are ordered by their temperature.
As I said, these are a few basic biomes and there will be many to come.
You might've also noticed that there's vegetation! There was no system in place to deal with vegetation/decorative tiles, so I added different plants the same way that I added in blocks, and I modified their collisions to act as plants. I also added capability for multiple textures for blocks, but I'm not sure if the method I'm using is very efficient - so we'll just have to see how it works out.
Furthermore, I removed the chunk border lines and made it so that 5 chunks are always loaded around the player to make the experience more seamless. However, this took a huge toll on the fps, dropping it from a consistent 300 fps to 200 fps. I (obviously) still need to work on optimizing the game. Tomorrow, I'm going to work on adding trees and possibly caves.
Until next time!
Today was full of advancements within the engine. In the morning I decided to tackle fall damage, which of course led to some kind of health system. When working on fall damage, I also took it upon myself to improve the player physics, as I was a bit bothered while testing fall damage - I jumped off a tall pole of dirt and fell to the ground with no sort of acceleration. So, I decided to incorporate acceleration and terminal velocity (which is set at about ~70 blocks per second). I then incorporated the improved falling physics into the fall damage system, making it so that velocity affects damage. This makes it possible to add gliders with no damage at all, or dropping a measly two blocks to be instantly killed. (Completely unrelated, but I also added a small tag by the hotbar that shows which item you have selected in the color of its rarity).
However, after testing for a prolonged period of time, I found myself with negative health in many situations, which brought me to create a death screen. The death screen chooses from a number of different messages and displays them. I also created a player state machine so that I can set the player to be in different states - different states execute different scripts. Right now, the only two states are playerDead and playerActive.
Aside from all of that, I also managed to align chunks correctly, regardless of the generation settings. This is a big step for biomes, as it allows me to generate chunks with radically different settings and still have them be in line with each other.
Until next time, folks!
February's task is to improve the combat system and create a system for enemies and their AI.
The author of the blog is Niften, or Sour Apple. He posts weekly, usually on the weekends on Saturday.