DarkViGaCi's Forum Posts

  • Today, I'll show you an extremely simple way to build an unlimited number of levels for you platformer game. So, one of possible way to create level generator is to make several smalls scenes that will be combined into the main level.

    For this template I took the graphics and trap mechanics from the Construct 3 Example Browser.

    How its works

    Layout "Presets". Has several layers, each of which is a small scene containing a tilemap and objects (coins, enemies, traps, etc.).

    Family "Objects". Includes all the objects placed in Layout "Presets". The family is necessary to reduce the number of events and simplify working with objects.

    Dictionary object. On start of layout "Presets", all objects are added to the Dictionary. The name of each key is "object name & layout name & object IID". The content of each key is the objects JSON.

    Layout "Main" is an empty level. When this layout starts, the level is build by a loop and random preset selection. The object data (JSON with position, variables and everything else) is taken from the Dictionary. The coordinate of each object gets additional adjustment using "curX" variable, which means X-offset for current scene.

    Try this on Arcade

    Download template

    Please, upvote this post if you like this. I have a few more ideas for developing this template, but I would like to know if anyone is interested and if you want to see more my templates.

    Tagged:

  • Could this kind of method be adapted to squares rather than hexes?

    If you are using a square grid, then it will be easier for you to using a tilemap, instead of sprites (as in the case of a hex grid).

  • The best way to optimize memory is to animate sprites using Construct 3 tools. Use the Timelines, Mesh deformation and "Tween" behavior wherever possible. If you want more specific advice, take a few screenshots and show how your graphics looks.

  • Do you think there is any way this would work with moving objects that take up multiple hexes such as large enemies or characters?

    It all depends on how many hexes the large units occupy: 2 hexes or 3, or more. It may be necessary to add a function that will filter the hexes through which large units can or cannot pass.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I have a paid template, check it out (click Demo C):

    https://www.construct.net/en/free-online-games/random-level-generator-25484/play

    Please be aware that the dungeon layout is fixed (the number of rooms, their locations and entrances). Only the rooms are randomized.

    I have few ideas. I just want to know if my thoughts align with what you did. Did you stored JSON's of each objects on Layout in Dictionary and recreate in runtime?

  • How I can make level like this:

    I tried to use mesh deformation

    https://www.dropbox.com/scl/fi/o156htkng7vacwkjs1b0y/Mesh.c3p

    The main difficulty is in making smooth transitions. O know about "lerp" expression, but I don't know how to apply this. Does anyone have any ideas how to create a level like on the first picture?

  • It doesn't matter, but the topology of the map you created with this wrap-around in x and y is a torus, not a sphere. In a sphere if you move north from any point you will come to the same point sooner or later (the north pole).

    You're very welcome for the explanation! My understanding of geometry is quite basic.

    I would like to see rivers as hex-side terrain. These hex-sides could also be walls or doors in a dungeon setting.

    Do you mean something like that?

  • UPDATE

    Added the mechanics of infinity map panning, similar to the game Civilization. Imagine your map as a planet. As we know, planets have a spherical shape. You can continuously move in any direction and never reach the edge of map.

    How it works:

    • I do not use "scroll to" action for movement. Instead, I move the objects themselves.
    • When the objects go beyond the screen, I move them to new position.

    A more complex task is to adapt the pathfinding to an infinity map. The cells of the array can't be moved as easily as the hex sprites. It would have been an unnecessary complication. So, I came up with simpler solution. Now, the starting position for pathfinding is always at the center of the array.

    When a player clicks on a unit, the hexes adjust their virtual coordinates (instance variables) as if the unit were in the center of the map. Thank to this approach, I didn't have to make significant changes to the pathfinding (which is based on 2D array).

    Try on Arcade

    Download template

  • I thank all of you for the feedback! I've been studying Construct 2/3 for over 6 years. Very often I heard the opinion that this engine is only good for casual games and is not suitable for anything more. My goal is to break this stereotype. So I will continue working on the template. Also, I promise that this template will be free of charge always.

  • I am very inspired by the fact that the post above has received so many likes. So I decided to continue developing this template and add new mechanics to it.

    So, let's say we want to create a turn-based game. Let's add numerical a variable "MP" (movement points) to the unit and set its value to 3. This way, the unit can move 3 hexes in one turn.

    Now let's add new types of hexes: forest and mountains. Let's make it so that a unit can move through all hexes, but each hex will have a different movement cost. For example, the "forest" hexes has a cost of 4 points, the "mountain" costs 6 points, and the regular hexes costs 3 points. Also, we'll set the unit's movement points to 9. And the "water" hexes will remain impassable for the unit.

    Now let's add a line to indicate the movement boundary for the unit. It's very simple to do this. We need to check the values of neighboring cells in the array, and if the value of a neighboring cell is greater then the unit's movement points, then we set a boundary line between two hexes.

    Like this post if you like my template. Perhaps I will continue to develop this example and add new mechanics to it ;)

    Try on Arcade

    Download this template

  • After looking more closely I was wondering how you could assign a movement cost to each hex? Like swamp takes two counts of move vs one for open areas.

    It is a very good start.

    yours

    winkr7

    I have implemented this mechanics in another turn-based example (sorry for bad English there). But in that case, I use a square grid of tiles. So, I will update hex-grid template to add movement cost mechanics in few days :)

  • I've created the template with a hex pathfinding algorithm. It's based on 2D Array object. I don't use any additional plugin and behavior (except "MoveTo").

    HOW IT WORKS

    1. At the beginning, an array is filled with numbers using the "Wave Algorithm" method. This means propagating "waves" around neighboring tiles until the destination point is reached.
    2. Then, a revers path is found using a simple subtruction of the index from the current value through a loop.

    Basically I used a wave algorithm to fill the array. The main feature is how to determinate neighboring hexes:

    Try this on Arcade

    Download template

    Tagged:

  • Added some minor improvements to the logic of group movements for units. Just one condition "For each (ordered)" and one action which start the "wait" timer makes units movement more natural.

    BEFORE

    AFTER

  • Another way to make switch languages system

    It's works with only 2 events

    Download Example (*.c3p)

  • Do it this way