shapez 2

shapez 2

Not enough ratings
Advanced Logic
By DarkOutX
This is my collection of ideas, tips and tools to create some big mechanisms.
My goal is to help you create something by your own, instead of offering ready-to-copy-paste autonomous modules
   
Award
Favorite
Favorited
Unfavorite
Shortener | Button
The ingame Button element at fact is Toggle. So...
Goal
Each press of TOGGLE in GUI should trigger short "click" signal
Tips
- Button switches between 2 states - 0 and 1. Which is the problem we are going to solve.
So, we will just split this signal, modify it (reverse one of them) and connect again to make consistent output.
- After click we receive endless signal. Which is another problem.
To solve it, we need to break the signal after some "click" duration. So we will add EQ-gate

You can control "click" duration by increasing amount of NOTs (=ticks) from one side
Shape | Crystal | Pin | Null Detector
Goal
Detect if we have a task for shape or some other instance
Tips
Tips are sorted, read it one by one trying to solve by yourself
- There are 4 types of instance available:
Shape (SgSgSgSg)
Pin (P-P-P-P-)
Null (------Rw)
Crystal (cgcgcgcg)

- Null is a signal and can be checked with just Equal-check
- Only shape can be painted
- Only crystals breaks while stacking
- You can use virtual operators to check is instance changes after operation

NotShape detector
This one can be used to trigger only on shapes*
*It will work only after shape detection (p. Crystal detector left side) which removes color.
If you don't want to virtually remove color before check, you could extend this scheme by mirroring it with any other color to prevent false detection on red
NotStackable detector
This one can be used to separate Pins and Crystals
Crystal detector
Here is a combo of detectors with displays to understand how it works.
Memory
Goal
Create a system to store some state

    Tips for 1 bit
  • True(1) or False(0) is "1bit", so we need some kind of 1bit store
  • Store is a thing which have to change output by first activation and lock it.
  • We need some consistent source of signal(i), independent of external save/unsave
  • We can save 1 bit (=lock signal) by opening it's gate by itself
  • To reset bit, we have to just reset consistent signal(i)
1 bit Memory (v0)

    Tips for multiple bits
  • To reset memory, we need to simulate overflow, so last bit just have to reset consistent signal(i)
  • Each bit have own output which can be used to upgrade this circuit from cumulative storage to modular switch.
  • To make a switch, output of each bit have to block output of prev bit. So you will always get a single signal from last active bit

3 bit Memory (v1)
I've reworked it a bit - each bit has own consistent signal - so we can toggle each bit manually


Color selector
3 bit memory gives us storage for 8 states. We can use it as a color selector, for example.
Also, by toggling each bit manually, we will receive color mixer.
This scheme placed under memory scheme. This is 8 combinations of OR/AND/NOT gates with labels
7 Comments
DarkOutX  [author] 19 Jan @ 1:35pm 
Try adding more ticks form single side to make difference more than 1 tick
I believe it depends on CPU or mb last patches affected it (maybe they removed 1 tick per NOT operator, that would be fun, pushing to find other way to make delays)

Whole logic works only when we can control tick delays, but it's not really "promised" by game mechanics
If devs will disable tick delays, I currently have a single idea - making delays by tick-machine: endless belt where each item will produce tick.
boxcarz 19 Jan @ 12:49pm 
One-tick click devices and delays aren't working for me. Logic seems to be instantaneous, without noticeable tick speed.
DarkOutX  [author] 30 Oct, 2024 @ 12:05am 
O yeah, I didn't mention on guide that I've used it especially with shape detector which always deletes color (Crystal detector screenshot)
But yeah, double virtual coloring can help
leaky 3 29 Oct, 2024 @ 5:24pm 
Confirmed - red shape would throw false negative, but is solved by putting a painter of different colors on each side of the equality check.
leaky 3 29 Oct, 2024 @ 5:03pm 
thoughts on how to deal with shape detection when the input shape could be the same color you're applying and therefore both sides would match? i suppose by stringing two virtual painters of different colors... feels clunky but should work
Dickie 30 Aug, 2024 @ 9:50am 
Interesting guide, well done! Some good info there.