Latest Entries »

Mastercam Pong

PongPlay

Mastercam is a common CAD/CAM system for Windows.  For those who don’t know, it allows you to program a CNC machine, lathe, robot, wire EDM, etc. to make a part for you.  Since I use it at my job every day, I decided to try my hand at programming a small application for it.  Net-hooks or chooks are what you create, and Mastercam runs them from within the software.  You can do a lot with them if you have the time to program.

Since VB is a simple starting point for any project, I wasn’t planning on this being anything more than a test, and speed wasn’t an issue, that’s what I wrote this in.  When you run it, you are presented with a window:

You have some options from here.  If you choose Single Player, it uses the Difficulty setting to control how hard the AI is to beat.  Really it just changes simple things like movement speed of the AI paddle.  The controls are I and K because those aren’t used for anything else in Mastercam by default.  This will open up a small window with scores.  That window is the actual workhorse of the whole game.  It runs the timer (20ms) and calculates the position and velocity of the ball and the paddles.  It then updates the lines in the Mastercam window to represent what is going on inside the game.

If you would like to play with someone else on your network, one of you needs to start a server by clicking Multiplayer Server.  The other person will click on Multiplayer Client, enter the IP of the computer running the server start playing.  Because the multiplayer portion of this was somewhat of an afterthought, it is quite buggy.  It works fine, but if one player closes it, Mastercam on the other computer will crash.  Maybe if I was more of a pong fan I would fix that.

If you would like the project, post a comment or shoot me an email and I’d be glad to send it to you.

I grew up playing Gauntlet on old-school arcade machines. They came out with other console versions later, but using the joystick and buttons was always my favourite.  When Diablo 3 was announced as coming out, the idea to make an arcade cabinet and controls for it just made sense.

 

 

I got the controls components about a month before the game was released and tried them out with a game called Torchlight.  The controls for that game didn’t work at all with the setup I had.  This was discouraging, but I just waited until Diablo 3 was finally released so I could test it on that.

The cabinet was built out of plywood because it’s cheap. I had the decals printed up and when they were put on, they took the shape of the wood grain so it looked as though they were painted on. I didn’t design any of the images on this.  I got the flames from cgtextures.com and the other two were from Blizzard.  They own the rights to these, not me.

The joystick and buttons are from sparkfun.com, which is a great website for those who like electronic tinkering/building. They are wired into an arduino, and from there, to a desktop computer within the cabinet. I wrote an intermediate program in VB.NET to interface the controls with the game.  There is NO modification to any game files as everything works outside the game.  Most of the buttons are dual-purpose.  Clicking on a button might equate to a left-click in game, or skill number 1 if clicked in conjunction with another button.  The joystick is the same.  Moving the joystick moves the mouse around the screen so you can target individual monsters/objects.  Holding the button on the top of the joystick moves the character around without changing the position you were targeting.  This allows you to “run and gun” as you’re always aiming in the same direction, but can run in a different direction.

Of course a next step (some may say backwards) is getting the controls working for MAME.  Shouldn’t be too hard, timing is the only holdup.

I’m working on an arcade machine for Diablo 3.  The cabinet is mostly done and the controls are mostly worked out.  Minor fixes for the controls are inevitable after enough testing, but I tried to make that as simple to update as possible.

I’m just waiting for the rest of the decals for the side to be printed up.  That shouldn’t take more than a week.  We put one small one on over the control area to make sure it would stick right.  This is just made with plywood right now (cheaper), but i think the ripples from the wood make it look like the decals were painted on!  Makes a lowly engineer like me feel artsy.

There is no modification to the game files at all.  Everything is done external to the game itself, making it easy to update, and gives me a little more control.

Below are some pictures of the machine currently.  A little more assembly and testing and it should be good to go!

Wile I was working with Niewma Systems, a Swiss gun range nearby needed some way to signal from the firing position to the target bunker that the shooter was finished firing.  They had a system in place a while back, but that had broken.  They ran cables under the lake in between the two areas and used a simple switch/light set up. When someone was done shooting, they would hold down the switch, which would light a light under their target.  Someone in the bunker that was holding the target would then pull it in, mark the score, and put the target back up.  They wanted something that would be robust, consistent, and that wouldn’t deviate from the previous system, meaning people wouldn’t need to learn something totally new.   The distance was about 300m (just under 1000 ft) and each end only had a car battery for power (12V).  They also wanted something that was either indestructible or moveable because the range is out in the country and not protected/guarded.

What I ended up doing was essentially trying to replace the cable with something wireless that took no setup once connected.  Xbee seemed to fit the bill pretty well.  The 1.5km range (with line-of-sight) of the pro version gave a little buffer room in case something wasn’t ideal.  I could also pair the two modules ahead of time to make sure interference wouldn’t be a problem and that it was plug-and-play.  Arduino also proved a very simple platform to implement this.  A simple loop was used to constantly read the state of the input buttons, which was sent to the other device.  If the entire string arrived properly (basic error-checking), the receiving device would turn on some LEDS as indicator lights using the wiring already in place.

The system worked very well for them.  They added some connectors at each end to make it more plug-and-play.  One connector connected all necessary wires as well as power.  They’ve used it for a couple tournaments so far without a problem.

For my birthday, I got an Etch-A-Sketch.  For those too young to know, it’s an old toy that has two knobs you turn to draw a picture by scratching off silver dust from a screen.  I’m a child at heart so I loved this toy.  I had seen the odd video on the internet of an Etch-A-Sketch being controlled with motors to draw things like lines, circles, etc., but nothing intricate or overly interesting.

I currently work at a company that sells a piece of software called Mastercam.  This is used to program multi-axis machines (primarily CNC) to manufacture parts automatically.  An Etch-A-Sketch is essentially a 2-axis machine, with one knob for each direction, which meant that, at least in theory, it could create paths for a capable Etch-A-Sketch.

With some simple motor drivers (L293D), 2 bipolar stepper motors, and an Arduino Duemilanove to control the whole thing, I made an attachment to control the knobs, and  in turn, what the screen drew from a computer.

With the help of some of the post developers at work, we created a simple output from Mastercam to control the Etch-A-Sketch based on any program I made.  I could literally draw the picture in Mastercam and the code would come out to have the Etch-A-Sketch duplicate it.

Arduinos  don’t have the memory capacity to store a large program, and they would need to be reprogrammed every time I wanted to draw something new.  DNC is a method used by machinists to run a program on a machine that is too big for the machine to hold all at once.  Using Java and the RXTX library, I wrote a simple DNC program to transfer programs over to the controller.  Handshaking was needed so the DNC program didn’t overrun the controller, but that was an easy fix.

This obviously isn’t anything super practical, but it was fun and makes for an easy way to always have a new picture sitting next to my desk

Follow

Get every new post delivered to your Inbox.