Friday, September 07, 2007

Java Games

I recently made two simple Java games:

Ping:

Online applet
.jar file

This is a remake of a game I made in highschool [link]. It is based on the classic game Pong.

Swarm:


Online applet
.jar file

This actually started off as a little project I was working on to create emergent behaviors. After assigning a few simple rules to dots on the screen, the dots could actually interact with eachother in complex patterns. These are the rules which each dot follows:

- Move towards closest neighbor
- Move towards left mouse click (proportional to distance from click)
- Move away from right mouse click (proportional to distance from click)
- Move randomly

I thought it was interesting how the dots movement seemed similar to insect swarms. I then decided to make this into a simple game by adding worms which hunt down the dots. The user tries to control the dots to avoid the worms. I made the worms using Bézier curves and trigonometric functions. I had a few problems with the transition between the sin/cos functions (used to animate the worms wiggling), so occasionally a worm might have some strange movements ;)

(Note: the game is CPU intensive, so it might run slowly on older computers. It will probably run faster as an application from the .jar file than as an applet.)

2 comments:

jC said...

Cool game! I'm not very good though. My maximum was about 1046 for Ping and 3480 for Swarm.

Byron Knoll said...

My high score for Ping is 2579, and 6687 for Swarm.