Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (541)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2 3
  ignore  |  Print  
  CottAGE goes LWJGL/JWS  (Read 12300 times)
0 Members and 1 Guest are viewing this topic.
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Posted 2004-07-07 10:47:24 »

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 :-)

Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #1 - Posted 2004-07-07 11:39:33 »

Works Smiley

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:
1  
AddType application/x-java-jnlp-file .jnlp

弾幕 ☆ @mahonnaiseblog
Offline darkprophet

Senior Devvie




Go Go Gadget Arms


« Reply #2 - Posted 2004-07-07 14:26:22 »

awsome, haven't had this much fun on a game for ages!  Grin

DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline TheAnalogKid

JGO Coder


Projects: 2



« Reply #3 - Posted 2004-07-07 15:10:00 »

Quite good!  Wink

any other roms?  Grin

Offline cknoll

Junior Devvie




Flame On!


« Reply #4 - Posted 2004-07-07 15:16:39 »

No sound tho, is that right?

-Chris
Offline princec

« JGO Spiffy Duke »


Medals: 439
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2004-07-07 16:17:17 »

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

Cas Smiley

Offline darkprophet

Senior Devvie




Go Go Gadget Arms


« Reply #6 - Posted 2004-07-07 17:34:45 »

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!  Smiley

DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #7 - Posted 2004-07-07 22:20:36 »

Ms.Pacman should have sound Huh, 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.

1  
2  
3  
4  
5  
5=coin 
1=start
ctrl=fire

(I think)

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

1  
any other roms?  

Who needs other roms when you have ms.pacman?  Grin

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 :-)

Erik

Offline Foobarth

Senior Newbie




wannabe game developer


« Reply #8 - Posted 2004-07-08 01:22:42 »

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

thanks!
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #9 - Posted 2004-07-08 02:47:22 »

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

thanks!


Read at least the initial post completely.

Thanks! 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").

弾幕 ☆ @mahonnaiseblog
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline princec

« JGO Spiffy Duke »


Medals: 439
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #10 - Posted 2004-07-08 07:37:49 »

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

Cas Smiley

Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #11 - Posted 2004-07-08 08:36:46 »

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


My sync2 method works nicer Tongue

You haven't really tried it, have you?

弾幕 ☆ @mahonnaiseblog
Offline ribot

Junior Devvie




Ribot - mobile UI specialist


« Reply #12 - Posted 2004-07-08 09:54:25 »

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

http://ribot.co.uk - design agency focused on mobile
http://www.retrospecs.co.uk - online vintage eyewear store
Offline princec

« JGO Spiffy Duke »


Medals: 439
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #13 - Posted 2004-07-08 10:43:03 »

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 Smiley

Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #14 - Posted 2004-07-08 11:57:19 »

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
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.

弾幕 ☆ @mahonnaiseblog
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #15 - Posted 2004-07-08 13:17:08 »

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


Thanks for the report that it works :-)
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?

Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #16 - Posted 2004-07-08 14:30:00 »

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

Not at all. It's free as in beer Smiley

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):
http://people.freenet.de/ki_onyx/SyncTest.zip

