TUXDB - LINUX GAMING AGGREGATE
by NuSuey
NEWSFEED
▪️ GAMES
▪️ STEAM DECK ▪️ DEALS ▪️ CROWDFUNDING ▪️ COMMUNITY
tuxdb.com logo
Support tuxDB on Patreon
Currently supported by 8 awesome people!

🌟 Special thanks to our amazing supporters:


✨ $10 Tier: [Geeks Love Detail]
🌈 $5 Tier: [Arch Toasty][Benedikt][David Martínez Martí]


Wave Function Collapse

Long introduction.


In our last game, The Unexpected Quest, level development took about three months, including design and cinematics. Now we are making a tactical strategy game called Eternal Mist and we have over 100 levels planned for it. Naturally they will be much smaller and simpler, but even spending a few days on one level will take a long time to develop. "Better to lose a day, then to fly in five minutes!" we decided and set to work on automatic level generation. We ended up with this: [previewyoutube=Ff0tXzaMpvU;full][/previewyoutube] I want to point out right away that we don't plan to dynamically generate levels in the game itself. Therefore, on the one hand it became easier: there are less demands on stability of algorithms (in case of error or unsatisfactory result you can always generate the level again) and their performance. On the other hand, additional tools for the developer: debugging and visualization of bad moments, UI for the editor, etc. Right now, the process of working on the level looks like this: [previewyoutube=MU-0c_02fxU;full][/previewyoutube] From the title of the article, it is clear that after exploring the possible options we settled on the Wave Function Collapse algorithm. It is quite simple to implement and still can produce very interesting combinations. Moreover, the game we were inspired by Bad North: Jotunn Edition, also used this algorithm for generating levels. At the end of the article I added a link to a lecture by its creator about the WFC algorithm. I'm not going to go into details of the algorithm itself, as there is a lot of material on the web on this topic. I will add some useful links at the end of this article. Just to remind you of the basic principle:
  • a level is built from tiles,
  • each tile is a visual representation and a list of possible neighbors for each side,
  • the whole field is divided into slots, and at the beginning of work, each slot is filled with all possible tiles,
  • at each step, one slot with the lowest entropy is chosen (simplistically, with the smaller number of tiles inside) and "collapsed" to a single tile,
  • from the remaining slots, the tiles that cannot be adjacent to the collapsed slot or its neighbors are removed (the "wave"),
  • the algorithm is repeated until all slots have collapsed or an error occurs.

Implementation features


The usual list of neighboring tiles is not enough to determine which tile may be nearby. Simply because as the number of tiles grows, these lists will also grow. And very quickly and confusingly. So instead of storing tiles, we store edges. This list is much smaller and easier to keep track of. Since the tiles can rotate, we still need to develop an agreement to dock the edges. In the video below (time-linked link), everything is explained in detail and we did the same: [previewyoutube=2SuvO4Gi7uY;full][/previewyoutube] In addition to the "white lists" of allowed tiles (the edges lists discussed above), it is highly recommended to have a "black list" of forbidden tiles. Already without the indication of edges. But simply as follows: on this side of the tile so-and-so cannot join. For example, in terms of joining edges, the example below is acceptable, but visually it looks unnatural.
It is highly recommended to make at least some kind of dump of already registered edges and in which tiles they are used. The visual format is ideal, but even the text format will be very useful in the later stages of development. The top flight, to think through the system of edges so that they can be generated automatically, we, unfortunately, have not reached this level. It looks like this:
One more important point about edges and tiles. The success of the WFC algorithm and the realism of the generated levels largely depends on how you implement the tiles and how you dock them. It took us about three tries to find the right fit. Our main mistake was trying hard to reduce the number of possible edge types, which resulted in a small number of variations for the algorithm and consequently ugly and unrealistic results. At first, it's best to start with a set of tiles from some examples where you like the results. Performance. The algorithm is slow, with increasing the number of tiles, running time increases significantly, and you have to think about optimization right away. We have thought about it right away, cached something and didn't get there at all... So my advice is: you should optimize the thin places of your algorithm at the development stage, you most likely don't know about them. In our case UE4 internal profiler helped us and studied all suspicious places (everything that is called in loops). We put WFC_SCOPE_CYCLE_COUNTER around and around, and then checked what most of it costs us time. But we should definitely pay attention to handling lists of edges and tiles: merging, crossing and checking if one list contains another. This will be called a lot and often. Error debugging. Finding a set of tiles where the algorithm can always generate a level is very difficult. For a large set of tiles, it's unrealistic. Therefore, at the stage of development, it is extremely important to understand why the level was unable to be generated and what combination of tiles led to the error. We have it like this:
The red sphere indicates a slot that has no tiles left and can't "collapse". This is most often caused by not having enough tiles to connect nearby slots. Which slots need to be connected is shown in the log below. In addition to this, the log displays the iteration number at which the error occurred. And for detailed debugging, we made it possible to stop the algorithm not only at any moment of iteration, but also at any step of the wave, i.e., when all adjacent slots update the lists of possible edges. This is the panel on the right. Without this kind of functionality, it would be extremely difficult to pick up a working set of tiles, and we recommend that you worry about it right away. If you are planning a game with automatic level generation, in case of error, it is necessary to rethink the system of level generation (it may take a long time) or a fallback system and continue level generation, but with new random numbers (this should work faster). Fortunately, it was not needed for our tasks.

Useful Links


