Creating puzzles

Guitarito
Posted on 2023-12-31 01:21 Link

Hi,

I really liked apparatus many years ago and recently discovered the existence of principia. This game looks amazing and I would love to be able to create basic puzzles for my kids. So far I haven't found how to do it. I would like my children to be able to modify the wooden planks (with the star that appears) before pressing the play button but I can't do it. All I can do is create a level but where you can only see the elements falling...

Thanks for your help.

(Avatar)
ROllerozxa
Posted on 2023-12-31 16:59 Link

Principia does indeed have puzzle levels, like Apparatus' Building Challenge levels. They are a level type just like Custom and Adventure levels, and the levels you can find in the "Learn with puzzles" menu if you press "Play" on the main menu are the puzzle level type.

Unfortunately creating your own puzzle levels were deprecated in 1.5 (I was very critical of this change back in 2014 when it happened but not much can be done to change what happened in the past, there were different priorities during the development back then). The level type is hidden from creation in the sandbox, playtesting puzzle levels in the sandbox is broken, and attempting to play puzzle levels from a community site is broken (try playing this level, for example). I am in favour of fixing up puzzles so that they fully work again, but the related code is rather chaotic and I haven't been able to fix it yet (it is tracked as issue #91).

For now, you can create puzzle levels by creating a regular level in the sandbox and changing the level type (second byte, after the version field) to 0x00 with a hex editor. A long time ago I wrote a Python script that can do this for you if you specify the level file's path. I've also prepared an empty level file with the puzzle type empty_puzzle_level.plvl that you can rename to some number and put in your levels folder.

When opening a puzzle level in the sandbox, you should be able to see a (rather out of place) button with a dark background and a cursor icon when you select a non-static object which you can use to toggle whether an object is movable when playing the puzzle. If you try to play a puzzle level in the sandbox (either Test play or Simulate options), the level will most likely break. Puzzles are rather buggy in the sandbox in general so it's a good idea to regularly save the level.

To actually play the puzzles, you can take the puzzle level you've created and replace the built-in puzzle levels in the Learn with puzzles menu. On Windows they are installed by default to C:\Program Files\Principia\data-shared\lvl\main\ and their filenames are the order in which they come (1.plvl is the first puzzle level, and so on...).

It's a bit convoluted at the moment and I apologise for it but I hope this may be of use to you.

Guitarito
Posted on 2023-12-31 21:47 Link

Thank you for taking the time to answer me, I will take a closer look to this!