• Register
Post news RSS Shadows and Inventories

This past week has included a few fun new additions for ScrumbleShip.

Posted by on

Hi all! It's a wonderful, snowy day here in Washington. I took a little time off today to enjoy the snow - You can see what the girls did to me when I stopped to lie down for a moment. Surprisingly cozy!

But I've also been busy this week adding and editing ScrumbleShip. I applied Garmine's (Thanks Garmine!) glfw3 patch, finally bringing glfw3 support - This should fix a TON of context-related issues some people have been reporting. Other than that, I've been working on two major things - One visually appealing, one exciting for the future.


Here we can see the shadow system, nearly entirely fully realized. From each light, a block-level ray is cast, figuring out which nearby blocks are possibly illuminated. After that, when each voxel is cached, a voxel-level ray investigates the space, determining how much light can reach an object.

Both processes mainly make guesses about the light, rather than rigorously proving what the shadow should be. That said, the result ends up looking pretty excellent. This system can handle any number of simultaneous lights, of any colors.

These are still some issues to solve before this becomes default, though - Currently this system is very slow, and slows down block building. I have a couple good ideas on how to fix that. It also doesn't behave well when new blocks are added to a scene, so I need to track down the bug there and fix it as well. That said, the system IS available in the latest bleeding edge - Just open config/text/options and set "experimentallight" to 1.


To make any of this happen, I had to finally fix up the generic raycasting. Although for the moment that means player/ship hit detection is a little funny, in the long term it means more accurate hit detection, better lasers, and, eventually, ship/ship crashes. The raycasting has been a thorn in my side for some time - I finally managed to translate the problem into the appropriate math jargon, and with the help of Tuqz (Thanks Tuqz!) and some others, figured out how to accurately specify a line in 3D space.

The image is a visualization of raycasting at work. From the origin point of a light, I drew a voxel wherever my ray passed through, coloring it more yellow the farther away from the light it got. The end result was this surprisingly beautiful pattern.


Now for the exciting stuff. While it may not look like much, this image is the beginning of a new push in ScrumbleShip - Gameplay features. We've basically gotten the graphics, general performance, and compatibility up to a point where I'm comfortable with them - Now I can start in on the fun stuff!

The first thing I've started tackling is inventory. The "Hold interface" block searches behind it for a contiguous, square space. Once it finds one, it figures out the side and defines it as part of the ship's inventory. The image you see above is that code functioning - I went ahead and filled the inventory space with wires, just for show.

The next steps are to hook this system up to the "destroy block" function, so that destroyed blocks are automatically stored in your spaceship. After that, I'll try to hook the inventory screen up to your ship, allowing you to place (or sell) blocks you've mined.

Basically, with a few more changes, we should be able to hunt through asteroids for rare platinum blocks sometime in the near future!


GeneralVonDoom - - 41 comments

Great work Dirkson, I look forward to the gameplay features in the future.

Reply Good karma Bad karma+3 votes
Insolent. - - 669 comments

This is super exciting!

Reply Good karma Bad karma+2 votes
explorer13 - - 238 comments

A bit of a bump on an old post but does the cargo space detection work with plate blocks as the outside edges?

Reply Good karma Bad karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.