usage:
java SyncTest <usual payload in msec> <spike payload in msec> <spike every x frames> [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.

弾幕 ☆ @mahonnaiseblog
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #17 - Posted 2004-07-08 19:26:01 »

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  Cheesy
(note that only mspacman and galaga have sound as for now).
So let jws do its magic and update it for you  Smiley

Erik

Offline princec

« JGO Spiffy Duke »


Medals: 439
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #18 - Posted 2004-07-09 09:23:42 »

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 Smiley

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #19 - Posted 2004-07-09 10:01:55 »

Quote
I get the same strange timing bug as Kev Glasse's space invaders tutorial. Fast-slow-fast-slow.


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.


As in 'completely silent', or strange timing? Any errors in the log?

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #20 - Posted 2004-07-09 10:19:01 »

F12 toggles VSync, F11 toggles throttling  Smiley

Offline Foobarth

Senior Newbie




wannabe game developer


« Reply #21 - Posted 2004-07-09 10:51:45 »

The speed works properly for me now.  Very cool.
Offline princec

« JGO Spiffy Duke »


Medals: 439
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #22 - Posted 2004-07-09 11:03:38 »

But I use vysnc in my games too! And onyx's sync2 code, now, as well. And I'm not getting this problem :/

Cas Smiley

Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #23 - Posted 2004-07-09 12:23:39 »

Eventually it's that timer resolution thing?

I call Sys.getTimerResolution() in my capping code just each time... therefore it should be ok, right?

Maybe he calls it only once at the beginning (or too irregularly/rarely)?

弾幕 ☆ @mahonnaiseblog
Offline princec

« JGO Spiffy Duke »


Medals: 439
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #24 - Posted 2004-07-09 14:58:02 »

Could be it. All my code frequently requeries the resolution. The LWJGL timer code in CVS now does this as well.

Broken sound is akin to a man with a chainsaw trying to cut a live pig in half next to my ear while I have a hangover. Had to quit to avoid permanent brain damage.

Cas Smiley

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #25 - Posted 2004-07-09 23:39:44 »

I throttle to the speed of the original arcade, which is 60Hz most of the time. When VSync is switched on too (which it is at startup) and your display runs at another frequency or something, I can imagine the fast-slow speed you describe.
So press either F12 for the correct speed, or F11 for a smooth (if too slow) display.
Maybe I need to set the default vsync/throttling settings based on the video mode being chosen...

I'll try to find another way to fix the sound. Sound is almost 100% perfect here, but apparently causing braindamage and pigs being slaughtered elsewhere Smiley. I tried to 'fix' the sound by putting a small sleep in the loop of the sound thread so that the main thread gets more time to regularly send sound commands to the sound thread. Maybe I need to make the sound thread sleep only if the buffer is sufficiently filled.

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #26 - Posted 2004-07-11 11:25:09 »

I updated the sound code and removed the multithreaded nature of it. It works much better now, for me anyway. I hope it doesn't cause braindamage now  Smiley

Also, at startup vsync is enabled when a video mode could be selected with the same refresh rate of the original arcade. Otherwise, throttling is used (you can still use F11 and F12 to toggle vsync and throttling).
Beware that the sound code now relies on the emulator running at the correct speed, otherwise buffer underruns might occur or more laggy sound.

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #27 - Posted 2004-07-11 11:30:21 »

Oh, BTW Solomon's Key should have sound now too  Cheesy

Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #28 - Posted 2004-07-11 12:34:13 »

wow - excellent!
And may I just point *everybody* to Black Tiger - the only arcade game I could complete using 1 credit, and which also happens to be one of the best arcade games ever Grin
Now if it only had sound... Kiss

Did you gain any performance from using LWJGL ?

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #29 - Posted 2004-07-11 14:11:24 »

Quote
Did you gain any performance from using LWJGL ?


All rendering is still done inside the CPU. Only the final frame is rendered using LWJGL, so there not really a speed gain I'm afraid.
What I did gain is better timing and better display quality (getting a zoomed and filtered display for free).
It should be possible to completely render everything using LWJGL, but that will require a large rewrite.

And yeah, Black Tiger is very cool but I can't get past one point where I have to get up on platform that I can't reach  Embarrassed

Pages: [1] 2 3
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Mr.CodeIt (10 views)
2014-12-27 04:03:04

TheDudeFromCI (13 views)
2014-12-27 02:14:49

Mr.CodeIt (25 views)
2014-12-23 03:34:11

rwatson462 (56 views)
2014-12-15 09:26:44

Mr.CodeIt (46 views)
2014-12-14 19:50:38

BurntPizza (92 views)
2014-12-09 22:41:13

BurntPizza (113 views)
2014-12-08 04:46:31

JscottyBieshaar (83 views)
2014-12-05 12:39:02

SHC (94 views)
2014-12-03 16:27:13

CopyableCougar4 (102 views)
2014-11-29 21:32:03
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org 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‑gaming.org
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!