I've got a puzzle for you

Me and some school friends are making a puzzle game based on lining up pieces on a grid. The grid is 7x6 squares so we have 42 squares on the grid. I got it working buy making 42 invisble buttons on my blueprint that when I click on one, my piece is relocated to that grid point with the proper rotation.

The problem is, that with more pieces being added, it becomes pretty tedious to link them to the 42 squares with their own unique tweaks. Does anyone have an ideal on how this could be done in a simpler way, without 42 buttons?

Here’s more details on how I set it up;
Each square button (42 in total) is made into a OnClicked Event and is connected to a Sequence node which is then sent to each piece. So if I have 6 pieces in my level, each OnClicked Event is sent 6 times. Its pretty tedious work, specially when something goes awry.

Any help is appreciated and thank you!

It makes it easier to help if you post a screenshot of your BP. Also mention where the nodes are placed. For example the pawn or a new custom BP and so forth. For a tile based game I’m currently working on, I have the tile as its own blueprint that’s then spawned multiple times into the level by the pawn. The pawn class then keeps track of which tiles I’ve clicked on. Depending on variable in the tile BP it determines what the tile does and I use the pawn class to communicate to each tile BP if something needs changing using BPI’s.

Here’s a few screenshots that may help you. In my game the Tile BP is spawned about 50 times and all move and change independently depending on what my pawn says. BPI’s are you friend here as they’ll allow you to trigger events inside your tiles when your pawn says so. :slight_smile: Hope this helps.

Oh man Tile ID seems to be what I was looking for. Here I’ve attached two pictures to help illustrate my dilemma. As you can see, its pretty huge for what it is and although it works, I’m thinking your suggestion would work and be way less of a chore. I’m not very experienced at this and I don’t have any direct help, so I try to solve my problems as best I can, which sometimes results with these way too elaborate blueprints.

Also, you can see that I’ve created my game inside 1 blueprint like you mentioned, but that I used Actor class, in retrospec I guess Pawn class would be better? I’m not entirely sure on how this has an impact on my BP. at any rate I could just copy paste to a new BP class right?

And thanks for your help, it is much appreciated!

What you need to do is make one blueprint that represents just one tile. You then use another class (I used my pawn) to spawn that BP in multiple times and keep track of it. You can then get the class that spawned all the tiles in to position them into a grid. If I get round to it I’ll try make a tutorial on how you would go about doing something like this.

I’ll be looking forward for this Tutorial. In the meantime I will try working in the direction that you’ve directed me in. I thank you again!

EDIT: So thanks to your tip I was able create a new BP which I had my single tile inside. I then called a reference variable and used get to get my variables from my other BP. Anyways basically this will go a lot faster now! 42 times faster to be sure :slight_smile:

I made a tile blueprint that supports OnClicked. When the click event is received I then in turn fire off a custom event that my PlayerController handles. The custom event passes in the tile index that was clicked on. I also have a Board blueprint that generates all of the tiles and keeps track of them in an array. When the board generates the tiles it assigns the tile an index so when the tile is clicked on it knows what “int” to pass through the custom event. I can also try and show a demo of this if I can get my project to stop crashing =)

I recently made a ‘Puzzle’ template that will go out in 4.3. I made a Tile BP and a Board BP which spawns them in the right places. Each Tile has a pointer back to the Board that spawned it, so it can tell the Board whenever it gets clicked.

Just curious....what will be the next template after puzzle ? RPG? MOBA?

Probably RTS, though it will be quite similar to Top Down. MOBA seems like it would already be covered by Top Down, what else would you expect to see? I’d like to try a ‘twin stick shooter’ and a ‘turn based strategy’ template at some point as well.

‘RPG’ actually seems way too big for a Template, as it can cover a lot of different styles (FF7 vs Skyrim!) and can contain so many different systems (inventory, UI, character customization, melee, skills/abilities, AI, save games). We see there is a lot of interest in learning how one might build an RPG in UE4, and we are having discussions about how we can best help with that!

Hi. Thanks for your fast repply. Glad to see you are interested in helping the community on building RPGs. 

It’s true that a lot of people are trying or thinking on building RPGs, altough this is quite a demanding task . You are right about RPG template. It would be too complicated, and even more, it’s not very specific. However, I have a suggestion: a Hack n’ Slash template. It does not have the RPGs more complicated things like inventory, skill stats, item drops etc. Just a skillbar and lifebar as UI. Think about Darksiders,
Castelvania or God of War. A Skirim-like game, without RPG elements would be something great as a base or for studying GUI, behaviour trees (enemies) and other mechanics we find in this type of games. Of course, a developper starting from this template could add himself RPG elements, but this depends from case to case. What do you think?