Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (754)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (842)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2 3 4
1  Games Center / 4K Game Competition - 2009 / Re: Putty Shuffle on: 2009-02-02 20:40:17
Nice game (again!).  Only managed to play about the first 8 or so so far.  I beat the par on level 5 though -- 10/12, see attachment.
2  Games Center / 4K Game Competition - 2009 / Re: MEG4kMAN, Mega Man in 4kb on: 2009-01-24 10:22:22
I found in my Kart game that it took up less space to insert the data in a string than to inject it.

My data though was a delta encoded bitmap, with the deltas starting from 1 (not 0) so that the string encoding was as efficient as the data injection.

The major space saving was in not having to scan through the class file to extract the data.
3  Games Center / 4K Game Competition - 2009 / Re: World Rally Driver 4K on: 2009-01-18 17:35:08
I wonder if Mr Foden has been playing on a 1.5 JVM?   Roll Eyes

Nope.  As you can see with my bug report earlier, I'm running with 1.6.0_07... Tongue

But now that I know it's slower on 1.5... Wink  (no, just kidding)

Cheers, Tim.
4  Games Center / 4K Game Competition - 2009 / Re: World Rally Driver 4K on: 2009-01-14 13:37:21
Sorry, I could no longer stand being second.

  ... but as all can see (if they watch the replay anyway), you cheated!  Tongue

So now the question is... are you going to fix the bug, or should I try and beat you by cheating too?  Wink

Cheers, Tim.
5  Games Center / 4K Game Competition - 2009 / Re: World Rally Driver 4K on: 2009-01-11 09:36:06
Just tried it on my system, and it didn't lock up.  However, I'm running Vista and Firefox 3.  Do any other Applets lock up when you do this?

No, other applets are fine.  This was something that began happening fairly recently.  However, your latest version (that doesn't use VolatileImage anymore?) is now fine again.

The only minor gripe I have is the 100% cpu thing... so I'd vote for changing the the yield() to a sleep(1).

Cheers, Tim.
6  Games Center / 4K Game Competition - 2009 / Re: World Rally Driver 4K on: 2009-01-10 12:54:36
I recently began to have the applet lock up.  I've figured out how to replicate the problem on my machine now.  After clicking on the applet to activate it, then the applet window is scrolled so that the applet isn't completely displayed, and is then scrolled back so you can see it all, it is now locked up.

This was in Firefox, Java Plug-in 1.6.0_07, Windows XP SP2.

Cheers, Tim.
7  Games Center / 4K Game Competition - 2009 / Re: World Rally Driver 4K on: 2009-01-09 12:20:49
The German dude slipped up today and tried to submit a score that was way over the top (a full second faster on USA).  So now I know the Sweden time is also a cheat.  I can only guess that they have decompiled my game to work out the codes (as they never submit incorrect codes).  I'm going to try to see if I can hide the calculation of the codes better.  Any ideas on how to do this would be most welcome!  Smiley

They may not be d-compiling the code.  It may be possible to reverse engineer your obfuscation algorithm just by observing the codes generated by different scores on the tracks.

I notice that when one of my scores get better, the numbers on the left of the code rarely change.  This would imply to me that the obfuscation isn't very complex.  It'd be better I think if the whole number changed wildly even if only a small change was made to one of the encoded scores.

In respect to knowing a better way... I don't know if there's a solution to this problem in general.  I've thought about it quite a bit for Pipe Extreme.  I think the conclusion was that the most foolproof way was to submit a vector of controls to the server, and have the server reconstruct the score information by replaying the game.  But this really isn't possible in your case.

Other senarios I've considered all require a direct network connection between the game and the server.

In your case the best would probably be to use a better encryption algorithm... but with the lack of space available this could be a problem.

Cheers, Tim.
8  Games Center / 4K Game Competition - 2009 / Re: World Rally Driver 4K on: 2009-01-08 20:10:06
I just manually updated your score.

Thanks for that... but I've actually beaten it now!   Tongue

The German people are back, and it looks like they didn't crack the code.  I'm blown away by the Sweden time, almost 2 seconds faster then anyone else!  Shocked

Hmm... 1092 does seem rather high.  Perhaps there is some way for me to go faster by using the brakes?  Smiley  (At the moment I just lift off the accelerator to slow down, but in real racing the cars slam the brakes really hard.)  Still, it's a big gap between my 1041 and his score.

Cheers, Tim.
9  Games Center / 4K Game Competition - 2009 / Re: World Rally Driver 4K on: 2009-01-08 07:33:54
Yes, sorry, last night I improved my code cracking detection, and I also made a new seed for the code, so you will need to close and reopen the page as it now generates different codes.  So you will lose your current progress, sorry!!  Roll Eyes

OK.  Just for posterity then, here's a jpegged screen print of my success!   Smiley   [I left the code in as it's not valid any more anyway]

