I’ve been feeling experimental lately, here are my findings:

Finite Water

I tried implementing finite water based on an old plan I had where water would only spread sideways if the entire layer below it was a solid lake.
That is, if the layer below was still spreading sideways, it wouldn’t spread.

In controlled tests, this made really nice waterfalls that slowly filled up pools from the bottom up. I really got my hopes up and prepared to record a nice video for you guys, then I tried placing water just anywhere..

And in UNCONTROLLED tests, this was just horrible. Water spread out over the surface I placed it and gooped down the sides, like some kind of horrible blob, consuming the landscape in a one tile thick layer of light blocking slime. It didn’t feel like water, and quite frankly it scared me a bit. It was.. disturbing.

But as a side effect of this experiment, the sides of water tiles are now animated like water falls.

Conclusion: Back to the drawing board.

Player shadows

I added simple round shadows under player models. The closer you are to the ground, the darker they are, and they don’t hover out over the edges of tiles.
It does cost some cpu power to do the calculations, so it’ll probably be an option, and it will only be visible for nearby players, but it really adds a lot of depth to the scene.

Here’s a screenshot with an unrelated MD3 model running:


Conclusion: This was a trumph!

Light sources and darker caves

I’m pretty sure this is going to work, but it’s terribly complicated. I’ve implemented a per-block light value and is working on having tiles be able to emit light. At the very most basic level, I CAN make single tiles lit up if they’re set at lit, much like how lava works now. But it’s also fairly trivial to propagate lighting information.

I’ve experimented some with this before. If a tile gets set at “lit at level 10”, all tiles next to it who are lit to less than 9 gets set to 9, which in turn causes them to set all surrounding tiles to 8 and so on. Note that the effect only spreads if it actually CHANGES a value. Light won’t spread through light blocking blocks (that’s most of them), but it will curve around corners. While that isn’t realistic, I think it’s an acceptable trade-off between speed and niceness. It also somewhat fakes ambient lighting reflected off the sides.

Lava would cast light, so would sunlight, and torches, and.. well.. we’ll see what else. This makes deep caves really dark, but there’s still a problem with the fog being white. You end up seeing everything anyway since the cave goes black but the further away something is, the whiter it is. Finding out what color the fog should be on a per tile basis is VERY complicated and can’t be done, unfortunately.

Conclusion: I’m making a note here.

Wall-hack protection

Well, this is just easy when you know how. A player needs two blocks to be able to move. Thankfully, this includes the half block tiles. You can’t squeeze into the area of 1.5 blocks there, but there ALWAYS has to be two blocks vertically next to each other for you to be able to move there.

For the player to be able to move from one of these “two block hole” to another, the other one has to be right next to the first one, either to the north, west, east, south, up or down.

Finding if a player is currently inside a “two block hole” is trivial. Finding if a realistically short path of “two block holes” exists from their last position to the new position is also trivial.
If either of those two ever are false (ie he’s inside a block, or he traveled through a block), just teleport him back to his last known safe position.
(If someone has placed a block in his last known safe position.. well.. I don’t really know. :D)

In practice, because of latency issues, this means that you will get teleported back sometimes if you run past someone who managed to place a tile in front of you. But it’s better than wall hacking.

Conclusion: Huge success!

posted 13 years ago