[olist]
  • You should start with this video: https://youtu.be/2SuvO4Gi7uY
  • An excellent lecture by Oskar Stlberg about his game Bad North and his implementation of WFC: https://youtu.be/6JcFbivo8dQ
  • An article about generating infinite 3D levels with WFC: https://marian42.de/article/wfc/ And a link to Unity algorithm itself: https://github.com/marian42/wavefunctioncollapse
  • There are ready-made plugins for Unreal Engine, but I'm not sure about their quality: https://www.unrealengine.com/marketplace/en-US/product/easy-level-generator https://www.unrealengine.com/marketplace/en-US/product/procedural-environment-generator-wfc
  • There is also an experimental WFC plugin in Unreal Engine 5: UE5_FOLDER]\Engine\Plugins\Experimental\WaveFunctionCollapse Unfortunately, I couldn't find any documentation on it. [/olist]

    Thank you for your attention!


    We will be very pleased if you add our game to your wishlist and keep an eye on the project. We will be happy to answer your questions. We promise to write new articles, notes and post interesting materials about the game. https://store.steampowered.com/app/2102300/Eternal_Mist/ And we look forward to seeing you on our Reddit page. https://www.reddit.com/r/RionixGames/ Best wishes, Rionix team.


  • [ 2023-01-14 09:43:14 CET ] [ Original post ]



    Eternal Mist
    Rionix
  • Developer

  • Rionix
  • Publisher

  • Q1 2024
  • Release

  • Action Indie Strategy Casual RPG Adventure Simulation F2P Sports MMO Racing Singleplayer Multiplayer Coop EA
  • Tags

  • Game News Posts 17  
    🎹🖱️Keyboard + Mouse
    🕹️ Partial Controller Support
    🎮 Full Controller Support
  • Controls

  • No user reviews

    (0 reviews)


  • Review Score

  • https://rionix.com
  • Website

  • https://store.steampowered.com/app/2102300 
  • Steam Store

  • "I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones" - Albert Einstein.



    Several generations have passed since the end of the Great War, and even deep old men cannot remember who first used forbidden spells. But once begun, there was no stopping them, and the land was swallowed by the Mist.

    On the wreckage of the old world, a new world gradually emerged - divided into isolated islands and states. And only a few brave men dare to travel through the deadly expanse of mist. You are at the beginning of this journey, and where and how it will end depends only on you!



    Eternal Myst is a game that involves real-time tactics where you will be in charge of commanding different types of squads including swordsmen, rangers, and mages. Each squad possesses unique skills that can be improved as you progress in the game.

    Elements such as bonfires, cauldrons, and other objects on the battlefield have an impact on the abilities of your warriors. Placing your units near these objects can provide a significant tactical advantage.

    The Mist is a source from which hordes of creatures emerge. These formidable beings represent a relentless force that poses a significant threat to all who cross their path. Their agility and speed allow them to swiftly traverse the terrain, making them a daunting challenge to overcome. Only a skilled commander can give confident and well-thought-out orders to inspire their soldiers and guide them towards victory.
    MINIMAL SETUP
    • OS: SteamOS (64-bit) or Ubuntu 18.04 (64-bit)
    • Processor: Intel Core i3Memory: 4 GB RAM
    • Memory: 4 GB RAM
    • Graphics: GeForce GTX 750Ti (Vulkan support required)
    • Storage: 512 MB available space
    RECOMMENDED SETUP
    • OS: SteamOS (64-bit) or Ubuntu 18.04 (64-bit)
    • Processor: Intel Core i3Memory: 8 GB RAM
    • Memory: 8 GB RAM
    • Graphics: GeForce GTX 970 (Vulkan support required)
    • Storage: 512 MB available space
    GAMEBILLET

    [ 5949 ]

    3.25$ (75%)
    16.59$ (17%)
    4.12$ (17%)
    17.19$ (14%)
    33.59$ (16%)
    4.12$ (17%)
    4.95$ (17%)
    33.97$ (15%)
    11.25$ (55%)
    3.75$ (75%)
    9.89$ (34%)
    12.38$ (17%)
    24.87$ (17%)
    12.59$ (16%)
    48.95$ (18%)
    3.75$ (85%)
    10.78$ (17%)
    8.00$ (68%)
    16.00$ (60%)
    4.00$ (80%)
    9.19$ (8%)
    4.12$ (17%)
    6.01$ (14%)
    33.96$ (15%)
    10.00$ (50%)
    12.74$ (15%)
    32.79$ (18%)
    3.35$ (16%)
    3.75$ (75%)
    32.79$ (18%)
    GAMERSGATE

    [ 1903 ]

    1.84$ (74%)
    21.99$ (45%)
    1.58$ (77%)
    3.3$ (83%)
    7.87$ (47%)
    1.39$ (72%)
    8.8$ (65%)
    2.55$ (87%)
    1.88$ (92%)
    0.53$ (92%)
    3.4$ (83%)
    4.88$ (62%)
    1.84$ (74%)
    6.37$ (63%)
    2.25$ (85%)
    0.53$ (92%)
    5.63$ (81%)
    1.5$ (85%)
    0.38$ (92%)
    1.05$ (85%)
    0.68$ (92%)
    3.75$ (62%)
    0.53$ (92%)
    0.51$ (83%)
    1.31$ (81%)
    3.75$ (62%)
    0.85$ (83%)
    8.49$ (58%)
    5.06$ (66%)
    2.81$ (81%)

    FANATICAL BUNDLES

    Time left:

    3 days, 13 hours, 43 minutes


    Time left:

    26 days, 13 hours, 43 minutes


    Time left:

    8 days, 13 hours, 43 minutes


    Time left:

    39 days, 13 hours, 43 minutes


    Time left:

    45 days, 13 hours, 43 minutes


    HUMBLE BUNDLES

    Time left:

    6 days, 7 hours, 43 minutes


    Time left:

    6 days, 7 hours, 43 minutes


    Time left:

    15 days, 7 hours, 43 minutes

    by buying games/dlcs from affiliate links you are supporting tuxDB
    🔴 LIVE