|
Author |
Topic: TileMapRenderer (Read 4596 times) |
|
arielm
|
Re: TileMapRenderer
« Reply #15 on: Aug 2nd, 2004, 11:03pm » |
|
well, "at the end of the day" in processing: everything is copied to pixels[], which at the end of loop() is dumped to the screen using a MemoryImageSource and Graphics.drawImage() this is what's called double buffering so... using an additional buffer image is in most cases overkill/uneficient etc. the "tearing" issue mentioned by andre is maybe due to the fact that he's not accessing pixels[] from within the same thread as loop(), e.g. - during a keyboard or mouse event - or (worst case ever): using a TimerTask or something similiar...
|
Ariel Malka | www.chronotext.org
|
|
|
arielm
|
Re: TileMapRenderer
« Reply #16 on: Aug 4th, 2004, 12:48am » |
|
indeed, some sort of tearing can occur even when using kosher processing code based on loop(): it's because java 1.1 don't have a standard mechanism for vsync'ing (except on macs i think)
|
Ariel Malka | www.chronotext.org
|
|
|
arielm
|
Re: TileMapRenderer
« Reply #18 on: Aug 4th, 2004, 5:38pm » |
|
hey, getting closer (btw, 360 * 280 is about 1/3 of 640x480) a note concerning fps measurement on windows, where java's timer accuracy is pretty low, as follows: on win9x: 18 ticks per second (resolution of 55.55 ms) on win2K/XP: 100 ticks per second (resolution of 10 ms) on win2K/XP with HyperThreaded or Dual Processor: 64 ticks per second (resolution of 15.625 ms) now, at the high framerate we're interested in, standard time-measurement methods are not accurate at all. but... it's possible to get a very close approximation using the following patent: // global variables long t0; int globalFrameCount; // at the end of setup() globalFrameCount = 0; t0 = System.currentTimeMillis(); // inside your "main loop" globalFrameCount++; long t1 = System.currentTimeMillis(); float averageFPS = (1000.0f / ((t1 - t0) / (float) globalFrameCount))); (averageFPS is what you want to display) basically, what makes the difference is that now, you always compare timer differences based on the "first" frame (i.e. not the "last" frame...) hth
|
« Last Edit: Aug 4th, 2004, 5:43pm by arielm » |
|
Ariel Malka | www.chronotext.org
|
|
|
Andre_Michelle
|
Re: TileMapRenderer
« Reply #19 on: Aug 4th, 2004, 6:47pm » |
|
http://www.andre-michelle.com/files/temp/ptile/ 640x430px (>200fps). I can't make it higher, cause the map is only 430 high. nice. The question is now, how to get a stabil framerate without any gaps and sync error while scrolling. I think 50 fps should bring the finished game which lot of other tasks to machines over 600 MHz... lets see.
|
|
|
|
|