Show Posts
|
|
Pages: [1]
|
|
5
|
Game Development / Newbie & Debugging Questions / Re: Timer and ticks and should I be shot?
|
on: 2005-01-21 02:30:14
|
This is the loop I'm currently using: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| long nextCheck = System.nanoTime() + 1000000000; int fpsCount = 0; int fps = 0;
while(true) { nanoTime = System.nanoTime();
if(nanoTime >= nextCheck) { nextCheck = nanoTime + 1000000000; fps = fpsCount; fpsCount = 0; }
fpsCount++;
tick(); while(System.nanoTime() < nanoTime + (1000000000 / targetFPS)) { Thread.yield(); } } |
Where targetFPS would be 30 
|
|
|
|
|
6
|
Game Development / Newbie & Debugging Questions / Re: Timer and ticks and should I be shot?
|
on: 2005-01-21 01:53:16
|
|
I'm a bit confused. Is this in a loop? I ran it like such anyway, and it doesn't seem to be a controlled loop. It will just call logicLoop() as much as it can, rather than 30 times a second (so I'm guessing I'm doing something wrong).
Sorry if I'm misunderstanding you, if I am, can you be a little clearer of what you want it to do?
|
|
|
|
|
8
|
Java Game APIs & Engines / Java 2D / Re: Color Keying and Bitmap Fonts
|
on: 2005-01-13 20:31:27
|
Hmm, I just had a thought. Could I just call bufferedImage.getGraphics() and replace all the white pixels with another color by using drawLine(x, y, x, y)? Would this be an acceptable solution? Or at least be more efficient than copying the entire BufferedImage into another one? Obviously I couldn't use this technique for replacing pixels so that they're transparent, but I don't even need that. Don't tell me if I call getRGB(x, y) my image won't be accelerated anymore 
|
|
|
|
|
11
|
Java Game APIs & Engines / Java 2D / Re: Low-level exception when dealing with Fullscre
|
on: 2005-01-12 22:44:41
|
I think I may have found out why my code crashed all the time. I ran some other fullscreen programs, and they ran just fine. So I tested my app further to see what the problem was. I was creating a class called "Surface" and right after I called createBufferStrategy(2), I saved a reference of the Graphics object in the Surface class. Constructing it like: Surface screen = new Surface(bufferStrategy.getDrawGraphics()); Then I would use "screen" to do all my drawing. I now changed my code to call getDrawGraphics() every loop, and after I'm done using the Graphics object for one loop, I dispose of it. My program hasn't crashed yet, so this may have fixed the problem. Does this make sense to anybody? I'm wondering what the difference is. Well, now I have to make quite a few design changes because of this... but as long as it's working now, I'm happy 
|
|
|
|
|
12
|
Java Game APIs & Engines / Java 2D / Color Keying and Bitmap Fonts
|
on: 2005-01-12 01:25:23
|
I can create bitmap fonts just fine, but I'd like to have bitmap fonts of different colors. In my image file the characters are white, and I want to replace the white color with any color of my choice. The problem is that I don't even know if there's a way to do this while maintaining hardware acceleration. I searched some older posts but I found no hardware accelerated versions. Is there a way to do it? Also, just a side question. In order for images to be accelerated, they must not exceed 65536 bytes. Is there any advantage to making images squares? An image that's 128x128 vs. 256x64... should I expect any difference in performance? Thanks a lot 
|
|
|
|
|
15
|
Java Game APIs & Engines / Java 2D / Low-level exception when dealing with Fullscreen
|
on: 2005-01-09 07:55:05
|
When I start up my game, there's about a 30% chance it abruptly crashes. I see a white full screen window at 640x480, then it just exits with this error: 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
| # # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d0b5f87, pid=2288, tid=2296 # # Java VM: Java HotSpot(TM) Client VM (1.5.0-b64 mixed mode, sharing) # Problematic frame: # C [awt.dll+0xb5f87] #
--------------- T H R E A D ---------------
Current thread (0x00035de0): JavaThread "main" [_thread_in_native, id=2296]
siginfo: ExceptionCode=0xc0000005, reading address 0x017afe65
Registers: EAX=0x0007f8a4, EBX=0x00000001, ECX=0x017afe65, EDX=0x0007f928 ESP=0x0007f890, EBP=0x0007f978, ESI=0x0ae04540, EDI=0x0007f928 EIP=0x6d0b5f87, EFLAGS=0x00010246
Top of Stack: (sp=0x0007f890) 0x0007f890: 01000400 0007f8a4 00035e9c 0007f99c 0x0007f8a0: 2b394928 00000064 00035e9c 0007f99c 0x0007f8b0: 00000062 00035e9c 00035e9c 0007f99c 0x0007f8c0: 0007f8b4 00035e9c 0007fbb8 6d759f8a 0x0007f8d0: 6d764a90 ffffffff 0007f978 6d03423c 0x0007f8e0: 00035e9c 0007f99c 00000062 00035e9c 0x0007f8f0: 0007f99c ff000000 6d0342b7 00035e9c 0x0007f900: 0007f99c 00000000 6d0af2d6 00035e9c
Instructions: (pc=0x6d0b5f87) 0x6d0b5f77: 8b 8e a8 00 00 00 8d 44 24 0c 50 68 00 04 00 01 0x6d0b5f87: 8b 11 6a 00 6a 00 57 ff 52 20 3d c2 01 76 88 7f
Stack: [0x00040000,0x00080000), sp=0x0007f890, free space=254k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [awt.dll+0xb5f87] j sun.awt.windows.Win32DDRenderer.fillRect(Lsun/java2d/SunGraphics2D;IIII)V+146 j sun.java2d.pipe.ValidatePipe.fillRect(Lsun/java2d/SunGraphics2D;IIII)V+19 j sun.java2d.SunGraphics2D.fillRect(IIII)V+10 j scepter.engine.graphics.Surface.clear()V+22 j scepter.engine.GameEngine.start()V+81 j scepter.Scepter.main([Ljava/lang/String;)V+3 v ~StubRoutines::call_stub V [jvm.dll+0x8168d] V [jvm.dll+0xd4179] V [jvm.dll+0x8155e] V [jvm.dll+0x8844c] C [java.exe+0x14c0] C [java.exe+0x64cd] C [kernel32.dll+0x2141a]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j sun.awt.windows.Win32DDRenderer.doFillRectDD(Lsun/java2d/SurfaceData;IIIII)V+0 j sun.awt.windows.Win32DDRenderer.fillRect(Lsun/java2d/SunGraphics2D;IIII)V+146 j sun.java2d.pipe.ValidatePipe.fillRect(Lsun/java2d/SunGraphics2D;IIII)V+19 j sun.java2d.SunGraphics2D.fillRect(IIII)V+10 j scepter.engine.graphics.Surface.clear()V+22 j scepter.engine.GameEngine.start()V+81 j scepter.Scepter.main([Ljava/lang/String;)V+3 v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread ) 0x0ae02150 JavaThread "Direct Clip" daemon [_thread_blocked, id=3588] 0x0ae01cd0 JavaThread "Direct Clip" daemon [_thread_blocked, id=3332] 0x00acfde0 JavaThread "Java Sound Sequencer" [_thread_blocked, id=3484] 0x0add49b0 JavaThread "Headspace mixer frame proc thread" daemon [_thread_blocked, id=2216] 0x00accab8 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=1652] 0x00acc7f8 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=2940] 0x00ac0d88 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=3700] 0x00abbd60 JavaThread "AWT-Windows" daemon [_thread_in_native, id=2924] 0x00abb930 JavaThread "AWT-Shutdown" [_thread_blocked, id=956] 0x00aba6c0 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=1604] 0x00a6bc80 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=3220] 0x00a6a858 JavaThread "CompilerThread0" daemon [_thread_blocked, id=2872] 0x00a69b00 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=800] 0x00a45ee0 JavaThread "Finalizer" daemon [_thread_blocked, id=2852] 0x0003fa00 JavaThread "Reference Handler" daemon [_thread_blocked, id=492] =>0x00035de0 JavaThread "main" [_thread_in_native, id=2296]
Other Threads: 0x00a67150 VMThread [id=2380] 0x00a6ce90 WatcherThread [id=2408]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap def new generation total 576K, used 6K [0x22a60000, 0x22b00000, 0x22f40000) eden space 512K, 1% used [0x22a60000, 0x22a61880, 0x22ae0000) from space 64K, 0% used [0x22ae0000, 0x22ae0000, 0x22af0000) to space 64K, 0% used [0x22af0000, 0x22af0000, 0x22b00000) tenured generation total 4612K, used 3967K [0x22f40000, 0x233c1000, 0x26a60000) the space 4612K, 86% used [0x22f40000, 0x2331fc58, 0x2331fe00, 0x233c1000) compacting perm gen total 8192K, used 719K [0x26a60000, 0x27260000, 0x2aa60000) the space 8192K, 8% used [0x26a60000, 0x26b13f28, 0x26b14000, 0x27260000) ro space 8192K, 66% used [0x2aa60000, 0x2afb7960, 0x2afb7a00, 0x2b260000) rw space 12288K, 46% used [0x2b260000, 0x2b7f43a8, 0x2b7f4400, 0x2be60000)
Dynamic libraries: 0x00400000 - 0x0040c000 C:\Program Files\Java\jdk1.5.0\bin\java.exe 0x77f50000 - 0x77ff7000 C:\WINDOWS\System32\ntdll.dll 0x77e60000 - 0x77f46000 C:\WINDOWS\system32\kernel32.dll 0x77dd0000 - 0x77e5d000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78087000 C:\WINDOWS\system32\RPCRT4.dll 0x77c10000 - 0x77c63000 C:\WINDOWS\system32\MSVCRT.dll 0x6d640000 - 0x6d7c5000 C:\Program Files\Java\jdk1.5.0\jre\bin\client\jvm.dll 0x77d40000 - 0x77dcc000 C:\WINDOWS\system32\USER32.dll 0x7f000000 - 0x7f041000 C:\WINDOWS\system32\GDI32.dll 0x76b40000 - 0x76b6c000 C:\WINDOWS\System32\WINMM.dll 0x6d280000 - 0x6d288000 C:\Program Files\Java\jdk1.5.0\jre\bin\hpi.dll 0x76bf0000 - 0x76bfb000 C:\WINDOWS\System32\PSAPI.DLL 0x6d610000 - 0x6d61c000 C:\Program Files\Java\jdk1.5.0\jre\bin\verify.dll 0x6d300000 - 0x6d31d000 C:\Program Files\Java\jdk1.5.0\jre\bin\java.dll 0x6d630000 - 0x6d63f000 C:\Program Files\Java\jdk1.5.0\jre\bin\zip.dll 0x6d000000 - 0x6d166000 C:\Program Files\Java\jdk1.5.0\jre\bin\awt.dll 0x73000000 - 0x73023000 C:\WINDOWS\System32\WINSPOOL.DRV 0x76390000 - 0x763ac000 C:\WINDOWS\System32\IMM32.dll 0x771b0000 - 0x772d4000 C:\WINDOWS\system32\ole32.dll 0x5ad70000 - 0x5ada4000 C:\WINDOWS\System32\uxtheme.dll 0x51000000 - 0x51049000 C:\WINDOWS\System32\ddraw.dll 0x73bc0000 - 0x73bc6000 C:\WINDOWS\System32\DCIMAN32.dll 0x5c000000 - 0x5c0c8000 C:\WINDOWS\System32\D3DIM700.DLL 0x6d240000 - 0x6d27d000 C:\Program Files\Java\jdk1.5.0\jre\bin\fontmanager.dll 0x10000000 - 0x10007000 C:\Program Files\Logitech\MouseWare\System\LgWndHk.dll 0x02dc0000 - 0x02dcb000 C:\Program Files\Common Files\Logitech\Scrolling\LgMsgHk.dll 0x55900000 - 0x55961000 C:\WINDOWS\System32\MSVCP60.dll 0x6d190000 - 0x6d1bf000 C:\Program Files\Java\jdk1.5.0\jre\bin\cmm.dll 0x6d3c0000 - 0x6d3df000 C:\Program Files\Java\jdk1.5.0\jre\bin\jpeg.dll 0x6d470000 - 0x6d495000 C:\Program Files\Java\jdk1.5.0\jre\bin\jsound.dll 0x6d4a0000 - 0x6d4a7000 C:\Program Files\Java\jdk1.5.0\jre\bin\jsoundds.dll 0x51080000 - 0x510dd000 C:\WINDOWS\System32\DSOUND.dll 0x77c00000 - 0x77c07000 C:\WINDOWS\system32\VERSION.dll 0x72d20000 - 0x72d29000 C:\WINDOWS\System32\wdmaud.drv 0x72d10000 - 0x72d18000 C:\WINDOWS\System32\msacm32.drv 0x77be0000 - 0x77bf4000 C:\WINDOWS\System32\MSACM32.dll 0x77bd0000 - 0x77bd7000 C:\WINDOWS\System32\midimap.dll 0x5ef80000 - 0x5ef84000 C:\WINDOWS\System32\KsUser.dll
VM Arguments: java_command: scepter.Scepter
Environment Variables: PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\MinGW\bin;C:\Program Files\Java\jdk1.5.0\bin USERNAME=Jason OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 6 Model 10 Stepping 0, AuthenticAMD
--------------- S Y S T E M ---------------
OS: Windows XP Build 2600 Service Pack 1
CPU:total 1 family 6, cmov, cx8, fxsr, mmx, sse
Memory: 4k page, physical 523764k(174940k free), swap 1280332k(974092k free)
vm_info: Java HotSpot(TM) Client VM (1.5.0-b64) for windows-x86, built on Sep 15 2004 03:00:31 by "java_re" with MS VC++ 6.0 |
This only occurs in fullscreen mode and not windowed. It crashes at the first drawing function I attempt to call, which is simply g.fillRect(0, 0, 640, 480); The problem code is a simplified version this: frame.createBufferStrategy(2); // then call getDrawGraphics() and use this to call fillRect Adding a sleep() between those two statements seems to fix everything. Even a Thread.sleep(0). I've heard of similar things happening to people before, but this is the first time it's happened to me. Is my "solution" the only option I have? Is this a known bug, because I thought it was fixed by 1.5? I don't know, maybe it's my code afterall, I just don't see it. Anyway, thanks for any explanations.
|
|
|
|
|
18
|
Games Center / Archived Projects / Re: Simple First Game
|
on: 2003-03-20 03:45:43
|
Um, I am running linux and it said my system does not meet the requirements. Just wondering why this is the case. That's probably because linux does not have support to go into full screen mode. Sorry about that, I should probably just allow linux users to get into windowed-mode :-/ Thanks for the other comments and suggestions too. My design is seriously flawed right now and I don't plan on changing anything until 1.5 (when keyboard/mouse polling exist, and for many other reaons) or if I decide to use LWJGL instead. But I will add most of the ideas suggested when I redesign it, and hopefully I can add the ability to submit high scores online 
|
|
|
|
|
21
|
Games Center / Archived Projects / Re: New version of my racegame
|
on: 2003-03-12 20:22:22
|
Well, the odd thing is that I have that problem a lot with your games  If you could send me the source I can maybe help identifying the problem. (My email addy is in my profile) Greetings, Erik Well, I only had one game... I just found it odd that strueli's game crashed exactly in the same fashion, and only you seem to have experienced an unexpected exit without an exception  Anyway, if you wanted to look at the source, it's in the jar file: http://www.saber-x.com/midgarddesign/code/ii.jar
|
|
|
|
|
22
|
Games Center / Archived Projects / Re: New version of my racegame
|
on: 2003-03-11 20:26:05
|
It didn't work for me. It briefly entered fullscreen but then immediately exits. No exception, it just outputs 'ok' in the console. :-/ (win2k, 192Mb, jre1.4.1, intel 82815 video) You seem to be having that problem a lot  Immediately exiting without an exception is really weird :-/
|
|
|
|
|
23
|
Discussions / Miscellaneous Topics / Re: The story with String literals?
|
on: 2003-03-04 03:39:30
|
I don't mean to hijack ericd's thread but since we have an answer to that I'd like to extend the thread by asking:
When is it desireable to use String.intern();?
I've never found it useful myself, but maybe if you want to speed up performance if you have a high number of String comparisons over creation of Strings. You'd gain efficiency checking if the references are equal rather than checking the contents of the String.
|
|
|
|
|
24
|
Games Center / Archived Projects / Re: Simple First Game
|
on: 2003-02-28 20:55:51
|
No, there's no exception. It just exits. :-/ I'll see if I can come up with something... Wow, that's not good :-/ Not even a native error, this doesn't happen with other full screen java apps does it? Now this is really going to bother me  Anyway, thanks for letting me know. Maybe I'll switch to using LWJGL sometime (if I ever get around to learning OpenGL).
|
|
|
|
|
27
|
Games Center / Archived Projects / Re: Simple First Game
|
on: 2003-02-26 17:47:48
|
Thanks for the suggestions, I'll be on that. You're right about the replay value, I'll have to work on that as well. I'm pretty sure I know what's causing that exception cfmdobbie, thanks, I'll look into it. erikd, on the other hand, I have no idea what is causing the program to spontaneously exit. If you could run it at the command line and let me know what the exception (if any) is, I'd really appreciate it. That one is going to bother me until I fix it 
|
|
|
|
|
28
|
Games Center / Archived Projects / Simple First Game
|
on: 2003-02-25 20:41:52
|
This isn't big, complex, or anything, just wanted some feedback. It's just an executable jar with the source code included inside: http://www.saber-x.com/midgarddesign/code/ii.jar (159 kb) This was more of a design thing, I'm not sure if I like the way I approached everything. I wanted to start simple and continue on up, otherwise maybe I have some redesigning to do  Critiques are always appreciated. Inspired by missionred (for those who know what that is). All you have to do is click on the targets to destroy them and let your mouse speed to the rest. Thanks.
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|