Wednesday, August 24, 2016

Chunk height interpolation with multiple biomes



Hey! As the title suggests, this post describes inner workings of algorithm that we have developed to interpolate heights between chunks in our game called „TheTravelerGame“. First of all, quick introduction into the problem we‘ve been facing: in our game we have several types of biomes, each with their own minimum and maximum heights, and the heights are generated using bare Perlin Noise. Here comes the fun part: an efficient algorithm was needed which could interpolate between those chunks (otherwise players could get stuck in one chunk - not a death trap I would like to get into; it also would look pretty weird).


On a picture above you can see result of our algorithm: the average height of forest is much lower than one of a snowy biome, and they are nicely interpolated.
In short, the height of a block is determined by chunks this block is close to. So, for example if the block is in the upper left corner of the chunk, only upper left, left, upper neighbouring chunks and the main one are included in the weights of that block. Here is an example:

More about weights: each time we generate a block, we look at what the height of that block would be in each of aforementioned chunks. Then, we sum up the parts of each chunks generated height to form the finished height of a block. Pseudocode (where pos is block’s position in main chunk):

For Each chunk in includedChunks:
    sum += height(chunk, pos) * weight(chunk, pos) / sumOfWeights(chunk, pos)

Also, you may find quite interesting how we generate the weight for a block. Because linear interpolation is not entirely suitable for our needs, each weight is determined by this formula:

weight = (chunkSize – manhattanDistance(pos, chunk.middlePos)) ^ 4

Obviously, there are some caveats in using it, like strange blocks near the chunks middle (only noticeable when difference between heights is substantial).


That’s all guys! If you have something interesting to say (or maybe even know a better algorithm than ours for this) please do not hesitate to comment.

Tuesday, August 23, 2016

Progress report: weeks 9 and 10

Shadows
Now trees, buildings and other structures can cast shadows.

New items to equip
We've added several items, like full leather armor and some weapons for your everyday killing needs.

Mushrooms
Added several types of mushroom to the world.

Player character resources
Now you can see your health, mana, stamina, experience and level all in one place.

Enemy skeletons
...with animations and scripted AI behavior. You can even kill them and get experience!


More options for character customization
New haircut, beards and mustache. Be fancy like never before!


Procedurally generated villages
A settlement where you will be able to trade or get quests.



Our first dungeon
A procedurally generated Necropolis, which will be inhabited by various undead creatures and will contain tons of loot.


Other changes
  • Multiple bug fixes
  • Lots of work on multiplayer
  • A new biome that we will show you later.
Also, we've recorded a short multiplayer video:


Don't miss any further updates

Monday, August 8, 2016

Progress report: weeks 7 and 8

Hello folks. Two more weeks have passed and our game has quite improved since last update. Lets take a look at what we've been working on!

Inventory system

 You can now acquire items, drag&drop them in your inventory and even equip some of them!



 Swimming animations


Rewritten npc system
While there is no significant changes in npc behavior in game, we designed a flexible and efficient NPC architecture that allows us to create various behavior for mobs in the future.

We made a nice ogre model that we will add to the game in a few days.


 Lots of multiplayer improvements
Before, we had many issues with multiplayer, but now most of them are fixed. We plan to make a multiplayer gameplay video in the future :)


 Terrain randomization improvements
New object placement algorithm, random trees rotation and a new campfire model make game world look even more beautiful!


Sea biome


Over 20 equippable items
All of them will be available in the game soon.


Conclusion
To sum up, these two weeks brought some really nice features.
If you liked our game and would like to support us, just share this blog with your friends! Also, follow us on Twitter or leave your comments in the section below. Good luck!