I guess I'll start again with the new version this evening.

Cheers, Tim.
10  Games Center / 4K Game Competition - 2009 / Re: World Rally Driver 4K on: 2009-01-07 12:48:02
Damn you Tim Foden!!!  I _just_ got a friggin good time after playing my stupid awesome game for way too many hours, and you come along and beat it!  I think I'll go and play Kart blissfully unaware of how much faster everyone else is.


... and now trio of German players have managed to go even faster... hey what happened to their scores?

For USA it's now very hard to find many more points aver 1023 (but one of the disappearing German scores had 1025).
For Australia maybe a few more points are available... but I had a blast to get that 1040.
For Sweden I feel that it's possible to get at least 1045, and perhaps a bit more.

[new edit] Just got home and continued trying to beat my scores... and I got a great 1048 on Australia, but the score entry system doesn't seem to accept the code.  Have you changed the way it's encoded since yesterday (I have left the program running on my PC for about the last 3 days now)?

Cheers, Tim.
11  Games Center / 4K Game Competition - 2009 / Re: World Rally Driver 4K on: 2008-12-14 12:25:20


It looks like Andy may also give it a good go... just a bit more practising on the Sweden track, and if he manages 1000 (which I'm sure he will given his other scores) he'd have 3049, taking him to 2nd place.  But that last track is soooo frustrating... you have to get so much exactly right to get a good score at all.
12  Games Center / 4K Game Competition - 2009 / Re: World Rally Driver 4K on: 2008-12-13 09:45:35
I rule and you can all eat my dust. You will never beat me. Whooaaahaahaahaa Tongue

Well, now you can eat my dust!   Tongue
13  Games Center / 4K Game Competition - 2009 / Re: Pathfinding? on: 2008-12-09 13:32:56
Here's a quick example implementation of using a flood fill to find the shortest path.  It's not been optimised for size.  Smiley

class PathFinder
   public static void main( String[] args )
      final int W = 20;
      final int H = 15;
      final int SIZE = W * H;

      int[]   grid = new int[SIZE];

      // mark edges of grid.
      for( int i = 0; i < W; i++ )
         grid[i] = grid[SIZE - W + i] = -1;
      for( int i = 0; i < H; i++ )
         grid[i * W] = grid[W - 1 + i * W] = -1;

      int START = 1 + 1 * W;   // bottom left.
      int END   = (W - 2) + (H - 2) * W;   // top right.

      // grid offsets for the 8 main directions.
      final int[] OFFS = { -1, 1, -W, W, -1-W, 1-W, -1+W, 1+W };

      // add in some random obstacles...
      for( int i = 0; i < SIZE / 4; i++ )
         grid[(int)(Math.random() * SIZE)] = -1;

      // initialise dist for start.
      grid[START] = 1;
      grid[END]   = 0;

      // flood fill
      boolean changed = true;
      int count;
      for( count = 2; changed; count++ )
         changed = false;
         for( int from = 0; from < SIZE; from++ )
            if( grid[from] == count - 1 )
               for( int dir = 0; dir < 8; dir++ )
                  int to = from + OFFS[dir];

                  if( grid[to] == 0 || count < grid[to] )
                     grid[to] = count;
                     changed = true;

      // adjust count (started from 1, counted 1 extra -- need to subtract 2)
      count -= 2;

      if( grid[END] == 0 )
         // failed to reach end.
         System.out.println( "Failed to find a path from START to END" );
         // backtrack to get one of the shortest paths.
         int[] path = new int[count];
         int from = END;
         path[--count] = from;
         while( count > 0 )
            // search for lowest value.
            int best = END;
            for( int dir = 0; dir < 8; dir++ )
               int to = from + OFFS[dir];
               if( grid[to] > 0 && grid[best] > grid[to] )
                  best = to;
            from = best;
            path[--count] = from;

         // dump path.
         for( int i = 0; i < path.length; i++ )
            System.out.format( "%02d: (%2d, %2d)\n", i, path[i] % W, path[i] / W );

            // update grid to show path.
            grid[path[i]] = 99;

      // dump grid.
      for( int y = H - 1; y >= 0; y-- )
         System.out.printf( "%2d ", y );
         for( int x = 0; x < W; x++ )
            int i = x + y * W;
            if( i == START )
               System.out.print( " S " );
            else if( i == END )
               System.out.print( " E " );
            else if( grid[i] == 99 )
               System.out.print( " @ " );
            else if( grid[i] < 0 )
               System.out.print( "###" );
               System.out.print( " - " );
//               System.out.printf( "[%02d]", grid[i] );
      System.out.print( "  " );
      for( int x = 0; x < W; x++ )
         System.out.printf( " %02d", x );
14  Games Center / 4K Game Competition - 2009 / Re: Pathfinding? on: 2008-12-09 08:15:58
For my game the path quality does matter. Flood-fills doesn't return me the shortest path. ?

Yes it does.  As Riven said, once the fill has found the destination, you backtrack to find the path.  I.E. from the destination square, move to an adjacent square with the lowest iteration (or cost) number.  Keep doing this until you get back to the start.  You've just followed one of the shortest paths.

BTW, what criteria are you using to define which path is shortest through the grid?  For instance do you prefer diagonal movements over up/down?  Can you move at different speeds along the path?

If we knew a bit more about the path finding problem you want to solve maybe we'd be able to give some more specific help.

Cheers, Tim.
15  Games Center / 4K Game Competition - 2009 / Re: Kart (returning preview) :) on: 2008-12-04 13:51:00
No no, Markus... there were smileys, you know like this ---> Smiley

