Show Posts
|
|
Pages: [1] 2
|
|
3
|
Java Game APIs & Engines / J2ME / Re: Constant Frame Rate
|
on: 2005-09-22 12:33:35
|
I use this game loop: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| inf FPS=20; int fps_delay=1000/FPS. long time=System.currentTimeMillis(),elapsed=0,fps_error=0; while (thread!=null) { elapsed=System.currentTimeMillis()-time; time=System.currentTimeMillis(); update((int)elapsed); repaint(); serviceRepaints(); try { long t=System.currentTimeMillis(); elapsed=fps_delay-(t-time)-fps_error; if (elapsed>0) { thread.sleep(elapsed); fps_error=(System.currentTimeMillis()-t)-elapsed; } else { thread.yield(); fps_error=0; } } catch (Exception ex) { } } |
I use fps_error to correct "time errors" generated by thread.sleep(), without it the framerate is a bit worse if the sleep has not so much accuracy. Maybe thread.yield() could be replaced by thread.sleep(1) to be sure it permit others threads execute, possibly we will lost some fps, but it will work better. I use it in my qames for a lot of phone models, i think it works well, but suggestions are appreciated!!  Best regards
|
|
|
|
|
11
|
Java Game APIs & Engines / J2ME / Re: TiledLayer - implementation question / suggest
|
on: 2005-02-22 09:47:28
|
|
I had done some tests in differents mobiles, and normally TiledLayer is sooo slow, only at Motorolas seems run ok. The problem is that in almost all mobiles fill the screen with small images is slow, and i suppose that TiledLayer is doing this. So its better implement a backbuffer where draw the visible tiles and redraw the tiles which change when u do scroll, so u can get almost the same speed than draw a image with same size that screen. This is, u can pass easily from 12-15 fps to 40-50 fps...
|
|
|
|
|
12
|
Java Game APIs & Engines / J2ME / Re: M3GToolkit: m3g utilities
|
on: 2005-02-01 13:02:43
|
Thanks, if u have a bit of time will be great u look and if u wish start to do some exporter 
BTW: is GPL the best licence to use ? What about a less restrictive one such as LGPL ...
Im thinking more it as application than a library, so i think GPL is a good option. The interesting is the m3g file it generate, and it can be used for commercial products too.
|
|
|
|
|
20
|
Java Game APIs & Engines / J2ME / Sharp GX15 (MIDP 2.0 without sockets!?!?)
|
on: 2004-10-28 08:24:04
|
|
Hi, im development for a Sharp GX15 (Vodafone), it has MIDP 2.0, but when i try to make a socket connection it give me this error "ConnectionNotFoundException: The request protocol not exist socket://server:port". I want know if really this mobile dont support sockets or if im doing something wrong (The code work with other mobiles)
Someone know what mobiles with MIDP2.0 has not socket connection?
Thanks.
|
|
|
|
|
28
|
Java Game APIs & Engines / J2ME / Re: Apime: open source ui framework
|
on: 2004-06-24 08:29:17
|
Hi! Thanks for the reply  Im doing it thinking in applications for mobiles like nokia 3650, 7650, 6600, and similar phones, although im trying that it have low memory cost. I have done some test with the memory monitor of WTK, and i think that the memory used is no so much, of course it depends of components created 
|
|
|
|
|
30
|
Java Game APIs & Engines / J2ME / Re: MOT V400 Full Screen
|
on: 2004-06-21 07:52:15
|
|
When are u calling the method getHeight?
At nokia phones happen something like that, but a solution is wait until the canvas is shown using the method Canvas.isShown(), and after it the size is returned ok.
I hope it helps, bye!
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|