This guide will hopefully show you how to think when designing code. Not following a guide, but making your own code.
So first, you’ll need extensive knowledge of all the devices. You’ll probably want to know about common device systems like player counters. You don’t have to know these though. It just speeds your journey up by not having to scroll through the devices menu each time you need a device that does something. You will also have to know lots of concepts like the back of your hand to get very advanced.
Define and Find a Core Idea
First, you have to define your goal and find different ways to get to the goal. Here is my process for my voting system:
First I want the player to be able to go at their own rate through people. There isn’t a way to display everyone, so I’ll use popups to do it one at a time. So now, I need a way for the system to loop through the players. So we give each player a number and loop through the numbers. This is called using a player id.
Put Padding to Support the Core Idea
So this is the core concept of my guide: Use player ids to loop through the server. Now we need a way to actually implement it. Right now, this is just a sentence, not a device system. So now we need this to convert it into devices. But where do I start? It seems that I can’t do everything at once. Its just very overwhelming. This brings us to the next part:
Start With Slices
So I just started with a system that assumes that we have already have the name finder. Basically, I just made it update the popup. This seems pretty easy, but you’ll see how hard that is at the end.
Fill in The Rest
Next, we have now have to loop through the server. So we’ll now need a player scoped property to see which person the player is currently viewing. I put a block that checks if the player that was broadcast to was really the player we need. If that was the player, then they will set a global property to their name and broadcast on a channel to alert the system that the player has been found. This will update the popup. After this, voting seems pretty easy.
Consider Possible Bugs
This is a very important step! You might have noticed that if 2 people click at the same time, then the properties get mixed up and it all comes crashing down. So that’s why I went back and added a huge block to see if anyone was there.
Consider Ways to Make This more Efficient
So I found a lot of inefficiencies with my system, but at that point, I was too annoyed with the system to actually go in and change it. So here’s some ways to get more efficient systems:
-
Congruence Cutdown (This is a big one)
So there are a few characteristics to a channel: Time of broadcast and scope. So if you have a preexisting channel that has the same exact time of broadcast and scope, then you don’t need a new channel. The same is true with triggers and other devices. Triggers have these characteristics: Scope and Function. The function part is not what it is supposed to do. It is what blocks it has, what those do, and what it broadcasts on. If it is exactly the same, then you don’t need an extra of that. (I’m guilty of this).
There is an extra one for more advanced gims. So say you want to filter out the people that don’t have something. You go into blocks and put if this = this then do this. Well… you can also do this since this also serves the same purpose. This will save you 6 blocks inside the block. So, you can use the activation of the device instead of the if statement. The 2 are congruent as long as the device does not do anything else. -
Recommendations please!