Blog

Making a Game. Part 7: Enriching the Game World

2015-01-23

We continue our gamedev series about the adventures of Pyatigor! (Yes, this is how we decided to name our protagonist.) In this article, we'll explain how to create environment FX and other details which make the game world more diverse and dynamic.

Overall view of the game scene.

Environment FX

By running the game or just viewing the screenshot above, you can see new elements in the scene. Let's take a look at them one by one:

  • heat haze, that is optical distortion due to differences in air temperature,
  • smoking near the perimeter of the level,
  • lava flaming,
  • small rocks floating in lava,
  • smoking in the sky.

First of all, let's talk about heat haze, smoking and lava flaming. All these effects were created using dynamically updated materials.

Preparing the geometry for effects.

For the heat haze material, a solid encircling geometry in the form of a cylinder (1) was created around the islands. As a result, all objects behind this geometry will be distorted when viewing from the center.

For the smoking material, geometry around the islands was created as well, but with spaces (2).

Lava flaming geometry (3) is situated in places where other objects make contact with lava.

Heat Haze

This effect is based on the refraction effect coupled with UV animation of a normal map. Let's take a look at the material.

Heat haze material.

The normal map (1) is at the heart of this material and is used with different scaling twice. Thanks to a Time Blend4Web-specific node, which is being added to one of the UV channels (2), this texture glides through the material creating an illusion of rising heated air.

The normal map is passed to a Refraction node (3), which is yet another Blend4Web-specific node. Also, a mask is generated (4) to be passed into this Refraction node in order to specify in which places distortions will be observed, and in which places will not.

The Levels Of Quality nodes (5) situated before the final color and alpha, cause this material to disappear at low quality settings, where the refraction effect is not available.

Results of using a Refraction node with a mask.

See the above picture to see how it works. On the left the original red sphere is shown ("clean"), then the mask is pictured ("mask"), more to the right the normal map is shown ("normal") which glides through the UV. This will result in visible distortions ("refraction") of the sphere when observing it through the material.

Smoking Material

The material for smoking effect is made similar to the heat haze.

Smoking material.

It is based on the tile texture resembling smoke (1), which is passed to the alpha channel of the material. It moves along the UV coordinates under the influence of the Time node (2) and is combined with the vertex color with a different scale (3 and 4). This vertex color fades the material out on the edges of the geometry.

Alpha mask for the smoking material.

In the above picture you can see how it works. In this case, black color corresponds to fully transparent areas.

Lava Flaming

Lava flaming.

Lava flames are located near bunches of stones. Their geometry is constructed of groups of spreaded polygons, which are painted with a black and white vertex color mask, darker to the top.

Lava flaming material.

Again, this material uses the same UV animation principle. Moreover, it uses the same tile smoke texture (1). With a Time node it is being shifted through the UV in three different directions (2). The resulting color obtained from this shifting is combined with the vertex color, and then all this is used to generate the alpha mask (3). In addition, this texture is mixed a bit differently, painted with fire-like colors (4) and passed into the diffuse channel of the output.

Floating Stones

In order to add further details, I have also added small stones floating in lava.

Series of models for floating stones.

While the source .blend file only keeps five different stones, I managed to make seven variations by adding or excluding different stones from the groups. For optimization purposes, I re-used the island material for these stones.

If you launch the game, you may notice that these stones are slightly rocking. This effect was achieved using procedural vertex animation, namely Wind Bending, which is normally used for grass, bushes and so on. This animation can be enabled for objects under the Blend4Web panel.

Setting up wind bending.

In this particular case I only needed to tweak two parameters: Angle for max object inclination and Frequency, which is how fast the bending will happen.

Note

The wind bending effect is a simple and resource-conserving way to deform geometry compared with animation of any other types. Its settings are described in detail in the user manual.

Smoking in the Sky

New sky material.

If you stare at the sky, you may notice that it is now much more diverse because of smoking. I did that with dynamically updated material.

Sky material nodes.

Once again, I re-used the smoke texture (1) and made it shifting with a Time node (2). The important distinction from the above mentioned materials is that the texture is moving not through the UV coordinates but through global coordinates. The only thing left was to paint this texture with the right colors (3). It is also worth it to note the Levels Of Quality node which switches the material to a primitive two-color gradient at the low quality mode.

Note

The Levels Of Quality node allows to create parallel settings inside a single material for rendering at different quality modes.

Game screenshot depicting new FX.

