Weekly devlog #5 - special blocks in new client


Finally another (not so) weekly devlog!

This week I have been working mostly on the new client/android version. I have also started working on the animations for the frog, but more about that hopefully next week. This devlog is more technical then some of the other ones, but I hope that it will be interesting for those who are also into game development (or just like learning a bit how games work).

What has changed
The core of the game was already working in the new client. Displaying blocks, basic physics, a chat, leaving and entering worlds. But that was basically it. What was missing is all of the special kind of blocks that I have added to the game in the last two years. So what I have been doing is adding all of those special blocks. This is a long list of changes, and I won't bore you by listing all of them. But for those who are interested I added a full list of changes I made to the new client at the end of this post. But now I will highlight some of the more interesting changes.


Reading sign
Being able to read what is written on signs is an interesting thing to implement. This is because it is kinda a combination between a user interface and an object that is in your world. The way I implemented it is that I have two objects (also called entities): one object that is spawned on top of the sign inside of the game world. And one ui object that handles actually displaying the text. Then I just have some code that synchronizes the position of that ui object to the position of the object in the game world. But when I had this implemented, I actually noticed that my game would crash if I am on the sign for only a single frame! This was actually not a bug from me but from the game engine. Because the game engine crashes if you despawn an ui object in the same frame it was created (or a frame later). This is just the kind of things that might pop up if you are using a relatively new game engine. But luckily the game engine is open source so I can just fix these kind of bugs myself: https://github.com/bevyengine/bevy/pull/13000


Smooth shadows
I have also been working on adding smooth shadows to the new client. But I knew I should probably do a different approach to the one I was doing previously. The way I implemented shadows previously is that I rendered all of the blocks and entities to one texture, then all of the shadows to another texture. And finally I combined those two textures and rendered it to the actual screen. The reason I was doing it like this is because I don't want the background to be affected by the shadows. This means I had two intermediate textures, just to draw shadows. I was guessing this is bad for performance, so I should probably do something else for the android version.

What I am doing now for the android version is that I just don't care that the background might be a bit darker because of shadows. This rarely happens anyways because blocks without a background give light. I implemented the shadows using a custom shader, this allowed me to save some memory. Because I can throw away some irrelevant information like which texture to use. Since shadows don't have any image attached to it. Its just a single color.


Mannequins
Mannequins are a very special type of block. These are the only blocks whose texture is made out of multiple sprites. (Technically a lot of blocks are made out of 4 sprites, but never more than that). Because of this it is quite complicated to render them with the rendering system I have for blocks. In the old client I just overwrote the blocks drawing function, but it isn't that simple this time. The solution I came up with is just to spawn some entities that are almost the exact same as regular players. And these entities are despawned whenever the block gets destroyed. This does cause mannequins to be a bit more laggy than other blocks. But as long as you don't have a world filled entirely with them it is fine.

First android version

After all of these changes I made this week the android version is almost ready to be tested! I am expecting to release it to the 4 android tester in the following week. But there are still a few small bugs I want to get rid of first. This first release doesn't have any inventory though, so you are just able to walk around and chat in worlds. All of the building, breaking and crafting stuff will be added later.

Full change log

  • Rendering text on signs/doors/mannequins
  • Showing chat bubble above players
  • Smooth shadows
  • Show which checkpoint is selected
  • Added respawn button
  • Spikes killing you
  • Spikes are connected to solid blocks
  • Lava killing you and giving you knockback
  • Ice is slippery
  • Slime slows you down
  • Springs bounce you up and play an animation
  • Black and white timer blocks only collide with the player when they are visisble
  • Player is able to use their hand by clicking on blocks (useful for doors and buttons)
  • Pressing buttons switch which button blocks are collidable
  • Drawing if a lamp is on or not
  • Mannequins render correctly
  • Playing a fire animation if a furnace is on
  • Sideways doors having collision on the top part
  • Made pressure plates functional
  • Unstable platforms disappear when you stand on them
  • Note blocks are bouncy (but don't make sound)
  • Blocks that are mirrored are rendered correctly (Like chairs, toilets, beds, pointing signs)

Get Crystal Realms

Leave a comment

Log in with itch.io to leave a comment.