I'm not offended at all.  I'm just joking with you, in a light hearted way (at least, that's what I was trying to do...  sometimes it can be difficult to be jokey in a text only medium).

So in my turn, I hope I haven't offended you or anyone else.

Cheers, Tim.
16  Games Center / 4K Game Competition - 2009 / Re: Kart (returning preview) :) on: 2008-12-04 10:17:37
Oo, the 4k compo and Kart got a mention on Kotaku!

Presumably that'll be why Kart's suddenly got more than 1200 downloads, and World Rally Driver 4K has more than 600.

lol, relax. =)

I am relaxed... no really I am!  Smiley

Cheers, Tim.
17  Games Center / 4K Game Competition - 2009 / Re: Towlr4k on: 2008-12-04 09:02:22
I had a quick go.  So far I've not figured it out.  I'll try it again later.

Cheers, Tim.
18  Games Center / 4K Game Competition - 2009 / Re: Kart (returning preview) :) on: 2008-12-04 08:48:20

Well, that's ambiguous feedback however you look at it.  I guess I was expecting something will a little more information content.  Smiley

First I thought... well erm... "no comment"?
Then perhaps the whole comment was meant as a joke, the feedback being a metaphor for white noise.
Then I pressed the quote button to reply, and noticed that the "..." had a hidden feature... it was a link... to Sonic Racer 4K.

Then I got really confused!  Smiley

Perhaps it's "Hey I already did practically the same game",
Or "Mine was better",
Or "Mine was worse",
Or "Hey you copied my idea",
Or "Yes, mine also has a rotating perspective correct texture for the ground."

Ah well, perhaps we'll never know!

Cheers, Tim.
19  Games Center / 4K Game Competition - 2009 / Re: Kart (returning preview) :) on: 2008-12-04 07:56:35
Thanks steveyO.

I think perhaps the levels are now too difficult.  But hopefully I'll get some more feedback from others.

Cheers, Tim.
20  Games Center / 4K Game Competition - 2009 / Re: Kart (returning preview) :) on: 2008-12-03 15:38:48
I agree with Demonpants...a bit too easy to win.

Thanks Ranger and Demonpants for your comments.

I used Appel's mirror idea for the car bitmaps, and this saved about 55 bytes.  With this space I have modified the computer AI to be able to drive faster, and added a difficulty level choice for the user.

I would expect that it's still pretty easy to win on level 1, and probably impossible to win every time on level 3.

Any more comments on the difficulty or otherwise of the levels would be great!

Cheers, Tim.
21  Games Center / 4K Game Competition - 2009 / Re: Kart (returning preview) :) on: 2008-12-02 20:10:58
50% with mirroring is an interesting idea.  I've actually got 3 pirctures of the kart, one from the back, one from the front, and one from the side.  I mirror the one from the site to make the one from the other side.

Thus I have pictures from all 4 directions.

I could use the 50% and mirror technique on both the front and back views, which would save about of 1/3 of the space the bitmap is currently using (which is about 450 bytes compressed, 2400 bytes uncompressed).

It'd use some more bytes to do the mirroring, but I guess I may save about 100 bytes by doing this.  Thanks for the tip.  Smiley

Cheers, Tim.
22  Games Center / 4K Game Competition - 2009 / Kart (returning preview) :) on: 2008-12-02 15:37:08
4K Kart racing

I've just found the impetus to finish off the Kart game I started last year.

