Saturday, September 15, 2012

Randomnicity

I know that isn’t a word, but I couldn’t think of anything clever for a title that had anything to do with therandomizer 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.

 

randomizer detail

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. advanced door logic marked 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. 

Saturday, September 8, 2012

Someone’s Knockin’ at the Door, Somebody’s Ringin’ the Bell

Trust me, The Beatles in no way inspired, or assisted me in the design of this logic.  Today I present to you the logic controlling the doors in my maze level.  You might think that it shouldn’t be that complicated to open and close a door and normally you would be right.  However, these doors do a little more than that.

If you remember me mentioning that when you press the “X” button, while driving the hovercraft, it “generates” a power pulse that triggers the doors in the maze.  If you don’t remember that, please go to my previous entry and get caught up with everyone else.  For the rest of you, continue reading.

door logic

The power pulse from the hovercraft turns on a magnetic key, which is detected by a sensor in the door logic, if the player is close enough.  On the circuit board, the sensor is on the right edge of the circuit board, shown above.  While this sensor is activated, it triggers the three timers, just to it’s left.  The timers count up from 0 to 1, 2, and 3 seconds.  As each timer reaches it’s limit, it triggers a magnetic key, and a sound generator.  Each of the magnetic keys trigger, wirelessly, pieces of sticker panel attached to the top surface of the door.  The first one lights up the two outermost pieces, the second one lights up the next two pieces, and the third one lights up the middle piece.  These are only in place to give the player a visual clue that the door is charging and will open or close soon. 

The other action that takes place, when the last timer reaches the 3 second mark, is sending a signal to two AND gates.  These gates are located on the left side of the circuit board.  The other leads, coming into the AND gates come from a sensor that checks to see in the door is currently open, or closed.  This sensor is at the upper left-hand corner of the circuit board.  I turned on the setting that checks to see if the magnetic tag it is trying to sense is on the same layer as the sensor.  This means that I only need one tag/sensor pair to determine the status of the door.  Just below the sensor is a NOT gate.  When the sensor does not “see” the “door open” tag, the NOT gate triggers, which activates the AND gate that leads to the mover that closes the door.

Below the AND gates are two timers.  These timers are set for 0.5 seconds.  This creates enough delay that the last piece of sticker panel on the door lights up before the door opens/closes and everything resets.  The timer on the right, sends a signal to the mover that opens the door, and the OR gate to the right.  The timer on the left sends a signal to two OR gates.  The OR gate on the right, the one with three inputs, is used to reset the three timers, thereby shutting off the magnetic tags, thereby turning off the pieces of sticker panel on the door.  The final OR switch, the one that triggers the “door close” mover, also takes input from one last sensor. 

The last sensor on this circuit board looks for a signal that indicates that one of the matching doors, from another section of the maze, is closing.  Since each section of the maze will be the same, they all have doors in the same locations.  The magnetic key, in the lower left-hand corner, triggers when a door closes, and the other three matching doors will notice this turning on and close, if they are currently open.  Confusing, isn’t it?  The idea is that a player can take the time to close the door behind them, and close the matching doors for their opponents.  One of the special obstacles I have planned.

I know this was a bit long, but there was quite a bit of logic on this one.  If you have any questions, please post them in the comments.

Saturday, September 1, 2012

And now for something completely different…

No, this isn’t going to be a blog about anything Monty Python, I just had an idea for a new level, and decided to run with it rather than do additional work on part 2 of my Yeti level.  This new level is going to be a versus level, for 1-4 players.  Yes, I know it’s kinda hard for a single person to play a versus level, but I figure if I design it right, and by right I mean that a player can pick their starting position, a player could practice each path.

That being said, the idea is to create a maze with 4 sections that dump into a central location.  Each section will be the same, except that they will be mirrors of each other.  Throughout the mazes I am placing doors that the players have to open.  I want to add some element that lets a player close a door in an opponent’s maze to slow them down.  I think I will make this element in such a way that it slows them down on their own path, so they need to choose between possibly slowing down an opponent, or just charging forward.  We’ll have to see how that goes.

The Vehicle

A Photo_4

 

I started by designing the vehicle the players use.  I settled on a hovercraft, and wanted to use repulsors for steering them.  The final design looks a little like this.  Somewhere between the X-Men and Green Lantern logos, and the player sits in the middle.  The materials I used are a pebbled dark brass for the top layer, freaky clouds for the internal pieces, and sticker panel for the repulsors, which are arcs on the outer edge of each quarter.  At the tip of 4 points I placed small LED lights.  The cool thing about this design is that I can change the basic color of the LED lights, the sticker panel repulsors, and the freaky cloud pieces.  This enables me to make a different colored hovercraft for each player.  That will give the players a clue as to which part of the maze they are in.  The other clue will be the position of the starting box. 

 

The Logic

A Photo_2 A Photo_3 A Photo_1

I made some simple movement logic using the controlinator, in case I wanted to add some features the players can access by pressing one of the buttons. Starting with the picture on the left, you see the controlinator setup.  In the upper, right-hand corner, I placed a microchip where I put the elements that will always be on.  The first object is a game camera, used to control how much of the surrounding maze the player can see,  Below that is an anti-gravity tweaker.  I use this because the game will be a top-down perspective, it allows the hovercraft to move around easily.  One of the settings, dampening is set low so the vehicle will slow down gradually if the repulsors are off.  The last element is a gyroscope, to keep it pointing up.  I also added a material tweaker on the “freaky cloud” pieces, and set the bounciness to about 30%.  This makes the hovercraft bounce off the walls when it hits them. 

On the left-hand side is the logic that turns on the magnetic keys that trigger the movement, and lighting elements.  The player uses the left joystick, or directional buttons to steer the hovercraft.  Each of the magnetic keys triggers one or more of the magnetic sensors on the 8-way movement microchip, in the center picture, and the repulsor microchip, in the right-hand picture.  The 8-way movement uses simple movers to move the hovercraft in a single direction, or diagonally, at a set speed.  I’m thinking of adding a boost powerup, that would increase the movement rate for a short period of time.  In the right-hand picture, I use the magnetic sensor to turn on a sound generator to make the crackling electricity noise, a lethalizer to add electricity to the repulsors, and set the sticker panel (repulsors) to on and light up brighter.

The last piece of logic on the controlinator is a magnetic key and a sound generator attached to the “X” button.  Pressing the “X” button will trigger all 4 directional magnetic keys, which turn all 4 repulsors, a magnetic key which turns on the 4 small LED lights, and plays a pulsing sound, which plays in addition to the crackling electricity sounds.  This also has the effect of stopping the hovercraft in it’s tracks.  This “pulse” is how the player will trigger the door switches in the maze. 

That is all I have planned for this weekend.  I might put the hovercraft on my “CommToad’s Creations” level in case you want to get a copy and play with in on your moon, or even use it in your levels.  If you have any suggestions for additional functions, let me know.  That’s what LBP is all about.