erikd
|
 |
«
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 :-)
|
|
|
|
oNyx
|
 |
«
Reply #1 - Posted
2004-07-07 11:39:33 » |
|
Works  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  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 |
|
|
|
|
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!  DP
|
|
|
|
Games published by our own members! Check 'em out!
|
|
TheAnalogKid
|
 |
«
Reply #3 - Posted
2004-07-07 15:10:00 » |
|
Quite good!  any other roms? 
|
|
|
|
cknoll
|
 |
«
Reply #4 - Posted
2004-07-07 15:16:39 » |
|
No sound tho, is that right?
-Chris
|
|
|
|
princec
|
 |
«
Reply #5 - Posted
2004-07-07 16:17:17 » |
|
no sound here either but, wow! It's a great bit of code. Cas 
|
|
|
|
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!  DP
|
|
|
|
|
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!
|
|
|
|
oNyx
|
 |
«
Reply #9 - Posted
2004-07-08 02:47:22 » |
|
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!  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").
|
|
|
|
Games published by our own members! Check 'em out!
|
|
princec
|
 |
«
Reply #10 - Posted
2004-07-08 07:37:49 » |
|
Ought to use our new Display.sync() method... grumble grumble... Cas 
|
|
|
|
oNyx
|
 |
«
Reply #11 - Posted
2004-07-08 08:36:46 » |
|
Ought to use our new Display.sync() method... grumble grumble... My sync2 method works nicer  You haven't really tried it, have you?
|
|
|
|
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
|
|
|
|
princec
|
 |
«
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 
|
|
|
|
oNyx
|
 |
«
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.
|
|
|
|
erikd
|
 |
«
Reply #15 - Posted
2004-07-08 13:17:08 » |
|
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?
|
|
|
|
oNyx
|
 |
«
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  Just the usual fair deal - if you find a way to improve it let us know  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=1087392059The application (src - lwjgl 0.9 official): http://people.freenet.de/ki_onyx/SyncTest.zipusage: 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.
|
|
|
|
erikd
|
 |
«
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  (note that only mspacman and galaga have sound as for now). So let jws do its magic and update it for you  Erik
|
|
|
|
princec
|
 |
«
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 
|
|
|
|
erikd
|
 |
«
Reply #19 - Posted
2004-07-09 10:01:55 » |
|
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. Sound is still totally b0rked. As in 'completely silent', or strange timing? Any errors in the log?
|
|
|
|
erikd
|
 |
«
Reply #20 - Posted
2004-07-09 10:19:01 » |
|
F12 toggles VSync, F11 toggles throttling 
|
|
|
|
Foobarth
Senior Newbie 
wannabe game developer
|
 |
«
Reply #21 - Posted
2004-07-09 10:51:45 » |
|
The speed works properly for me now. Very cool.
|
|
|
|
princec
|
 |
«
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 
|
|
|
|
oNyx
|
 |
«
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)?
|
|
|
|
princec
|
 |
«
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 
|
|
|
|
erikd
|
 |
«
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  . 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.
|
|
|
|
erikd
|
 |
«
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  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.
|
|
|
|
erikd
|
 |
«
Reply #27 - Posted
2004-07-11 11:30:21 » |
|
Oh, BTW Solomon's Key should have sound now too 
|
|
|
|
Matzon
|
 |
«
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  Now if it only had sound...  Did you gain any performance from using LWJGL ?
|
|
|
|
erikd
|
 |
«
Reply #29 - Posted
2004-07-11 14:11:24 » |
|
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 
|
|
|
|
|