CottAGE goes LWJGL/JWS

I dusted off my old project to use LWJGL for rendering. It was actually quite easy (most work was to get the damn thing to work with web start). I renamed the project to JEmu2 (JEmu was the predecessor of CottAGE).

There are currently 2 games online, 1943 kai (http://www.movegaga.nl/80s/jemu_1943kai.php) and Ms.Pacman (http://www.movegaga.nl/80s/jemu_mspacman.php).

I expect problems on linux since I rely on being able to select 60Hz modes in order to use VSync. It might still work but probably not smooth or at the wrong speed.
Mac will most likely have the LWJGL/WebStart issue, so Mac users must expect to be only be able to watch the attract mode (if it works at all).

Enjoy :slight_smile:

Works :slight_smile:

5=coin
1=start
ctrl=fire

(I think)

Btw win9x also says 0z for all modes.

Oh and since you are using php… it’s a shared server right? Well, you might give htaccess a try - it’s highly possible that you can use that :wink:

Just put a file called “.htaccess” into the root dir (http://www.movegaga.nl) if it isn’t already there and put the following line of text into it:

AddType application/x-java-jnlp-file .jnlp

awsome, haven’t had this much fun on a game for ages! ;D

DP

Quite good! :wink:

any other roms? ;D

No sound tho, is that right?

-Chris

no sound here either but, wow! It’s a great bit of code.

Cas :slight_smile:

i did see some initing of javasound? am I correct there? But no sound there either.

PS, Ms. Pacman is HARD! I haven’t played it in a long time, and frankly, i sucked! :slight_smile:

DP

Ms.Pacman should have sound ???, although it still suffers from the bad sound code (synchronization issues). Any exceptions or errors or something? On what hw is this?
1943 has a soundchip that is not supported yet so that one shouldn’t have sound.


5=coin 
1=start 
ctrl=fire

(I think)

Yeah, [space] is the other button for 1943.

any other roms?  

Who needs other roms when you have ms.pacman? ;D

oh well:
Black Tiger: http://www.movegaga.nl/80s/jemu_blktiger.php
Space Invaders: http://www.movegaga.nl/80s/jemu_invaders.php
Galaga: http://www.movegaga.nl/80s/jemu_galaga.php
Solomon’s Key: http://www.movegaga.nl/80s/jemu_solomon.php

(Galaga has a problem where you can’t start another game when the game is over. Probably a bug in the z80 emulator…)

I also updated the emulator to display a bit larger.

Thanks for the comments everybody :slight_smile:

Erik

The games all seem to run too fast on my laptop. Is it a refresh rate issue?

thanks!

[quote]The games all seem to run too fast on my laptop. Is it a refresh rate issue?

thanks!
[/quote]
Read at least the initial post completely.

Thanks! :stuck_out_tongue:

However, enabling vsync is just a try and you can’t tell if it’s really on or off (ok you can with nvidia but you can’t with ati or anything else). So check in your driver settings if vsync is set to “always off”. If so, set it to “default off”, “default on” or “always on” (basically everything else than “always off”).

Ought to use our new Display.sync() method… grumble grumble…

Cas :slight_smile:

[quote]Ought to use our new Display.sync() method… grumble grumble…
[/quote]
My sync2 method works nicer :stuck_out_tongue:

You haven’t really tried it, have you?

Are the screens supposed to only show blue/green coloured sprites or am i just forgetting the size of the colour palette on the zx80?

No sound here either, animation was smooth and at a good speed.

All the normal Mac/Webstart/LWJGL problems occured (dead mouse…)

Sys: OS X 10.3.4, Java 1.4.2_04 DP3, 1.5Ghz G4

ok, post that sync method up and I’ll put it into our Display sync and we’ll see if it makes Super Elvis better on Chaz’s crap machine (he only gets 30Hz!!)

Cas :slight_smile:


private static long timeNow, timeThen, timeLate=0;
[...]
public static void sync2(long fps)
{
      long gapTo = Sys.getTimerResolution() / fps + timeThen;
      timeNow = Sys.getTime();

      while(gapTo > timeNow+timeLate)
      {
            Thread.yield();
            timeNow = Sys.getTime();
      }

      if(gapTo<timeNow)
            timeLate = timeNow-gapTo;
      else
            timeLate = 0;

      timeThen = timeNow;
}

Under low cpu usage it performs equally well and under heavy cpu load it performs better [sync2(hz+1);].

edit:

It only makes a noticeable difference if the machine can deliver most of the frames in time (when it just meets your system requirements). Eg at 75hz and some load you get 72-73fps with the old method and with this one you get 75fps in most cases and sometimes 74fps.

Oh and feel free to add the +1 directly to the method.

[quote]Are the screens supposed to only show blue/green coloured sprites or am i just forgetting the size of the colour palette on the zx80?

No sound here either, animation was smooth and at a good speed.

All the normal Mac/Webstart/LWJGL problems occured (dead mouse…)

Sys: OS X 10.3.4, Java 1.4.2_04 DP3, 1.5Ghz G4
[/quote]
Thanks for the report that it works :slight_smile:
If you download the jars manually, you might have correct input too.

B.T.W. It’s not a zx80 that’s being emulated (a zx80 is only B/W), but the original arcade machines and yes, ms.pacman has only a few colors (32 IIRC).

@Onyx: Do you mind if I use your throttling code for now?

Do you mind if I use your throttling code for now?

Not at all. It’s free as in beer :slight_smile:

Just the usual fair deal - if you find a way to improve it let us know :wink:

edit:

Btw I’d written a test application one morning.

The thread:
http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=LWJGL;action=display;num=1087392059

The application (src - lwjgl 0.9 official):

usage:
java SyncTest [hz]

eg:
java -cp .;lwjgl.jar SyncTest 2 15 10 75

Hz itself isn’t set (I don’t pick the appropriate mode, because they are all 0hz on my machine). If it’s unable to detect it (if omitted) it will just guess that it’s 60.

The things you can do in the application are explained in the programm itself.

Hi all,

I updated the emulator with proper speed throttling (thanks onyx & princec). Also, the sound code was updated. The sound is now almost 100% perfect :smiley:
(note that only mspacman and galaga have sound as for now).
So let jws do its magic and update it for you :slight_smile:

Erik

I get the same strange timing bug as Kev Glasse’s space invaders tutorial. Fast-slow-fast-slow. This in on my HT-laptop. Sound is still totally b0rked.

Cas :slight_smile:

[quote]I get the same strange timing bug as Kev Glasse’s space invaders tutorial. Fast-slow-fast-slow.
[/quote]
That’s probably because I use VSync. I’ll try to put an option in there to disable it.

[quote]Sound is still totally b0rked.
[/quote]
As in ‘completely silent’, or strange timing? Any errors in the log?