Puzzlescript: Difference between revisions

From Witscopedia
(taking a page outta seren)
 
(The most mainstream puzzlescript has ever gotten is a dick joke)
 
Line 47: Line 47:


Make some games!
Make some games!
== Trivia ==
[[wikipedia:Markiplier|Markiplier]] once played a puzzlescript game called [https://talhakaya.itch.io/peniscloner Penis Cloner].<ref>https://www.youtube.com/watch?v=FkhbxTDAp0I</ref>
== References ==
<references />

Latest revision as of 14:26, 17 July 2024

PuzzleScript is a game engine designed to help you make tile-based puzzle games. The most famous tile-based puzzle game is sokoban:

Sokoban has one rule:

  • If a player is trying to walk into a crate, try to push that crate.

PuzzleScript allows you to express this succinctly:

[ > Player | Crate ] -> [ > Player | > Crate ]

The engine looks for the pattern on the left, and replaces it with the one on the right.

> is a directional arrow. The four arrows are <, >, ^, and v.

Let's play with the above line of code - what would happen if we changed the direction of the arrows?

[ < Player | Crate ] -> [ < Player | < Crate ]

Now, the crates stick to you you when you move away from them!

The engine works like this:

  1. The player is marked as being someone who wants to move
  2. Each of your rules is applied as often as it can be.
  3. Movement happens.
  4. An optional extra stage for rules you want to apply at the very end.

What might you want to do after movements have been applied? Say you want three crates in a row to vanish (a la block faker), you do this by adding the following rule:

late [ Crate | Crate | Crate ] -> [ | | ]

If the late keyword wasn't there, the crates wouldn't disappear until the start of the next turn.

Let's have spooky eyeballs that follow you around.

[ Eyeball | ... | Player ] -> [ > Eyeball | ... | Player ]

Here's a naughty teleport sprite - whenever she sees you she swaps places with you:

late [ Sprite | ... | Player ] -> [ Player | ... | Sprite ]

No, wait! Don't type that in. It causes an infinite loop, it keeps swapping them back and forth forever. This fixes it:

late [ Sprite | ... | Player ] -> [ Temp | ... | Sprite ]
late [ Temp ] -> [ Player ]

What if you're a kitty that likes fruit?

[ > Kitty | ... | Fruit ] -> [ | ... | Kitty ]
[ > Kitty ] -> [ Kitty ]

The second line is because we are moving the kitty ourselves, and don't want the game engine letting kitty wander about.

What if you want crates that can only be pushed horizontally?

Horizontal [ > Player | Block ] -> [ > Player | > Block ]

This only looks for occurrences of the pattern that are horizontal. You could also say vertical instead.

You can have several patterns rather than just a single row - here's a sumo wrestler that imitates whatever you do, wherever you are:

[ > Player ] [ Sumo ] -> [ > Player ] [ > Sumo ]

That about covers all the basics. You should be able to tinker with the examples now. There's plenty more to read if you want to, but I would advise to learn the rest on a need-to-know basis. There're no prizes for knowing all the nooks and crannies of PuzzleScript - it's a tool for making games, and if you're not doing that with it, then the engine has failed in its purpose.

Make some games!

Trivia

Markiplier once played a puzzlescript game called Penis Cloner.[1]

References