Puzzle idea - it's realistic in rpg maker

rubininio

Veteran
Veteran
Joined
Jan 30, 2023
Messages
32
Reaction score
9
First Language
German
Primarily Uses
RMMZ
I have an idea to make a puzzle in my game, where the player must move and turn different puzzle tiles in the right place. The theme is to sew together different cloth parts to get a sweatshirt or a pants.

There is a given grid on the ground, where the player must fill in the puzzle tiles. The puzzle tiles are on the side and are not in necessarily orientation. Therefore the player have also to turn the puzzle in the right orientation and move it into the right place at the grid.
The puzzle tiles are more than one space big, sometimes they are like a T or a L.

It is possible to do a puzzle like this or it is impossible in RPG Maker? I saw a video about moving stones to a specific place, but they are always one space big and you haven't to turn them. ;)

My idea is, I think much more difficult.

How I can implement my idea?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
38,398
Reaction score
10,835
First Language
German
Primarily Uses
RMMV
It is possible - both with and without plugins. But it is not easy.

A specific puzzle plugin could handle everything as you described - but such a plugin would most likely have to be commissioned by you, and not everyone is willing to put money into their game.

Without a plugin there is one big limitation:
Each event has a single tile as an anchor even if the picture can be larger, and that anchor is always bottom-centered.
If using a larger sprite you would have to make a grid on where each event would have to go, and check that specific tile with a specific direction to declare a correct placement.
That is possible but more complex than simple rock to point checks
 

ZombieKidzRule

I know just enough to be dangerous!
Veteran
Joined
Jan 9, 2022
Messages
958
Reaction score
1,307
First Language
English
Primarily Uses
RMMZ
I knew someone like @Andar would be able to answer this better than I could so I waited. I was initially going to just say that it was possible, but I don't know how exactly.

While I still don't know how to do it, I did want to share a video that I watched recently from a creator called @mauvebutterfly who also appears to be on this forum.



They remade all these puzzles for MZ and the tutorials are on their YouTube page. I still need to go back to watch them because I really liked the video I posted above.

I thought the sliding picture puzzle sounds a little bit like what you were talking about. Not completely, but sort of so I thought I would share.

There are plenty of other videos and tutorials about there to watch on different kinds of puzzles. And maybe those will give you some ideas.

I would just search for RPG Maker MZ Puzzles or even just RPG Maker Puzzles because even videos for older engines might still be convertible to MZ.

Good luck!
 

ManaBrent

Veteran
Veteran
Joined
Apr 26, 2020
Messages
66
Reaction score
47
First Language
English
Primarily Uses
RMMV
How do you want the player to interact with the puzzle pieces specifically? Are we pushing them around directly like a boulder? Or do we use some mechanism to move them for us? Or something else?

I can picture pushing them around. I'll try and explain.

Below there is a puzzle piece on the side made of 3 events labelled A,B, and C.
The image is attached to A as a large sprite, B, and C are invisible events that move with the group.
The location marked (D) is not an event, it is where we need to move A to.1679015406855.png
The player can move the puzzle piece by pushing it, but if they push along the edges marked in red then it rotates the puzzle piece instead. (To do this with eventing we target A with Movement Route and turn 90 degrees either left or right, then to reposition B and C correctly we set variables to the X and Y coordinates of A, then add/subtract appropriately for whichever side they should be on (which we can determine using Conditional Branch checking which way event A is facing) and set event location B and C into place.)

For pushing the piece without rotating it we skip the rotation part above but still do the B and C repositioning part.

That's the movement handled, now we need to check if its in the right place for the puzzle.

Much simpler, all we need to do is check if A's x, and y coordinates match (D), and if the event if facing the right way for the puzzle to make sense.
 

mauvebutterfly

Veteran
Veteran
Joined
Jul 26, 2013
Messages
98
Reaction score
76
First Language
English
Primarily Uses
RMMZ
I really like @ManaBrent's implementation here. This is a pretty simple way to get a cool effect, and probably would work better than what I was thinking.