I had make some more space available, and then add the race control and scoring, etc.

Please post any suggestions or comments here.

[Updated to v0.93]
Improved computer driving AI and added difficulty levels.
23  Game Development / Artificial Intelligence / Re: pathfinding, targetting, and collisions when the world wraps on: 2008-08-15 14:46:43
The values for center.x and center.y will never be negative,

True. (well, this is what I had assumed anyway Smiley )

so the additional checks you suggest will never happen.

False -- assuming that
GameVector C = center.toGameVector(
is calculating the difference of the two vectors involved.

i.e.  doing the same kind of thing as the following pseudocode...

C.x = - center.x;
C.y = - center.y;

The code isn't checking center.x against -L/2 .... its checking C.x [which I assume is ( - center.x)] against -L/2.

Given two variables, A & B, whose range is [0..N], (A-B) has range [-N..N], which can definitely be negative if N > 0.

And the direction of that vector is important as it is being used to determine if the collision will happen within the given time tick.

So long as the subtractions to calculate the deltas (i.e. relative vectors -- both position and velocity) are both done the same way around, the relative signs should be correct.  And as long as the delta-velocity isn't too high (i.e. abs(deltaV.x) * t < L/2, etc.) then the collision time calc should work as expected too.

Cheers, Tim.
24  Game Development / Artificial Intelligence / Re: pathfinding, targetting, and collisions when the world wraps on: 2008-08-15 08:50:27
Awesome, thanks for that one.

I had to change another spot in a similar fashion.  The actual centers of the objects were being used to make a vector. It works like a charm now.

      GamePosition cTemp = center;
      GamePosition bTemp =;
      if (cTemp.x > (worldBounds.width / 2)) {
         cTemp.x -= worldBounds.width;
      if (cTemp.y > (worldBounds.height / 2)) {
         cTemp.y -= worldBounds.height;
      if (bTemp.x > (worldBounds.width / 2)) {
         bTemp.x -= worldBounds.width;
      if (bTemp.y > (worldBounds.height / 2)) {
         bTemp.y -= worldBounds.height;
      GameVector C = cTemp.toGameVector(bTemp);

I'm not convinced that the above code will actually work I'm afraid.  It's important that it's the DELTAS that are normalised.  I.e. the values AFTER the subtraction.

I think you'll find that your code above will now fail if, for example, A.x is just smaller than L/2 and B.x is just greater than L/2.  A would end up heading left to get to B, when it should be heading right.  You've just moved the problem from the boundaries of the space to the centre. Smiley

Perhaps this would be more correct:

      GameVector C = center.toGameVector(;
      if (C.x > (worldBounds.width / 2)) {
         C.x -= worldBounds.width;
      if (C.x < (-worldBounds.width / 2)) {
         C.x += worldBounds.width;
      if (C.y > (worldBounds.height / 2)) {
         C.y -= worldBounds.height;
      if (C.y < (-worldBounds.height / 2)) {
         C.y += worldBounds.height;

Cheers, Tim.
25  Game Development / Artificial Intelligence / Re: pathfinding, targetting, and collisions when the world wraps on: 2008-08-14 09:16:51

This is what I am currently doing to test for collisions.  If I add the temporary object, I won't have to change this at all.

   public double testCollision(GameObject b, double t, List<GameCollision> collisions) {
      GameVector movea = velocity.scale(t);
      GameVector moveb = b.velocity.scale(t);
      double deltaX = - center.x;
      double deltaXSquared = deltaX * deltaX;
      double deltaY = - center.y;
      double deltaYSquared = deltaY * deltaY;

To avoid having to do this 4 times (or to have temporary objects) you just need to normalise the deltas.  As long as the sum of the radii of the objects is less than half the dimension length (call this L), then you can just normalise the delta values to be in the range -L/2 ... L/2.


   double deltaX = - center.x;
   if( deltaX < -L/2 )
      deltaX += L;
   else if( deltaX > L/2 )
      deltaX -= L;

This will end up choosing the closest point of the 4 that are possible.  Then you just need do the hit test once as described.

Cheers, Tim.
26  Games Center / Archived Projects / Re: Defender on: 2008-07-22 12:50:59
This is a great remake.  Congratulations.  When I get back home I'll give it a more thorough try.

I've started but never finished making a defender remake myself at least 4 times in my programming life.  Well done for making such a polished complete version.

A quick wish: I'm afraid I'm one of the people who prefers to move the ship with my left hand, and fire shots with my right.  Perhaps the only way to accommodate people as fussy as me is to have programmable buttons. Smiley

A few minor points about trying to copy the real defender as much as possible (these are from my memory though... I'd have to run up the real thing to make sure... so please take them with a pinch of salt)...

(1) I agree with SimonH, the real defender didn't slow down as quickly.

(2) When you change direction, the old momentum still applied.  I.e. the ship would continue going in the direction it was before you change direction (now going backwards of course).  In your game it looses all it's speed in one go.

(3) In your game the shots the baddies fire appear to be aimed at the ship.  In the real thing, it took your ships speed into account, and aimed where it had to to hit a moving ship.

(4) In your game even the trail of the shot hits aliens.  I believe in the real game only the leading edge hit the aliens.  In fact (and this is really shakey...) I think the leading edge was a white bullet.

BTW, your Asteroids looks good too.  I did succeed in making an asteroids clone, but it's not as nice as yours (see Ast).

Cheers, Tim.
27  Game Development / Artificial Intelligence / Re: An AI challenge on: 2008-07-22 07:16:09
I've never had any problems with using nanoTime() instead of currentTimeMillis().  I've only tried it on Windows machines, but other posts that I've read that mention it are from people running Linux machines.  I can't remember anything about it's MacOS implementation.

It is necessary to check that the time hasn't gone backwards (which it does when the counter wraps... the documentation is a bit misleading there -- it wraps quicker than the documentation implies).  But your code already does this for the currentTimeMillis() version anyway.  The only other point is that of course the value returned is in nanoseconds not milliseconds.

Oh, one other thing... there seems to be a minor problem with it on multi-core AMD processors.  nanoTime is based off the cpu's high resolution timer, and on the multi-core AMD processor each core has it own timer, and it seems that they can get a little out of sync.  But apparently just rejecting times that go backwards tends to fix the problem fairly well.


see Game Timer
As an aside, I wouldn't suggest switching to System.nanotime.  That particularly timer doesn't work reliably on processors with energy saving capabilities (which is common, especially on laptops) and older dual core AMD processors.
-- doesn't sound good does it?  Smiley

also see NanoTime for Dual Core AMD systems
-- this one has some sample code for dealing with the problem.

Cheers, Tim.
28  Game Development / Artificial Intelligence / Re: An AI challenge on: 2008-07-21 08:48:18
Here's another iteration of with some more speed improvements.

In my timings (4 runs, square maze) the previous version has an average of 0.524 ms/turn.
This new version has an average of 0.353 ms/turn for the same maze.

This is not such a large improvement as the previous iteration, but I think it's worthwhile non-the-less.  I don't think I'll be looking at any more speed improvements at this time.  Smiley

Cheers, Tim.

A quick note about timings... I had to change to nanoTime() to get the accuracy shown here.  It would seem like a good idea to do this for all bots, and further, to take the timing code out of the bots completely.
29  Game Development / Artificial Intelligence / Re: An AI challenge on: 2008-07-20 17:43:09
OK, there's a new version of available.  It has some of the changes to make the lineOfSight and canSeeBetween routines faster.  It seems to make my bot about 2 to 3 times quicker.  I've got some more changes planned though, so please bear with me.

Cheers, Tim.
30  Game Development / Artificial Intelligence / Re: An AI challenge on: 2008-07-20 09:03:00
Oops! That'll teach me to 'borrow' code! Can you tidy it up for me Tim?

OK, I've made the changes.  As I said, they were fairly minor bugs really.  The code is in -- EDIT: this is the FOW from the previous release... I'll just get the new one now and see if its the same.  UPDATE: OK, I merged my changes into the new version of now, and uploaded it to the same address.

While I was looking at making these changes, I found code that I believe can be made a lot more efficient.

For example, the lineOfSight routine calls canMoveTo(x,y) for each point tested along the line, but canMoveTo(x,y) tests for hitting a pillar each time.  This means that it's doing a pillar hit test for each pixel in the map along the line being tested.  I think lineOfSight would be faster if it found the closest pillar once, and then used this info to limit its search in the map.

Would you like me to have a go at fixing this too?

Cheers, Tim.
Pages: [1] 2 3 4
DesertCoockie (22 views)
2018-05-13 18:23:11

nelsongames (74 views)
2018-04-24 18:15:36

nelsongames (68 views)
2018-04-24 18:14:32

ivj94 (751 views)
2018-03-24 14:47:39

ivj94 (81 views)
2018-03-24 14:46:31

ivj94 (605 views)
2018-03-24 14:43:53

Solater (97 views)
2018-03-17 05:04:08

nelsongames (178 views)
2018-03-05 17:56:34

Gornova (388 views)
2018-03-02 22:15:33

buddyBro (1048 views)
2018-02-28 16:59:18
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!