4Kanabalt

Just started one:

http://dl.dropbox.com/u/1668516/fourkay/runner1.png

Sorta working.

Kev

Looks nice. Can’t wait to try it :slight_smile:

I approve of this! :smiley: thumbs up

Retitled based on suggestions, 4Kanabalt.

First ditch testing:

http://dl.dropbox.com/u/1668516/fourkay/kanabalt.html

Kev

It seemed to randomly speed up for a moment. Is that purposeful or is your FPS a little finicky?

The frame size is weird for me in opera, only shows about half of the game (unfortunately the right half, so you don’t even see the runner).

Worked fine in chrome, looks nice, though of course it could use being more challenging. Also, like Demonpants said, it seems to run a little choppily for some reason. Not too bad, but nonetheless.
May I ask what rendering is used? I’m thinking pre-rendering the ground shapes to images and then using those rather than rendering the entire grid each time might speed things up, but I’m not sure if you’re already doing this.

Updated:

http://dl.dropbox.com/u/1668516/fourkay/kanabalt.html

Kev

I’m getting a lot of screen tear at the moment, I’ve tried comment out blocks of rendering, other pipelines, cutting down GC and using a Canvas and Buffered/Renderering … all to no avail.

Any got time to have a look?

http://pastebin.com/r3cYL8FA

Kev

The problem is that you create a new thread, and call

 appletGraphics.drawImage(bg, 0, 0, null);

on it. In AWT/Swing nothing works properly if not called from the EDT.

It seems your years using Slick / LWJGL have made you forgot all these nice things.

For a 4K entry, you should really try to implement all your drawing and logic inside paint(g). Surely you must still use double-buffering, but it is basically what it comes down to.

Hmm, ok, but the drawImage method returns a boolean which tells you whether it’s been fully loaded or lot (which as far as I understood it was what the potential for EDT/Threading issues here. In this case it always returns true.

In the past I’d used paint() but this time I went straight off Markus’s Left4kDead which doesn’t seem to have the issue?

Kev

Have you tried a BufferStrategy with 2 or 3 back buffers? I think that’s the only way to get page-flipping which stops tearing, and even then it’s not guaranteed because the machine might not support it.

http://download.oracle.com/javase/6/docs/api/java/awt/image/BufferStrategy.html

The game looks good, i like the parallax scrolling.

That’s not true. Nothing is guaranteed to work properly if not called from the EDT, but I think all the frameworks people used last year do their rendering in the same way, outside the EDT.

Yeah, I tried the add canvas/bufferstrategy route. Painful and no changes unfortunately :frowning:

Kev

Aren’t you simply updating the image while it’s being drawn?

For debugging purposes, try to:

  1. create a new BufferedImage every frame, and draw that on the applet Graphics instance
  2. override update( g ); and put this.paint( g ); in the body.

Thats where I started with it, but it doesn’t seem to be whats happening.

I just tried 1 and 2 above, no change.

Kev

I think it’s not possible to reliably sync to the refresh rate, it’s a missing feature of java2D.

See this bug:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6378181

and this discussion:
http://www.java-gaming.org/index.php/topic,14696.0.html

I know that designers get around it by blurring their video… but that’s too much work for real time 4k games i suppose, although you guys seem to fit a lot of stuff in! :slight_smile:

Anyway, I don’t really notice the screen tear Kev, I think it looks great.

No tearing here and I’m on a Intel graphics card.
Maybe try some graphics settings like: System.setProperty(“sun.java2d.d3d”, “false”).

There seems to be a bug where you fall through the roof.

p.s 989m

This latest update put my FPS to shit. Like, 1 FPS. Unplayable.

Mac OS X 2.8 Ghz Intel Core i7, 8 GB RAM, Java 6, Safari.

Updated: http://dl.dropbox.com/u/1668516/fourkay/kanabalt.html

Think I got the bug with the roof zammbi. Unfortunately the tearing is visible on linux as well as windows but I’ll give the sun.java2d.d3d setting a go.

Cheers,

Kev