About Archive Tags RSS Feed


Let me show you the way.

26 August 2008 21:50

So I got bored tonight and figured I'd write a game...

I'm genuinely not sure whether I've seen this concept before, or came up with it myself. I suspect the former. I know that I sat down with the intention of coding this game and knew how it would play and what the mechanics would be.

Having said that though I cannot think of a similar game I've played - though parts are obviously derivitive.

Anyway the aim of the game:

  • A (single currently) ball bounces around the screen.
  • You draw lines upon the screen, using the mouse, to influence the movement of the ball.
  • The level (game) is over when the ball lands in the "exit box".

Thus far the game exists only in the skelital form with the minimum required functionality. There are two modes currently: "easy" & "hard". The hard mode was primarily added to prove to myself that the "leveling" system could work in a fun way.

Feedback welcome. Especially if it can tell me where I'm going wrong with the collision detection - but even if it is to critique my hacked-up SDL coding.

(The only other SDL coding I've done was in C, and was the mousetrap game.)

Obviously the game is written in perl, and I admit nasty perl at that. To play it you'll only need:

apt-get install libsdl-perl


ObQuote: The Chronicles of Riddick



Comments on this entry

icon Steinar H. Gunderson at 23:25 on 26 August 2008
This sounds like a fun concept (somewhat like The Incredible Machine), although perhaps a short-lived. On my laptop the collision detection is _completely_ borked, though, so it's basically unplayable (the ball goes in a random direction). I haven't looked at the code, but it doesn't sound very difficult: You know the formula for the line (ax by = 0), you know the distance from the centre of the ball to the line (just insert x and y into the formula for the line), and if the centre is less then R (ie. the ball's radius) away from the line and heading towards it (motion vector line normal < 0), you need to reflect the motion (new motion vector = 2 * line normal old motion vector gives you the direction, the magnitude is the same).
/* Steinar */
icon Felipe Sateler at 23:31 on 26 August 2008
A similar game comes preloaded with Windows Vista, so I'm guessing that's were you got the idea.
icon Jo Shields at 23:44 on 26 August 2008
Promise you won't get mad?
It's a game provided with Windows Vista, called InkBall
icon rpetre at 23:46 on 26 August 2008
Sounds like one of the default games in Vista, I forgot its name, maybe you've seen it?
icon Ben Hutchings at 01:51 on 27 August 2008
Sounds a bit like QIX
icon Warbo at 02:07 on 27 August 2008
Thinking of this maybe? http://en.wikipedia.org/wiki/Crayon_Physics
icon Roopesh Chander at 07:05 on 27 August 2008
Hey, that's Inkball, the only decent game that ever shipped default with any version of Windows (eek). Well, yeah, skx is pretty primitive, I agree. (What's skx anyway?)
icon Fabian at 07:30 on 27 August 2008
Sounds like one of the games that is shipped with Windows Vista. Not kidding...
icon Robert Hart at 07:42 on 27 August 2008
Anything like this http://en.wikipedia.org/wiki/InkBall?
icon Steve at 08:01 on 27 August 2008

I think you've all told me that it's the Vista game, Inkball.

I swear I've never played it, but I guess I've seen it around on TV/adverts or something!

I'll have to see if I can tidy up the collision detection Steinar. For me it seems to be correct a lot of the time, but not entirely..

icon Steinar H. Gunderson at 16:39 on 27 August 2008
Steve, I guess you just have a faster machine than I. Try it on a slower one so the framerate goes down, and you'll see it bounces all over the place :-)
/* Steinar */
icon Steve at 16:54 on 27 August 2008

That could well be the case. I've tried it on two machines and both cases it was acceptible.

I guess we could change the heartbeat() function to slow things down, but I'm not too sure how that would affect things.

Anyway my current plan is :

  • Either fix the recoil & declare it done.
  • Leave it alone and move on.

No strong preference yet. For completeness I'd like to make it "perfect", but I'm stumped.