All Questions

Community

D
Xarcane

More comfortable way to make a maps in game

Hello, how to make a process of map creation easier? This what you show on the video is not comfortable at all, I mean if I want to make a bigger level I have to copy and copy again then drag everywhere coins to create a nice map, and the same story with every object. I know some people make custom level editors, but it would be not good solution for me to create an editor for every game I make, like I want to create a few android platformers and then do I have to create an editor for each of my game? Do you see any other solution? I was reading about TILED map importer but I totaly have problem with configuration in Godot 3 and I dont know how to use it.

  • Razoric replied

    If all of your platformer games are going to be very similar, you can load up the development time up front by developing a custom editor that you can re-use across similar games. Each game, if it has unique mechanics, can get an extension added to the editor, but everything else need only change the assets being used.

    Note that even if you use Tiled, you'll still need to do some manual work to convert the data from Tiled into something your game uses.

  • Nathan Lovato replied

    So, there are different ways to make level creation efficient without needing an external program or coding a completely custom level editor.

    The tricks you'll use will depend a lot on your current programming skills.

    You can mix the following approaches:

    • Groups nodes together to easily copy and paste them.
    • Create scenes to use as "prefabs", allowing you to design reusable template chunks.
    • Use code to generate bits of your level procedurally, like placing rows of coins.
    • Code small tools to enhance level editing in Godot (without coding a complete level editor).

    Grouping nodes together for copy and paste

    As our levels are tiny in the course, we just grouped all the coins together. But you can split coins, like, design a row of 5 coins and have them as a child of a Node2D. Below, I called it CoinLine.

    You can then duplicate this CoinLine to create new rows of 5 coins.

    Creating reusable scenes

    You can go further with this CoinLine. You want to reuse it across levels? Right-click -> Save Branch As Scene. This will save your setup as a reusable scene, the equivalent of what other engines call "prefabs."

    Then, you can drag and drop the CoinLine.tscn file onto any level to create a line of 5 coins.

    Using code to generate elements

    You don't have to code a whole random level generator to use procedural generation in your game. You can use code to place objects in patterns and save time.

    This is getting a bit beyond the scope of this course so I'll just explain the idea.

    This takes some experience to do efficiently, but for example, say you want to place coins in sine wave patterns. It'll be slow to do by hand in any level editor.

    So you can write code that'll do it for you:

    const CoinScene = preload("Coin.tscn")
    func _ready():
    var horizontal_spacing = 100.0
    var vertical_amplitude = 120.0
    for number in 10:
    var coin = CoinScene.instance()
    add_child(coin)
    coin.position = Vector2(
    number * horizontal_spacing,
    sin(number * PI / 8) * vertical_amplitude
    )

    Using Godot's tool mode, you can run that code in the editor (it'll take a little more work to make it work and update smoothly).

    Code small tools to enhance level editing

    Building upon the previous point, you can then go a step further by creating a plugin with an interface to save some extra time.

    It's up to you to figure out what is slowing you down creating game levels and how you can improve your efficiency. The good news is you can just add one or two features that cut on repetitive tasks.

    It does take some practice and requires some programming experience.

    But it's really far from the work involved creating a complete level editor from scratch.

    I hope this helps!