I know that isn’t a word, but I couldn’t think of anything clever for a title that had anything to do with the subject of this week’s work. That’s right, I figured out the logic that allows me to randomly select doors to open at the beginning of the race. The main microchip looks a little like this…
I’m sure you’re thinking to yourself, how do two microchips and a sequencer randomly choose which doors to open? It’s magic… Well, not really, it takes a little more than two microchips and a sequencer. Follow along and I will open those up so you can see how this really works.
The sequencer holds 2 batteries. The first battery triggers the random generators, and the second battery triggers the final reset of the randomizer. If I don’t reset it, it will create way too much havoc later in the game. Also, I have a little surprise I plan to add later, by suggestion from a co-worker.
The first thing triggered on the randomizer is a “single-shot switch”. Basically, it is a counter that counts up to 1. The switch activates the randomizer chip, which sends a signal to either port 2 or port 3 on the selector (the thingy with the pointing finger on it). Port 1 on the selector is reserved to act as an “off” switch.
When the selector ports activate they trigger another single-shot switch, which turn on one of the two magnetic tags at the bottom. One of them has a label “rnd up #” and the other has a label “rnd down #”. These magnetic tags are sensed by the doors, which open the doors if they are closed. You may ask, why do you need a second state that will close a door? Well, that’s one of the little secrets I’m working on. Can’t give away all my genius before I publish this level. Anyway, you also see a couple OR gates and a single AND gate. These take the various signals and use them to determine which parts of the logic needs to be reset. On the left hand side, the OR gate takes either signal from the selector, and feeds it into the AND gate. The other half of the AND gate comes from the first single-shot switch. If either port 2 or port 3 are activated on the selector, and the first single-shot switch are active at the same time, the first single-shot switch resets. This enables the whole process to activate at a later time in the race. The OR gate on the right side takes input from the second set of single-shot switches and sets the selector back to port 1. This resets that part of the logic for another go. The final reset comes from the second battery on the sequencer. When it activates, it resets the second set of single-shot switches. This fully resets the entire path and makes it ready for use later.
I put this logic on a microchip so I could copy it to reuse for each set of doors in the maze. I’m not sure how many I will have, but once it is copied all I have to do is rename the magnetic tags/sensors with the number of the door set. I also need to rename the parts on the doors as well. And, speaking of the doors, I had to modify the logic there a little bit. Check out this picture, I highlighted the changes with red boxes to make it easier to see the changes. I added two sensors, at the top, that sense when the “rnd up #” and “rnd down #” magnetic tags activate. I also added two more AND gates, to check for “door is up and rnd down #” or “door is down and rnd up #” conditions. The new AND gates connect to an OR gate with the previous checks for door states when then feed into the respective movers that open or close the doors. Easy peasy, lemon squeezy.
This latest round of logic work actually brings me to about the 90% completion on the logic. I still need to figure out how to get the players to the starting spots in the maze, but I won’t work on that until I finish building the maze. That being said, this is probably the last entry for a few weeks, until the maze is built. I’m kinda thinking of making two versions of this level; one for two players, and one for up to four players. The logic will be the same for both, just different designs for the mazes. Please send me some feedback on what you think about that.
Will you have to create two complete levels, or can you make it auto select, based on how many players there are?
ReplyDeleteI'm thinking two separate levels for one reason, I can make a bigger, more complex maze for a 2-player version. I'm not sure how I could create different mazes in the same level, based on the number of players. I watched a series, the one that gave me the idea for this one, that showed how to delete "cars" based on how many players join. I don't see that as something I will implement since each player has their own section of the maze.
ReplyDeleteI'll start with the version that is good for up to 4 players, and if it seems popular enough, or enough people ask, I can think about making the other one.