Devlog 003 - New Stacking Mechanics
Author: tobspr Games,
published 1 year ago,
Hey everyone!
As promised in the last [url=https://steamcommunity.com/games/2162800/announcements/detail/3729585352011852548]devlog[/url], I wanted to cover the changes and new mechanics regarding item stacking in Shapez 2!
However, I wanted to also quickly mention that we have a new logo for Shapez 2:
[h2]New Logo[/h2]
https://store.steampowered.com/app/2162800/shapez_2/
Let us know in the comments if you like it!
[h1]Devlog - Stacking[/h1]
[i][b]Please note: This devlog might contain spoilers regarding shapez 1, if you haven't completed level 20 yet.[/b][/i]
[h2]Recap from shapez 1 - The old system[/h2]
In [url=https://store.steampowered.com/app/1318690/shapez/]shapez 1[/url], the stacking basically works like this:
If you [b]combine[/b] two shapes, let's say, two halves, it will combine them on a single layer:
[url=https://clan.cloudflare.steamstatic.com/images//43169810/2d95967289a7509c66b86047e3c87ba7e3d31cdd.png][img]https://clan.cloudflare.steamstatic.com/images//43169810/2d95967289a7509c66b86047e3c87ba7e3d31cdd.png[/img][/url]
However, if you try to stack shapes that have [b]overlapping parts[/b], the right shape will stack "on top" of the other shape, effectively getting smaller:
[url=https://clan.cloudflare.steamstatic.com/images//43169810/f9945408a55b2c4e099d70b9681acf83eba9cc46.png][img]https://clan.cloudflare.steamstatic.com/images//43169810/f9945408a55b2c4e099d70b9681acf83eba9cc46.png[/img][/url]
The reason for the upper shape is getting smaller is making sure you can still read both layers.
It can get more complex quickly though - what if the shapes only [b]partially overlap[/b]?
In this case, you will produce an [b]overhang[/b]:
[url=https://clan.cloudflare.steamstatic.com/images//43169810/01068e3bf79cf26e9e9e608479318b5fbe16d252.png][img]https://clan.cloudflare.steamstatic.com/images//43169810/01068e3bf79cf26e9e9e608479318b5fbe16d252.png[/img][/url]
If you now try to [b]cut this overhang[/b], the right side "falls down" and gets bigger again:
[url=https://clan.cloudflare.steamstatic.com/images//43169810/b1fe12f10700675d3abf9f596fec27c2b6bd5162.png][img]https://clan.cloudflare.steamstatic.com/images//43169810/b1fe12f10700675d3abf9f596fec27c2b6bd5162.png[/img][/url]
Here for example is how you produce a shape that has a "floating" piece which is not connected to anything else (like in the logo):
[url=https://clan.cloudflare.steamstatic.com/images//43169810/971c4a2e669e96b0f798bfadd07b5660e4e53bf6.png][img]https://clan.cloudflare.steamstatic.com/images//43169810/971c4a2e669e96b0f798bfadd07b5660e4e53bf6.png[/img][/url]
Using this mechanic is required to produce the logo (level 20) shape - and it can be very unintuitive.
In fact, it is so unintuitive that we got hundreds of bug reports about "broken stacking mechanics" so far!
[h2]The reason to change[/h2]
When making a survey in the [url=https://discord.com/channels/1000343719314198548/1000346230687289364/1037445701061333072]shapez 2 discord[/url] about the stacking mechanics, this is what we got out of 927 votes:
A) [b]31%[/b]: I have completed level 20 in shapez 1, and figured the solution on my own
B) [b]51%[/b] I have completed level 20 in shapez 1, but I looked up the solution fully or partially
C) [b]3%[/b] I stopped at level 20
D) [b]15%[/b] I stopped before level 20
Seeing that only 18% stopped at level 20 or before - it shows that this is really represents the core audience of shapez, having played the game at least for 10 hours +.
And yet, out of the 82% who completed level 20, effectively 62% had to look up the solution on the internet!
This showed us that the mechanic definitely needs a change, and this is what we did in Shapez 2.
[h2]Stacking in Shapez 2[/h2]
Our goal for Shapez 2 was, besides of making all buildings open, making the game more accessible. This also includes making all mechanics feel like a challenge, but not like a bug, and thus they have to be intuitive.
I'll simply show the exact same setup from above, but this time in shapez 2. (PS: There are alpha builds available in the [url=https://discord.com/invite/bvq5uGxW8G]discord[/url], if you want to try it yourself!)
Again, if you combine 2 halves, it looks like this:
[url=https://clan.cloudflare.steamstatic.com/images//43169810/2b37665e7b21266bb8c74129d3b2057148e53697.gif][img]https://clan.cloudflare.steamstatic.com/images//43169810/2b37665e7b21266bb8c74129d3b2057148e53697.gif[/img][/url]
If you stack 2 shapes that have [b]overlapping parts[/b], it looks like this:
[url=https://clan.cloudflare.steamstatic.com/images//43169810/16a79a829f94fe17cd08a5085e7f2f680f7f79ea.gif][img]https://clan.cloudflare.steamstatic.com/images//43169810/16a79a829f94fe17cd08a5085e7f2f680f7f79ea.gif[/img][/url]
If you stack 2 shapes that only [b]partially overlap[/b], it looks like this:
[url=https://clan.cloudflare.steamstatic.com/images//43169810/76e33146d7d19def501ed307dbf8d6d4c74b8842.gif][img]https://clan.cloudflare.steamstatic.com/images//43169810/76e33146d7d19def501ed307dbf8d6d4c74b8842.gif[/img][/url]
So far so good - but what happens if you now try to [b]cut[/b] the overhang?
[url=https://clan.cloudflare.steamstatic.com/images//43169810/ea3f6788c0348ce18426a10f302cf9a125d0c059.gif][img]https://clan.cloudflare.steamstatic.com/images//43169810/ea3f6788c0348ce18426a10f302cf9a125d0c059.gif[/img][/url]
As you can see, there is now a little animation showing how the overhang is falling down and resizing to its original size.
This also applies if you try to build a floating shape:
[url=https://clan.cloudflare.steamstatic.com/images//43169810/7b5297f7a93843ccf6c2dc250fbb6b87839b85f1.gif][img]https://clan.cloudflare.steamstatic.com/images//43169810/7b5297f7a93843ccf6c2dc250fbb6b87839b85f1.gif[/img][/url]
As you can see - the overhang now falls down as well!
This means that floating shapes, which are not connected to any adjacent shape, are not possible in Shapez 2 - are they?
Let me introduce you the new pin mechanic!
[h2]Pin Pushers[/h2]
To allow to produce floating shapes in shapez 2, we wanted a mechanic that makes more sense and also looks "reasonable" with the new 3D environment - having parts just float in the air would look weird and inconsistent.
Thus, we are introducing a new mechanic - the pin pusher.
[url=https://clan.cloudflare.steamstatic.com/images//43169810/1058aae49729af27a86b7c0b8f0e035824144ed2.gif][img]https://clan.cloudflare.steamstatic.com/images//43169810/1058aae49729af27a86b7c0b8f0e035824144ed2.gif[/img][/url]
It introduces a new "shape part" type (Short code: "P-"), that is a little different compared to the other shape parts. It effectively removes a whole quadrant and replaces it with a single pin.
Utilizing the pin, you can create floating shapes again:
[url=https://clan.cloudflare.steamstatic.com/images//43169810/d4f5aedf3db762607b4dde9a9b6cbd25274b46dd.gif][img]https://clan.cloudflare.steamstatic.com/images//43169810/d4f5aedf3db762607b4dde9a9b6cbd25274b46dd.gif[/img][/url]
This makes whole process a lot more intuitive. And you can produce some pretty .. interesting shapes! Notice how the right shape is actually the "a" from our new logo - a shape you can only produce in Shapez 2!
[url=https://clan.cloudflare.steamstatic.com/images//43169810/cafddc634902e998d6f1ddad4e1f3bca0af47ad5.png][img]https://clan.cloudflare.steamstatic.com/images//43169810/cafddc634902e998d6f1ddad4e1f3bca0af47ad5.png[/img][/url]
[h2]The algorithm[/h2]
The shape stacking logic has been created completely from scratch in Shapez 2. It now does an actual, physics based simulation of the shape (which is of course cached, so it's very efficient).
The first step is identifying "groups" within a shape. 2 parts of a shape count connected if:
- They are on the same layer
- They are adjacent quadrants (i.e. top right and bottom left wouldn't connect)
- Both are a "full" shape - that means, not a pin
A group is connected physically, so it means that when it falls down, all parts fall down by the same amount.
After identifying the groups, we run our "physics" simulation which basically applies gravity to all groups, until the shape is not changing anymore.
This might sound rather complex at first, but the behaviour is actually a lot more intuitive if you try out!
PS: Again, there are alpha builds available in the [url=https://discord.com/invite/bvq5uGxW8G]discord[/url], if you want to try it yourself!
PPS: If you are interested in the exact details - you can find the C# Source [url=https://gist.github.com/tobspr/07ba123295b560e048eefadcafd7611c]here[/url]! We are always happy to get suggestions on the code, just like in shapez 1.
[h2]Further mechanics[/h2]
The floating shapes mechanic was a beloved mechanic from a lot of veteran shapez 1 players, and we are very well aware that the pin pusher mechanic simplifies the process quite a bit. Especially for those who love (hard) puzzles, there is now a gap.
However, don't worry - this is why we are introducing additional shape mechanics as well, such as crystals!
Be sure to [url=https://store.steampowered.com/app/2162800/shapez_2/]follow the Store Page[/url] to get notified about new devlogs covering those mechanics!
[url=https://clan.cloudflare.steamstatic.com/images//43169810/9a17d309a6245d764bd6c687a25627574205a50d.png][img]https://clan.cloudflare.steamstatic.com/images//43169810/9a17d309a6245d764bd6c687a25627574205a50d.png[/img][/url]
PS: Did you notice all GIFs loop seamlessly? This was actually a lot of work! If you like the devlogs, let us know in the comments so we know it's appreciated :)
Have a nice weekend!
Tobias
[h2]Wishlist & Follow Shapez 2[/h2]
https://store.steampowered.com/app/2162800/shapez_2/