Buildable Grids

So I am hoping to develop a 2d top-down game, sort of like Prison Architect, where the player can build structures on a grid like system. My question is, how is that achievable for a newbie like me? I have nothing done so far, because I have no idea how to begin. Any help would be appreciated!

If you haven’t done anything yet, it is much better to start with the tutorials and make your way through them. Starting out with a new engine by making a full-blown game is generally going to be very challenging, especially since any questions you have will likely not be answerable in a better way than, well, this answer, without actually making the game for you (which I am sure you don’t actually want!), since your question is very broad! There are thousands and thousands of ways to design 2d top-down builders, and thousands of thousands more ways to implement each of those ways.

So - make your way through the tutorials, learn the engine, make barebones examples, and if they don’t work, you will be able to ask more specific questions, such as “why is my character not moving when I have [code] in its script file?”. That way, you can learn how the engine works, and simultaneously take the time to find general ways (i.e. ways independent of the engine) to design the game, and then look in the forums or the manuals for inspirations for how to actually implement these designs in Defold!

In summary - start with the tutorials, and then make your way through those. After that, you’ll start seeing/googling ways of designing your game, at which point you can either ask for help or know enough of the engine to do it yourself. Good luck! :smile:

5 Likes

Thanks for your advice! And I’ve actually built a few games thus far, though none like the one I am currently working on now. I just couldn’t find a tutorial that explains in-depth a similar mechanic being explained here. I was hoping for a dumb-downed “tutorial” for a newbie like me.

Nonetheless, thank you for your advice and I will surely learn to better my skills!

1 Like

Once you get through the basics I promise the community here can guide you however much we can through the rest of the features you will need to make a 2d tile based game sim of whatever kind you’re looking for.

If you can write a short list of the kind of features you are hoping to build. That can give people an idea of what to suggest for you to focus on as you gain more experience with Defold.

4 Likes

Well, for my game, I’m hoping of implementing a structure/building mechanic, such as building walls, doors, etc., that will take up a single grid/tile. So conceptually, I would have the player click a building button, which will take them to “build mode,” which from there, allows them to construct things.

My main concerns are creating grid for the terrain/structures that the AI can pathfind around. Again, the forum post I linked above is sort of what I’m looking towards, however I perhaps may need some more handholding. I’m sorry for the inconvenience, guys. );

1 Like

What you are asking it not an inconvenience for us! Most of it is, however, very general to any game engine, and not just specific to Defold.

For pathfinding, you’ll be wanting to look at the classic Introduction to A*.

Going into “build mode” can be as simple as a flag that is toggled off and on, changing the look of the grid (potentially) and unlocking the option to build.

For implementing grids, or tilemaps, you’ll be wanting to look at the Defold manual entry for tilemaps. There’s also an RPG-style project (or several) in the engine that shows an example implementation of it that you can find in the menu when starting Defold.

It’s hard to be more specific than this, especially since you haven’t given much more than “placing buildings on a grid”. How should the interface look like? Do you want the buildings to be placed immediately, or built up by workers? How should these workers’ thinking processes look like (in words, not code)? All these things, and a hundred more, should* go into your Design Document, after which is written you can start thinking of how to implement them in Defold specifically! :smile:

*There is no right way of making a game, but this really does help!

6 Likes

Thank you so much for the help! I suppose I should get started with this before I move on. It’s good to know the resources to begin with, so thank you, very much!

2 Likes

I remember now that I created the first part of an RTS style game using the WarBattles asset pack. It could perhaps give you some ideas of how to handle different states, such as placement and construction (you’d obviously limit placement to a fixed grid in your game though). It’s here: https://github.com/britzl/warbattles-rts

4 Likes

Thank you, so much. I’ll check it out!