Hello everyone! I have completed the day/night system in a test room! It now must be put into the game, but that's as easy as dropping the object in the game room. It needs a bit of tweaking and I'm going to replace the sun and moon with proper sprites eventually. Here's what it looks like.
So, how does it work? There are a ton of different elements in within the day/night system that you probably would not have thought of.
The day/night system correlates with the time. Time is a value between 0-1440. There's one minute to an hour, making each day 24 hours. 1440 is the amount of seconds in a day. I will be referring to the numeric value of time (0-1440) as "raw time."
A proportion calculates the angle of the sun based on the raw time. The sun is then drawn on the ellipse at that angle.
In this example, the proportion calculates that the sun should be at 90 degrees on the ellipse at 12:59 PM (780 raw time). It gets the position of the sun from a series of scripts.
The fading backgrounds was done very simply with a phase system. Phases are certain spans of time with specific backgrounds. There is a phase for every fading animation as well as static backgrounds. To get the fading effect, two images are stacked: the image to fade from and the image to fade to. The image to fade to starts with zero opacity and then increases to maximum opacity as time goes on. This system uses NO alarms and is very dynamic.
Until next time!
I'm not really sure what happened last month, but I didn't post anything. Oops! In the beginning of the month I was quite busy with school activities, but I started to pick up development towards the end of the month, forgetting about the blog... sorry about that guys! So... here's everything I've been working on/am still working on!
I was experiencing severe lag spikes when going from chunk to chunk. I did a bit of debugging and found that the source of the lag was saving the chunks. To optimize it, I made sure that the chunk had been modified for it to save to assure I'm not just saving the same exact thing.
After receiving help on the GMC, it was deduced that the GameMaker function ds_grid_write was slowing the game down immensely, so I tried using buffers (a faster way of saving/loading in short). It worked perfectly except for the fact that I was getting some weird bugs with it so I switched back. I will probably try to get this working again in the future.
Saving objects within chunks
I have also been working on being able to save objects within chunks. These objects are created when the chunks are initially loaded and then deleted when the chunk is unloaded. I am having trouble deleting them when the chunk is unloading, but I think I can get this working by tomorrow or the next day.
As you know, severe lag spikes happen when crossing into other chunks. I optimized it a tad by making it so that chunks had to be different than what's already saved for them to be saved again. By preloading all of the chunks, it eliminates pretty much all the lag, which is awesome.
Cellular automata caves
Today, I completed underground cave generation using cellular automata (4-5 rule)! It needs tweaking, but it's a great start. I'm excited to start adding vines, stalactites and stalagmites, and pockets of ore.
I also did some minor things:
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.