Sorry for the extensive break I've had from Crevis. I've several things in the past month and a half, most of which are fairly boring.
I first continued where I left off and implemented the day/night system into the game. It looks great, but I plan to add shaders to the sun to give it an edge of realism.
I spent the rest of the time trying to resolve a particularly annoying lag spike, and I've been pressed with a particularly hard decision. A major lag spike happens when entering a new chunk and lasts for about a fourth of a second. It may not seem very long but it can be very annoying when exploring new terrain. Unfortunately, I wasn't able to find a way to remove the lag. One way of reducing the overall lag is to rewrite the inventory system, as its pretty inefficient.
My personal knowledge of memory management and arrays have grown greatly over the past year, and the inventory system that I created last March is not as efficient as it can be. I plan to rewrite the inventory system shortly, which should bump the game's frames up by at least fifty.
Now, onto the meat of the post - using color to store multiple values.
The GameMaker coding language doesn't have very many datatypes. For example, a vector3 would have easily allowed us to put three values into a grid cell. Unfortunately we don't have that data type. This presented me with a problem. I needed at least one metadata slot, so I created a separate grid to hold metadata. As time went on the need for metadata kept coming up - durability, random block sprites, enchantments, and so on. These are values that cannot be held by a single slot.
I had to find a way to put multiple values into one grid cell. At first I used ds_lists but they ate up way too much memory. I made a post on the forum and someone mentioned make_color_rgb.
This function allows you to create your own colors by inserting a value for red, green, and blue. The value it produces is a 24 bit number that stores the three values, perfect for what I need. Today and tomorrow I will be re-organizing item property lists and will be implementing a system that can incorporate the function into the game.
Until next time!
February's task is to improve the combat system and create a system for enemies and their AI.
The author of the blog is Alec. He posts weekly, usually on the weekends on Saturday.