Mechanica

Mechanica

评价数不足
Programming Rework Starter Kit
由 Eclipticfate 制作
A guide to help with the new programming rework.
   
奖励
收藏
已收藏
取消收藏
Getting started with the new system
First, you're going to need 3 things, a miner, a furnace, and a computer.

The new programming was harder at first but it's a bit interesting when you start playing with it, and it makes your code more unique and harder to replicate. But it works pretty much the same way as before just that the executions are more strict now, and a tad glitchy as an outcome as you'll see.



Above when I finally realized how the new programming works, it usually starts with one of the 4 (executions) like above. First the change triggers a true execution and a wait, one signal bypasses the operator to trigger the on/off functionality. After that the wait finally triggers a second or two later and fires our default state. This is about as simple as it can get.

The confusing part in this is why you would need a second fire, well, it detects when the output of the miner happens and triggers a wait, and turns it on, after it waits the single cooking time it shuts off, so you see it's simple. Easier than mining research crystal. ( I wish I were joking. Need buddy back to mine those! )





A More Advanced Application
Almost like before we'll trigger an execution and a wait. But this time we'll trigger the execution WITH the wait. We'll also use more variables, like the percentage complete the furnace is, and really try to maximize the speed and efficiency. The first example gives much more noise pollution ( repeated clicking ) from rapidly enabling and disabling in a glitchy fashion.

This however triggers shortly after the miner tells it to wait to start, then it shuts off based on if the percentage is equal to zero with a compare. except that we want to know when the percentage is NOT equal to zero and it's busy smelting. When it equals 0 the furnace is done smelting, so this now also works as long as the furnace doesn't run out of materials. Nice huh? I kind of stumbled on this solution, and I kept working at it until it was complete.




You should really try these all out and learn how this functions, because it's going to get a tad more complex, and most of you are going to reprogram it. also take note this was created on the actual beta, when there was ONLY a 4x4 computer to work with.

1. ok so we turn the smelting percentage into a number 0-100. we compare and reverse it to get the condition of "finished smelting" encoded. Or rather we set the state to true when it equals 0, this is originally triggered by the wait, switched off immediately because it's on, setting the false condition again by the opposite of Is On and execution is switched. Then the "is smelting" so-to-speak gets flipped by the value tracker of itself, whenever it triggers 0 which only happens when it's not smelting at all.

2. we use the condition trigger variable ( red power cable ) of furnace on/off state and a NOT to again reverse it, and immediately toggle the state, but remember that conditional execution? we use a value change tracker to check that "smelting state" so essentially we've created a double toggle that is triggered by the miner, and switched off when the furnace is no longer crafting... and you think this dev doesn't love you.

We did do things differently this time though, in the original example it doesn't try to be efficient only automatic, that's what this part does is make it no longer timing dependent, but dependent on the conditions we'd normally have on hand. This likely could be refined into a 2x2 with a bit more code and using timing instead. An up and down counter was the first thing I tried but the that was too difficult to master and I ended up with this instead, which does it's own timing.

3. $$$PROFIT$$$, we now know how the code works, somewhat, we know how to make toggles, and conditional readers and statements, and we know how to check a furnace for completion, but I'll leave that dirty job to you :D

But we're not done just yet. Because if I'm not mistaken we still have noise pollution, or it's not working fully yet. so finish up here and onward to the next section!



Above you can see the trigger wires and how they attach. Oh I forgot to mention, you have to start with the power wire on the input and then the output before connecting it to anything or it won't connect twice like I've exploited it to do. This should allow for much smaller mobile computer systems in the future, you're welcome.




Finalizing our design!
And lastly we just add an interval timer to make sure the system toggles state and doesn't get stuck on maximum noise pollution. If you play around with it you'll see why it's there. Things after release will change over time as updates fix and change more things, but this should help people get more used to the new and wonderful system our beloved dev has worked so hard on. I think with a bit of time and patience and help you will come to enjoy the new system as much or more than the old one.

Pretty sure the wait is default 1 second, or two, just depends on how long your conveyor is, if you connect the furnace directly it's like 1 second but noise, and a bug will happen when you pick on up that is funny but not so fun. The interval timer is higher like 300.. or 30, it just makes sure that the system doesn't get stuck during the toggle with weird timing events and lag and such, I have no way to go back and test this but it should be enough to help anyway. I tried to document as I learned just for this reason. I've started over like everyone else on released version but that's when I encountered the bug and haven't felt like setting things up again just yet.



Finally, I'll leave you with an image that shows how much coal you save in the furnace as opposed to the miner, which are normally equalized in this version 1.2.3... this automatic coal saving system really helps out in the beginning, and it can be used for all of your instantly smelted ores. I'm confident you will learn to code in the new system much faster and better after reading this, feel free to comment if you're still having problems and I'll try to keep this up to date and fix it when needed.



This is my first steam guide and I was motivated because I love the concept of this game and really hope one day it'll be the game we all dream about while enjoying what we have in early access.

Good luck coding!



4 条留言
g7262711 7 月 14 日 上午 7:55 
im going back before they got rid of the budy bot
Eclipticfate  [作者] 2022 年 7 月 20 日 下午 6:05 
oh, they're labeled "2022" programming update ;)
Eclipticfate  [作者] 2022 年 7 月 20 日 下午 6:04 
Glad to be of assistance, you're welcome. Had this ready to go after running out of content and playing with the beta, zero day goodies, and I've just updated the descriptions for the smelter/miners, currently they are free to produce from the workshop, NO COST ENJOY!!!
MojitoBoy 2022 年 7 月 20 日 下午 5:47 
Dude you really help me ! Even if i don't really get everything but you make my day !
May you (if you want and have time) Make a tutorial video about the programming on Mechanica ?