Hyperproductivity!

Today was incredibly productive. I actually got quite a few new things added and fixed some of the more readily apparent bugs. I didn’t quite get all the refactoring done that I wanted to, but I did manage to clean up a few systems here and there. I’ll try to do a little more clean up in tomorrow’s build, but for now, let’s see what we have today!

If you’ve pledged to the Subscriber tier or higher on my Patreon, you can download this build right now!

Day 6’s Progress

What Did I Do Today?

Day/Night Cycle

Since I spent so long on the lighting system, yesterday’s build was locked in perpetual darkness. I didn’t want to leave it like that for very long, so today I added a Day/Night cycle to compensate. The way it works is pretty simple.

In Unity you can define Gradient properties to allow you to set up color animations in the inspector. All I did was rotate the sun (default directional light) around its X axis, then compare the dot product of the sun’s direction with Vector3.down to get a value where 1 is noon and -1 is midnight. Adding 1 and then dividing by 2 normalizes this value to between 1 and 0, and then I just sample the color gradients using Gradient.Evaluate to set things such as the ambient light, sky color, and color emitted by the sun.

I had to modify the shader a bit so that I could pass in this ambient color and replace it with the voxel light color when it gets dark. The end result is a pretty decent solution whereby lights aren’t very visible during the day, and are very effective at night. It’s a little rough now, but I can easily improve this later.

New Day/Night Cycle

Time Controls

One of the main things people complained about in the old voxel MMO was the inability to freely adjust time to check how a specific build looks in different lighting. I’ve solved that today by adding a simple time control slider. All you have to do is tick a box to override the natural flow of time, then move the slider handle left/right to change the sun’s position in the sky. Convenient!

New Time Controls

Light Tool

Next I added a new tool to facilitate adding and removing voxel lights. I’m pretty happy with how the icon turned out. While the light tool is selected, you can even see the light sources as little floating orbs, making it at lot easier to hone in on the exact source of the light. The voxel color palette can be also used to select the color of the resulting light source.

New Light Tool

Multithreading

As part of my refactoring efforts, I moved the mesh generation off the main thread and into its own thread. This allows the app to make better use of multi-core CPUs and helps alleviate the adverse effects of computationally heavy processes. In layman’s terms, everything should be a bit faster now. I’ll be moving more systems to their own threads in the coming days as well.

Minor Changes

Today’s progress was pretty noticeable, but we’re not done yet. Today I added the Shift key as a modifier to allow you to move at 3x normal speed. This will be useful for zipping around the map a lot quicker.

I also fixed two pretty annoying bugs. One of which was mentioned in Day 3’s Dev Log as being a weird problem with the cursor sometimes going inactive and preventing you from placing blocks, or worse – placing blocks somewhere you didn’t intend. This turned out to be my fault. I lazily put int.MaxValue as the raycast’s distance, which caused floating point accuracy to take a nosedive, resulting in your cursor sometimes landing on anything but what you were trying to look at. This should be 100% fixed now.

The other bug would happen when you recently added or deleted a box using the pencil tool, and then used the Alt+Click shortcut to colorpick another voxel. Your previous box would be filled with whatever new color you just picked. This is also fixed as of today’s build.

Moving Day Approaches

Moving day is coming up quick, so the next few progress updates might be a little thin. I may spend the a few days porting over some systems from old builds which are already in pretty decent shape so as to save a little time. The first thing I plan to get implemented tomorrow is a simple save/load system so that I can start building out a decent demo scene for screenshots and gifs. If you made it this far, thanks so much for your time! I’ll see you guys tomorrow!

Things are Coming Together!