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.

About these ads