DevLog #2: Tile manipulation and 3D demo
Hi everyone and welcome back to another dev log. Since last log, I was working on adding Tile placing and breaking, which helped give a good perspective on the demo itself: 2D is hard for 3D coordinates! As such, I decided to write the entire frontend in 3D for a demo and see how this worked out, which is to say actually really well. Keep reading for more in depth findings, but the TL;DR is that I think I am going to go with 3D from now on instead, even if this isn't very novel of an idea, because to me fun is really the most important aspect, and it just wasn't very fun trying to figure out how your character and tiles were placed in the 2D map with such complex manipulation.
Tile Manipulation
When I talk about Tile Manipulation, I mean being able to place and break blocks. To do this, I had to implement a small amount of UI as well, so that you can choose between the 3 blocks in the game currently for placement. I also implemented a range for tiles to be placed (currently at 5), as well as variable speed of breaking tiles based upon what type of material it is. Lastly, I also setup the framework for remapping keybinds, but I have not created any UI to actually do this as of now, so you just manipulate localStorage to set keybinds for now to anything other that defaults.
Here is a demo video I did with this all in mind:
As you can see, I was able to use some keys to overcome placement issues, like how do you place to the north of any block, or east/west, with a fixed camera angle. However, even with overcoming these issues, the problems still persist in visualizing the world itself, especially with depth. It is really hard to tell how far up tiles are in relation to you, and what you can and cannot place on. The general feeling of discomfort trying to play this without having some sort of 3D visualization was what led me to try a demo in 3D. I know other games that have a 2D but with 3D terrain that make visualization easier, which I could have done, but I just felt like trying out 3D fully as voxels instead.
3D demo
So I decided on a 3D demo, and honestly it is great! I branched my code, and started rewriting the frontend code pieces at a time until everything was rewritten in ThreeJS. I started the process on April 24th, so the fact that I implemented all functionality in just 14 days is incredible. The main things that are different is the extra keys that you see in the 2D tile manipulation demo for placing tiles in different orientations, as it is not needed, and the shader for things 'in front of you', as it wasn't really necessary for such a demo. There are some minor issues as you'll see in the video like some stuttering when moving the player and camera, first person still being able to see parts of the player when looking up/down, camera cutting into and xraying in tiles, and not auto-adjusting to not clip into walls. All of these can be addressed and I did not feel like they were necessary to address for this demo (or even any time soon really).
One thing I was incredibly impressed with is the absolute performance of the game. There is a certain feature in the game, where I keep track of the lowest point in the world (updated when a block is added or broken at the bottom of the world), and only respawn the player when they are 16 blocks below that point. Although this demo doesn't show this, as I only recorded the first 10 minutes of footage, we continued to play for another 15 minutes with a minigame where we kept falling and trying to rapidly place blocks at the bottom of the world to extend how far we could fall. This ended up being so long by the end that it took 2 minutes to fall to the bottom! During all of this, there were no crashes, and no inherent lag outside of my own network to my 2 friends, with easily thousands to possibly tens of thousands of tiles, all rendered with a naive approach to voxels. I was very impressed with how strong the system held up.
UPDATE: I realize I did not talk about my next plans! I like to have demos due at the end of the month, and work on the actual feature set during that month. This one I got the 3D demo done way earlier than expected, so I'll be working on bugfixes in May, with the next demo not being planned for being finished until end of June, so expect the next dev log probably early July. If I have something substantial before then that I'm willing to write about, I'll make a post.
Currently, the demo is for actual UI elements, like an actual inventory of blocks, equipped items, etc, but I don't know if that is what I'll end up working on. I'll be deciding closer to June after fixing a bunch of backlog items.
Shattered Lands
Survival crafting game that you can host for play in the browser with your friends
Status | Prototype |
Author | jollychristopher |
Genre | Survival |
Languages | English |
More posts
- First Tech Demo: Shattered LandsApr 06, 2024
Leave a comment
Log in with itch.io to leave a comment.