Now the scene looks much more lively and detailed. However, the most interesting things are still ahead: I mean the gameplay elements for the player to interact with and for which this small virtual space was created. But about that you'll find in one of the following articles, don't miss it!

Launch the game!

The source files are included in the Blend4Web SDK.

Please leave your comments in this forum thread.

Changelog

[2015-01-23] Initial release.

Comments
13 sep. 2023 11:46
I think they're having a great time reading this post, and they might take a good site to find out more io games
20 sep. 2023 16:28
Professional trading for everyone. Investing in the future.Gateway to your financial freedom. Get involved today and conquer the markets with our services and solutions. Easy access to investment opportunities. It is never too late to start your journey into the world of crypto and secure a wealthy and sustainable future for yourself and your family. Our vision is that financial freedom is crucial and the access to investment opportunities should be unlimited. That is why we offer the easiest, fastest and most affordable way to start trading for a regular retail investor. Mayfaircapitalmarket.com
21 sep. 2023 15:14
It has fully emerged to crown Singapore's southern shores and undoubtedly placed her on the global map of residential landmarks. I still scored the more points than I ever have in a season for GS. I think you would be hard pressed to find somebody with the same consistency I have had over the years so I am happy with that. senior day care near me
22 sep. 2023 10:07
Best Escorts in Lajpat nagar Are Available 24 hours a day for both incall/outcall services. Local escorts are Really Hot to handle. Models Lajpat nagar Escort Book Now From Lajpat nagar Escorts Agency.

Lajpat nagar Escorts | Lajpat nagar Escort Service | Escorts In Lajpat nagar |
20 nov. 2023 10:06
Great update on enriching the game world! The addition of environment FX like heat haze, smoking, lava flaming, and floating stones adds a dynamic and immersive feel. The detailed explanation of the materials and their use in creating these effects is very insightful. Looking forward to the next articles on gameplay elements. Keep up the good work!
spelling bee hinter
21 dec. 2023 13:33
anitaku is a completely free streaming site for users to watch or download anime in HD quality with English subtitles or dubbing
15 jan. 2024 09:37
The newest anime films are available to stream online on wcostream, complete with dubbing and English subtitles. WCOstream offers free online streaming of the greatest anime.
19 feb. 2024 15:10
ทุกวันนี้ คนทั่วโลกนิยมเลี้ยงไก่เป็นอาหาร จนจำนวนไก่ในโลกมีมากกว่าสุนัข แมว วัว และหมู รวมกัน ทุกปีเรากินเนื้อไก่ประมาณ 100 ล้านตัน และบริโภคไข่ ประมาณ 1 ล้านล้านฟอง ความนิยมในการเลี้ยงเกิดขึ้นหลังสงครามโลกครั้งที่สอง ไก่จ๋า เมื่อเกษตรกรได้พบวิธีเลี้ยงไก่เพื่อกินเนื้อในเวลารวดเร็ว โดยเอาอาหารที่มีคุณภาพให้มันกิน เพื่อให้เติบโตเร็ว และให้เนื้อที่อ่อนนุ่ม แม้แต่ในจีน ซึ่งผู้คนนิยมบริโภคเนื้อหมู แต่เนื้อไก่ก็กำลังเป็นที่นิยมมากขึ้นตลอดเวลา ส่วนคนเม็กซิกันกินไข่คนละประมาณปีละ 330 ฟอง เมื่อ 10 ปีก่อนที่เกิดวิกฤตการณ์ไข้หวัดนก ไก่จำนวนมากถูกฆ่า ชาวเม็กซิกันก็ได้ออกมาประท้วง เพราะค่าครองชีพสูงขึ้นมาก ส่วนในอิหร่านเวลาราคาเนื้อไก่มีราคาแพง ทางการจะห้ามไม่ให้บริษัทโทรทัศน์ถ่ายทอดรายการที่มีคนกินไก่

Today, people all over the world like to raise chickens for food. Until the number of chickens in the world is more than dogs, cats, cows and pigs combined. Every year we eat about 100 million tons of chicken meat and consume about 1 trillion eggs. The popularity of raising them came after World War II. When farmers found a way to raise chickens to eat meat quickly By giving him quality food to eat. to grow fast and provides soft meat, even in China where people like to consume pork But chicken is becoming more popular all the time. As for Mexican people, each person ate approximately 330 eggs per year, 10 years before the bird flu crisis. Many chickens were killed. Mexicans also protested. Because the cost of living has increased a lot.
Please register or log in to leave a reply.