I would just brute-force the problem, similar to my "painting restoration puzzles" from the video linked by @ZombieKidzRule (which I'm planning to do a tutorial on and should release on my YouTube channel March 26th.)

To summarise the method though, I create a grid (5x5 in this case) and use variables to store the data in each grid cell. I then create a "cursor" that moves along the grid to let the player know which cell they are operating on. Finally, when the player inputs the assigned action button, something happens.

In the case of your sewing example, I'd probably have a menu pop up asking what action to take (slide, rotate, cancel) each with their own submenu (direction of movement vs direction of rotation). This should get the job done just using events, although a script or plugin might yield a more elegant solution.

Actually, thinking about this, I could probably event a minecraft-style crafting system if I wanted to. I think I'll be experimenting with this in the future. Not sure if I'll end up using it, but I think it would be interesting to mess around with. The main problem is that the menus and submenus might get clunky, but since MZ has mouse support there might be a way to make it tolerable.
 

rubininio

Veteran
Veteran
Joined
Jan 30, 2023
Messages
32
Reaction score
9
First Language
German
Primarily Uses
RMMZ
To summarise the method though, I create a grid (5x5 in this case) and use variables to store the data in each grid cell. I then create a "cursor" that moves along the grid to let the player know which cell they are operating on. Finally, when the player inputs the assigned action button, something happens.

In the case of your sewing example, I'd probably have a menu pop up asking what action to take (slide, rotate, cancel) each with their own submenu (direction of movement vs direction of rotation). This should get the job done just using events, although a script or plugin might yield a more elegant solution.
That would be awesome, to have a cursor to select the puzzle pieces and choose which action I want.
Better would be if I could fix a puzzle piece with the cursor and use buttons for the commands, like arrows for moving it around or space to turn it or a a drag and drop mechanic with the cursor. But that I think it‘s to complex.

The variant to use large sprites as puzzle pieces and the select them via cursor would also be cool after that you can move it and rotate it.

Wow its really exciting!
 

AmVa

Veteran
Veteran
Joined
Jul 6, 2022
Messages
92
Reaction score
21
First Language
English
Primarily Uses
RMMV
Better would be if I could fix a puzzle piece with the cursor and use buttons for the commands, like arrows for moving it around or space to turn it

This is possible without a plugin, but with script calls. You just need to store the event ID of the last piece you clicked on in a variable, and then have a separate event that will move or rotate it.
 

rubininio

Veteran
Veteran
Joined
Jan 30, 2023
Messages
32
Reaction score
9
First Language
German
Primarily Uses
RMMZ
Me again.

Now I made a large sprite and control it with one event. At the moment I use my player to command the puzzle tile. I can walk on the tile. When I'm on the event, the menu pop up asking, which direction I want to move. I can select and the large tile move in the chosen direction. That's perfect. But now, I want also rotate this tile i.e. 90° right. Now the large sprite should really rotate in the chosen orientation.
Above you wrote, that I have to connect invisible event to the main event, which set to a new location. But I think that doesn't work. Has anybody a hint, how I can move forward?

Here is the picture of the large sprite.

1679297140350.png

Here is the script:

1679297256844.png
 

ManaBrent

Veteran
Veteran
Joined
Apr 26, 2020
Messages
66
Reaction score
47
First Language
English
Primarily Uses
RMMV
If you're using a menu to move the puzzle piece then the invisible events are unnecessary, they were only there to push and rotate the piece if it had player collision.

To rotate the piece you can use the turn 90 degrees movement route, or if you want it to face the same direction as the player you can use a conditional branch to check which way the player is facing, and set it to face that way.

1679297871387.png
 

rubininio

Veteran
Veteran
Joined
Jan 30, 2023
Messages
32
Reaction score
9
First Language
German
Primarily Uses
RMMZ
If you're using a menu to move the puzzle piece then the invisible events are unnecessary, they were only there to push and rotate the piece if it had player collision.

To rotate the piece you can use the turn 90 degrees movement route, or if you want it to face the same direction as the player you can use a conditional branch to check which way the player is facing, and set it to face that way.

View attachment 256564
Thank you for your help. But this doesn't work.

The tile should rotate and look like this after I choose rotate.

1679300996040.png
 

ManaBrent

Veteran
Veteran
Joined
Apr 26, 2020
Messages
66
Reaction score
47
First Language
English
Primarily Uses
RMMV
I think the problem is likely the size of your image.

I assume your sprite looks like the example on the left below. But there needs to be extra space around whatever square the puzzle piece is rotating around. If it's rotating around the square marked R below then it needs to have the extra transparent space shown, this keeps it even when it rotates instead of spinning into the wrong position.
1679301399544.png
 

rubininio

Veteran
Veteran
Joined
Jan 30, 2023
Messages
32
Reaction score
9
First Language
German
Primarily Uses
RMMZ
I think the problem is likely the size of your image.

I assume your sprite looks like the example on the left below. But there needs to be extra space around whatever square the puzzle piece is rotating around. If it's rotating around the square marked R below then it needs to have the extra transparent space shown, this keeps it even when it rotates instead of spinning into the wrong position.
View attachment 256567

That make sense, but I tried it and nothing change, when I rotate it. I made a character file (look image) , with this puzzle piece four times in a column, every puzzle piece like your image above with 3x3 and each field 48 px x 48x.

The event isn't locate in the center. It's locate instead in the bottom middle blank square.

1679312840525.png

1679312884351.png
 

ManaBrent

Veteran
Veteran
Joined
Apr 26, 2020
Messages
66
Reaction score
47
First Language
English
Primarily Uses
RMMV
I've made a mistake, for some reason I thought that the character sprites moved like Pictures.

You're right that the sprite will always be above and not centered. But we can get around that.

This sprite structure will rotate the puzzle piece correctly depending on which way the event is facing. And make sure to add !$ before the filename (I called mine !$puzzletest for example).
1679314522295.png

Now to control the puzzle piece we need 2 simple events, one above the other. The one below is just the sprite, but make sure it's set to Direction Fix on, and Walking off.1679314642939.png

Now above that the second event controls the puzzle piece, it sits above because that's where the center of the sprite will be.

1679314767419.png

When we move it in a direction, both events move (you don't need them set to wait I was just being lazy).

And when we rotate it make sure the direction fix turns off first, and then back on afterwards.

1679314824426.png

Here's a video of it working:
 

rubininio

Veteran
Veteran
Joined
Jan 30, 2023
Messages
32
Reaction score
9
First Language
German
Primarily Uses
RMMZ
It works perfectly! Thank you so much. You're a genius and so kind!
I adjust the puzzle tiles in the file, that they turn around in clock order. In your file image above, they are mirrored, but in the video the turn normally in clock direction.
 

rubininio

Veteran
Veteran
Joined
Jan 30, 2023
Messages
32
Reaction score
9
First Language
German
Primarily Uses
RMMZ
I'm a few steps further, but...

Now I have three puzzle tiles, which I can move all. Each puzzle tile is made out of two events. One for the pattern and one connect to it with the commands.
With the player I control the puzzle tiles. When the player moves on the command event, the menu pop up and the player image change.

Now I have the problem, that the command event tile of the puzzle tiles don't collide and move on top of each other and block each other. All events are priority below, that I can move with the player on the tiles to select them.

I tried it to set the command events and the events for the patterns to through, then the events don't block each other, but then if two command events are on top of each other, the player command now the other event command.

And an other problem with the priority trough is, that the player can move the puzzle tiles out of the screen.

Have anybody a solution for this situation?

Bildschirm­foto 2023-03-21 um 21.46.30.png
Bildschirm­foto 2023-03-21 um 21.05.53.png
Bildschirm­foto 2023-03-21 um 21.49.16.png
Bildschirm­foto 2023-03-21 um 21.49.53.png
Bildschirm­foto 2023-03-21 um 21.48.27.png
Bildschirm­foto 2023-03-21 um 21.47.21.png
Bildschirm­foto 2023-03-21 um 21.47.45.png
Bildschirm­foto 2023-03-21 um 21.48.05.png
 

ManaBrent

Veteran
Veteran
Joined
Apr 26, 2020
Messages
66
Reaction score
47
First Language
English
Primarily Uses
RMMV
To stop it moving outside you could set 4 variables as the X, and Y coordinates of the edges of the puzzle (but account for it being 1 block inside the edge of the puzzle to keep the pieces inside) and when you move the puzzle pieces check that they are within those boundaries.

Collision with the other pieces is more tricky, you could do the same as above but have a set for each puzzle piece that updates when they move, and check that you're not moving into any 3x3 space of the other puzzles. But if you want them to overlap partially it gets harder.

Personally I would just make sure the puzzles don't collide with each others center, but let them overlap otherwise. And maybe make them different colours so it's easy to tell which piece is which.
 

rubininio

Veteran
Veteran
Joined
Jan 30, 2023
Messages
32
Reaction score
9
First Language
German
Primarily Uses
RMMZ
To stop it moving outside you could set 4 variables as the X, and Y coordinates of the edges of the puzzle (but account for it being 1 block inside the edge of the puzzle to keep the pieces inside) and when you move the puzzle pieces check that they are within those boundaries.

Collision with the other pieces is more tricky, you could do the same as above but have a set for each puzzle piece that updates when they move, and check that you're not moving into any 3x3 space of the other puzzles. But if you want them to overlap partially it gets harder.

Personally I would just make sure the puzzles don't collide with each others center, but let them overlap otherwise. And maybe make them different colours so it's easy to tell which piece is which.
Thank you for helping me again!
But I try to understand your tutorial, but I understand it not till the end. Sorry.

My puzzle tile is in a field of 3x3, but i.e. of the "T" puzzle tile, only 5 of the 9 spaces are filled with the pattern.

1679485195296.png

Now I have to make events on each of the 4 edges of the 3x3 grid, which control the x and y coords in a variable. Right?

1679485439767.png
1679485414516.png
After that I have to set a condition in the command event space.

1679485473112.png

And how I should make this, I don't know exactly. The puzzle tile is always in this boundaries, but must rest in the boundaries of the screen.

Maybe I misunderstood something. Sorry.
 

ManaBrent

Veteran
Veteran
Joined
Apr 26, 2020
Messages
66
Reaction score
47
First Language
English
Primarily Uses
RMMV
The first part was describing settings variables to the edges of the entire puzzle space, not the individual pieces. So say the area of your puzzle space is between X:3,Y:3 to X:9,Y:9. To stop a puzzle piece from going outside that area when you move it do a conditional check to see if the puzzle piece center is within those ranges.

Now for puzzle piece collision, you shouldn't need extra events. Just variables.

This is for if you just want to center's to not collide with each other.

Say you have 1 puzzle piece and it's center is on X:5, Y:12.
And a second puzzle piece on X:5, Y:13.

Set a set of variables to puzzle piece 01's location.
PuzzlePiece01-X = 5
PuzzlePiece01-Y = 12

And the same for the second puzzle piece.
PuzzlePiece02-X = 5
PuzzlePiece02-Y = 13

Now when you try to move any puzzle piece first check that the location it's going to doesn't match the same values as any other piece.

So when we try to move puzzle piece 1 down in this example before moving we set the current location again then:
PuzzlePiece01-Y + 1

Then we check if piece 01s numbers match any other pieces, in this case it would match 02 so we exit event processing and don't allow the movement to proceed.

But if we tried to move it any other direction it wouldn't match and we allow the movement to take place.

Now if you want every tile of each puzzle piece to interact with each other.

It's basically the same concept but instead of setting variables just for the center tile, you do it for every coloured square of the puzzle piece, and run the conditional checks when rotating as well as moving. It gets way more complicated. But that's the simplest way I can think of, someone else might have a better idea.
 

rubininio

Veteran
Veteran
Joined
Jan 30, 2023
Messages
32
Reaction score
9
First Language
German
Primarily Uses
RMMZ
Wow...

But I struggle to understand on this. It's difficult for me to understand, that I can create four events at the four edges which save the coordinates in a get location info, and I can cover a whole border/line between this four events.

And after that I have to set a conditional branch for the puzzle title for each of this four edge events?

Sorry, I'm stuck.
 

Latest Threads

Latest Posts

Latest Profile Posts

Ooops ended up trying out making my own A2 tile page instead of testing doors everywhere. Went well so far I think.
I guess I'm done making a blue squirrel's life difficult for posting new threads on different forums.
That's just for today so don't get used to this, squirrel-ish friend! :p
Got new hard drive, now trying to install the softwares I lost to the dead drive, and more than half of them won't install because they're already installed on the dead drive, and uninstallers won't run because they can't find where their programs are installed. So I take it having a drive die on you screws you in more ways than just data loss. >:\
PC got fixed finally. Back online again. Turns out I have no business trying to self repair pcs because it was getting to like 176F / 80C. Shop installed a totally new cooling system and now it runs fine and is super quiet.
When you're making major progress, but have to stop to go to work.

Forum statistics

Threads
131,486
Messages
1,220,213
Members
173,225
Latest member
ZecaVn
Top