Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (808)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (872)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: 1 ... 5 6 [7]
181  Game Development / Networking & Multiplayer / My Server doesn't work remotely. on: 2008-12-16 04:20:46
I need my server to work remotely, but it just doesn't connect. I've tried it on a lot of computers. I got a Dynamic IP, but I use No-IP to change it every 5 minutes. I've portforwarded my needed ports, and disabled all firewalls. It still doesn't connect.

It does, however, work my my computer which I am hosting the server on.

Please help me.
182  Games Center / 4K Game Competition - 2009 / Re: Jetp4k on: 2008-12-15 23:02:50
Nice, but on the balls level, the balls stop when they hit the platforms. (bounce back and forth and don't move).
183  Game Development / Newbie & Debugging Questions / Re: How do you split a string? on: 2008-12-15 22:36:16
Smiley I just guessed, because you didn't want to use java.awt.font...

I would use it if I knew how... The JavaDocs don't show enough information...
184  Game Development / Newbie & Debugging Questions / Re: WTF? on: 2008-12-15 22:33:05
Here is my computer system info


---------------  S Y S T E M  ---------------

OS: Windows Vista Build 6001 Service Pack 1

CPU:total 2 (2 cores per cpu, 1 threads per core) family 17 model 3 stepping 1, cmov, cx8, fxsr, mmx, sse, sse2, sse3, mmxext, 3dnow, 3dnowext

Memory: 4k page, physical 2097151k(1706988k free), swap 4194303k(4194303k free)

vm_info: Java HotSpot(TM) Client VM (10.0-b23) for windows-x86 JRE (1.6.0_07-b06), built on Jun 10 2008 01:14:11 by "java_re" with MS VC++ 7.1

time: Sun Nov 30 16:13:14 2008
elapsed time: 9 seconds
185  Game Development / Newbie & Debugging Questions / Re: WTF? on: 2008-12-15 22:31:55
You have got an Access-Violation in jsound.dll, which is in your JDK, so there might be something wrong with it or it might not be too compatible with your sound driver. That the song is playing fine in media player says nothing in this respect.

btw. your second core-dump is not about jsound.dll. Did the coredump also occur at midi playback? What system/os do you have? And check your RAM with x86memtest.


maybe this is the problem...

1  
2  
3  
4  
5  
6  
7  
8  
Object List Initiallized.
Loading MIDI sound: resources/sounds/intro.mid
Added Panel: SplashScreen
Removed Panel: renoria.game.panels.SplashScreen
Object List Initiallized.
Loading MIDI sound: resources/sounds/menu.mid
Object List Initiallized.
Loading MIDI sound: resources/sounds/menu.mid


^^ I think it loaded menu.mid twice then it crashed...
186  Game Development / Newbie & Debugging Questions / Re: How do you split a string? on: 2008-12-15 12:39:55
Homework!?

No, its for a chat bubble, lol
187  Game Development / Newbie & Debugging Questions / Re: WTF? on: 2008-12-15 12:38:55
Try to update your jdk and your sounddriver.

I got the latest JDK and I got Realtek High-Def audio Sound-Driver.

I don't think that's the problem.

The music plays fine in Media player.
188  Discussions / General Discussions / Re: Life is too demanding! on: 2008-12-14 11:48:33
come on! coffe, coffe and more coffe...





now you forgot the e lol!
189  Game Development / Newbie & Debugging Questions / Re: How do you split a string? on: 2008-12-14 03:30:46
yep, I too opt for square wheels every time I buy a new car  Roll Eyes

o.O?
190  Game Development / Newbie & Debugging Questions / Re: How do you split a string? on: 2008-12-14 00:40:26
Text wrapping is a complex problem that occurs in almost all applications.
Ergo, the JDK contains a package for dealing with it.

Have a look in the java.awt.font package, in particular the LineBreakMeasurer class.

Thanks for this, but I'd rather use my own code...
191  Discussions / General Discussions / Re: Life is too demanding! on: 2008-12-13 13:39:12
come on! cofee, cofee and more cofee...





You spelt cofee wrong... it is supposed to be coffee...
192  Discussions / General Discussions / Re: Reasons why Java is not a good language for game development on: 2008-12-13 13:22:09
Quote
[1] Native libs. Currently the only way to get decent graphics performance is to use native libraries. Native libraries such as LWJGL rely on the fact that the player has a decent video card, otherwise the library won't even open up a window. Most PCs have low-end video cards in them.

All good games require a good video card.

Quote
[2] Java2D's performance is awful. Even when using the hardware accelerated graphics you still find that the game's main loop stutters and lags.


This is not the case for me. I have developed lots of ORPGs in Java2D with no probs. If you do have problems, use JOGL.

Quote
[3] Bloated API. Many method names and class names are stupidly, anally long. For example, how many times have you had to type System.out.println("some string");? This is a ridiculous amount of typing for such a simple task.

Ever heard of "import static System.out;"?

Quote
[4] The garbage collector makes games slow and unpredictable. Good time management is a crucial aspect of any game. When you think about it a large chunk of the playability tuning that goes on in game development comes down to adjusting the timed appearance of game objects such as aliens and other moving objects. For a large game, the garbage collector makes it nearly impossible to perform synchronised screen updates.

This is not true. I run the GC once every min with no lag whatsoever. (1 GB ram, 1.3 Ghz CPU)

Quote
[5] Write once, run anywhere is a complete myth. It is write once, debug everywhere and if you are writing applets then that means testing it in IE, Mozilla & Opera running on a combination of Mac, Linux and Windows. Because of the run anywhere myth developers rarely take the time to produce different versions of their software tuned for different machines, something that happens in the C++ world all the time as a matter of routine.

Well this seems reasonable, as some functions work differently in other OSes.

Quote
[6] The lack of function pointers is a major pain in the arse. Having no closures is also a major pain. True, Java has anonymous inner-classes but anonymous inner-classes are ugly as Hell; they hang off your code in the editor like a wart.

If you need pointers, use a language like C++ or Delphi, or use a Native Lib.

Quote
[7] The security restrictions on applets have rendered them almost useless; you can't even read and write a temporary cache which means that games can't save state for the player. Games that force a player to revisit completed levels are a bit lame.

I'm sure RuneScape creates a cache on  your computer. If i'm not wrong its called file_store_32 in your OS drive... Also, RuneScape is
an applet.

Quote
[8] Size. At 14.5Mb the Java runtime is a huge lump of code for a casual game to be dependant upon. Flash games use only a small 1.8Mb runtime.

This was fixed in the newer releases. Also, you can compile your Java files to a native EXE format.
193  Game Development / Newbie & Debugging Questions / Re: WTF? on: 2008-12-13 13:10:30
Sorry for the 2 posts..  it wouldn't fit in one...
194  Game Development / Newbie & Debugging Questions / Re: WTF? on: 2008-12-13 13:09:54

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x04594800 JavaThread "Image Fetcher 0" daemon [_thread_blocked, id=4556, stack(0x07810000,0x07860000)]
  0x04594c00 JavaThread "Java Sound Sequencer" [_thread_blocked, id=3004, stack(0x04c30000,0x04c80000)]
  0x04594400 JavaThread "Thread-6" [_thread_blocked, id=1228, stack(0x07590000,0x075e0000)]
  0x04593c00 JavaThread "Java Sound Sequencer" [_thread_blocked, id=2540, stack(0x07540000,0x07590000)]
  0x04593800 JavaThread "Packet Processor" [_thread_in_native, id=5296, stack(0x06cf0000,0x06d40000)]
  0x04593000 JavaThread "Java Sound Sequencer" [_thread_blocked, id=5504, stack(0x06950000,0x069a0000)]
  0x04592c00 JavaThread "Headspace mixer frame proc thread" daemon [_thread_blocked, id=2076, stack(0x06160000,0x061b0000)]
  0x04592400 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=4544, stack(0x06070000,0x060c0000)]
  0x04592000 JavaThread "PooledThread-7" [_thread_blocked, id=5852, stack(0x05ed0000,0x05f20000)]
  0x04591800 JavaThread "PooledThread-6" [_thread_blocked, id=4656, stack(0x05e80000,0x05ed0000)]
  0x04591400 JavaThread "PooledThread-5" [_thread_blocked, id=5272, stack(0x05e30000,0x05e80000)]
  0x04591000 JavaThread "PooledThread-4" [_thread_blocked, id=4280, stack(0x05de0000,0x05e30000)]
  0x04590000 JavaThread "PooledThread-3" [_thread_blocked, id=4988, stack(0x05d90000,0x05de0000)]
  0x04581c00 JavaThread "PooledThread-2" [_thread_blocked, id=5492, stack(0x05d40000,0x05d90000)]
  0x04581400 JavaThread "PooledThread-1" [_thread_blocked, id=5436, stack(0x05cf0000,0x05d40000)]
  0x0458fc00 JavaThread "PooledThread-0" [_thread_blocked, id=5240, stack(0x05ca0000,0x05cf0000)]
  0x04587400 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=3320, stack(0x04da0000,0x04df0000)]
  0x01347000 JavaThread "DestroyJavaVM" [_thread_blocked, id=3508, stack(0x00240000,0x00290000)]
  0x04564400 JavaThread "AWT-EventQueue-0" [_thread_in_native, id=5276, stack(0x04be0000,0x04c30000)]
  0x04563c00 JavaThread "AWT-Windows" daemon [_thread_blocked, id=5084, stack(0x044d0000,0x04520000)]
  0x04562800 JavaThread "AWT-Shutdown" [_thread_blocked, id=4472, stack(0x04430000,0x04480000)]
  0x04562000 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=2960, stack(0x043a0000,0x043f0000)]
  0x013a9000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=5328, stack(0x04300000,0x04350000)]
  0x01396400 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3104, stack(0x042b0000,0x04300000)]
  0x01395c00 JavaThread "Attach Listener" daemon [_thread_blocked, id=6072, stack(0x02220000,0x02270000)]
  0x0138d000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=4928, stack(0x021d0000,0x02220000)]
  0x01386000 JavaThread "Finalizer" daemon [_thread_blocked, id=4644, stack(0x02180000,0x021d0000)]
  0x01381800 JavaThread "Reference Handler" daemon [_thread_blocked, id=1444, stack(0x02130000,0x02180000)]

Other Threads:
=>0x01380400 VMThread [stack: 0x01450000,0x014a0000] [id=4460]
  0x013ba000 WatcherThread [stack: 0x04350000,0x043a0000] [id=2660]

VM state:at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread:  ([mutex/lock_event])
[0x013612d8/0x00000110] Threads_lock - owner thread: 0x01380400
[0x01360c60/0x00000150] Heap_lock - owner thread: 0x04594800

Heap
 def new generation   total 960K, used 283K [0x23be0000, 0x23ce0000, 0x240c0000)
  eden space 896K,  24% used [0x23be0000, 0x23c16ee8, 0x23cc0000)
  from space 64K, 100% used [0x23cc0000, 0x23cd0000, 0x23cd0000)
  to   space 64K,   7% used [0x23cd0000, 0x23cd1350, 0x23ce0000)
 tenured generation   total 4564K, used 3921K [0x240c0000, 0x24535000, 0x27be0000)
   the space 4564K,  85% used [0x240c0000, 0x24494580, 0x24494600, 0x24535000)
 compacting perm gen  total 12288K, used 1387K [0x27be0000, 0x287e0000, 0x2bbe0000)
   the space 12288K,  11% used [0x27be0000, 0x27d3af00, 0x27d3b000, 0x287e0000)
    ro space 8192K,  66% used [0x2bbe0000, 0x2c130f10, 0x2c131000, 0x2c3e0000)
    rw space 12288K,  52% used [0x2c3e0000, 0x2ca306d0, 0x2ca30800, 0x2cfe0000)

Dynamic libraries:
0x00400000 - 0x00423000    C:\Program Files\Java\jdk1.6.0_07\jre\bin\java.exe
0x77380000 - 0x774a7000    C:\Windows\system32\ntdll.dll
0x75f40000 - 0x7601b000    C:\Windows\system32\kernel32.dll
0x76020000 - 0x760e6000    C:\Windows\system32\ADVAPI32.dll
0x76530000 - 0x765f2000    C:\Windows\system32\RPCRT4.dll
0x7c340000 - 0x7c396000    C:\Program Files\Java\jdk1.6.0_07\jre\bin\msvcr71.dll
0x6d870000 - 0x6dac0000    C:\Program Files\Java\jdk1.6.0_07\jre\bin\client\jvm.dll
0x77540000 - 0x775dd000    C:\Windows\system32\USER32.dll
0x761a0000 - 0x761eb000    C:\Windows\system32\GDI32.dll
0x74630000 - 0x74662000    C:\Windows\system32\WINMM.dll
0x767c0000 - 0x7686a000    C:\Windows\system32\msvcrt.dll
0x762c0000 - 0x76404000    C:\Windows\system32\ole32.dll
0x76730000 - 0x767bd000    C:\Windows\system32\OLEAUT32.dll
0x745f0000 - 0x74629000    C:\Windows\system32\OLEACC.dll
0x77520000 - 0x7753e000    C:\Windows\system32\IMM32.DLL
0x76410000 - 0x764d8000    C:\Windows\system32\MSCTF.dll
0x75a30000 - 0x75a5c000    C:\Windows\system32\apphelp.dll
0x75c00000 - 0x75c09000    C:\Windows\system32\LPK.DLL
0x760f0000 - 0x7616d000    C:\Windows\system32\USP10.dll
0x6d320000 - 0x6d328000    C:\Program Files\Java\jdk1.6.0_07\jre\bin\hpi.dll
0x75bf0000 - 0x75bf7000    C:\Windows\system32\PSAPI.DLL
0x6d820000 - 0x6d82c000    C:\Program Files\Java\jdk1.6.0_07\jre\bin\verify.dll
0x6d3c0000 - 0x6d3df000    C:\Program Files\Java\jdk1.6.0_07\jre\bin\java.dll
0x6d860000 - 0x6d86f000    C:\Program Files\Java\jdk1.6.0_07\jre\bin\zip.dll
0x6d0b0000 - 0x6d1de000    C:\Program Files\Java\jdk1.6.0_07\jre\bin\awt.dll
0x71ca0000 - 0x71ce2000    C:\Windows\system32\WINSPOOL.DRV
0x74c50000 - 0x74c8f000    C:\Windows\system32\uxtheme.dll
0x76870000 - 0x7737f000    C:\Windows\system32\shell32.dll
0x75c90000 - 0x75ce8000    C:\Windows\system32\SHLWAPI.dll
0x74950000 - 0x74aee000    C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6001.18000_none_5cdbaa5a083979cc\comctl32.dll
0x6d2c0000 - 0x6d313000    C:\Program Files\Java\jdk1.6.0_07\jre\bin\fontmanager.dll
0x6d530000 - 0x6d554000    C:\Program Files\Java\jdk1.6.0_07\jre\bin\jsound.dll
0x6d560000 - 0x6d568000    C:\Program Files\Java\jdk1.6.0_07\jre\bin\jsoundds.dll
0x70e20000 - 0x70e90000    C:\Windows\system32\DSOUND.dll
0x74f30000 - 0x74f4a000    C:\Windows\system32\POWRPROF.dll
0x73680000 - 0x736af000    C:\Windows\system32\wdmaud.drv
0x73670000 - 0x73674000    C:\Windows\system32\ksuser.dll
0x74bf0000 - 0x74c17000    C:\Windows\system32\MMDevAPI.DLL
0x74b60000 - 0x74b67000    C:\Windows\system32\AVRT.dll
0x75d20000 - 0x75eaa000    C:\Windows\system32\SETUPAPI.dll
0x74d50000 - 0x74d7d000    C:\Windows\system32\WINTRUST.dll
0x755b0000 - 0x756a1000    C:\Windows\system32\CRYPT32.dll
0x75710000 - 0x75722000    C:\Windows\system32\MSASN1.dll
0x75ab0000 - 0x75ace000    C:\Windows\system32\USERENV.dll
0x75a90000 - 0x75aa4000    C:\Windows\system32\Secur32.dll
0x75cf0000 - 0x75d19000    C:\Windows\system32\imagehlp.dll
0x735a0000 - 0x735c1000    C:\Windows\system32\AUDIOSES.DLL
0x731f0000 - 0x73256000    C:\Windows\system32\audioeng.dll
0x73660000 - 0x73669000    C:\Windows\system32\msacm32.drv
0x731d0000 - 0x731e4000    C:\Windows\system32\MSACM32.dll
0x731c0000 - 0x731c7000    C:\Windows\system32\midimap.dll
0x75eb0000 - 0x75f34000    C:\Windows\system32\CLBCatQ.DLL
0x6d620000 - 0x6d633000    C:\Program Files\Java\jdk1.6.0_07\jre\bin\net.dll
0x76170000 - 0x7619d000    C:\Windows\system32\WS2_32.dll
0x774b0000 - 0x774b6000    C:\Windows\system32\NSI.dll
0x75250000 - 0x7528b000    C:\Windows\system32\mswsock.dll
0x752b0000 - 0x752b5000    C:\Windows\System32\wship6.dll
0x6d640000 - 0x6d649000    C:\Program Files\Java\jdk1.6.0_07\jre\bin\nio.dll
0x74f10000 - 0x74f15000    C:\Windows\System32\wshtcpip.dll
0x6d460000 - 0x6d484000    C:\Program Files\Java\jdk1.6.0_07\jre\bin\jpeg.dll
0x71890000 - 0x71896000    C:\Windows\system32\IconCodecService.dll
0x73f80000 - 0x74033000    C:\Windows\system32\WindowsCodecs.dll

VM Arguments:
java_command: renoria.Console
Launcher Type: SUN_STANDARD

Environment Variables:
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Qt\3.2.1NonCommercial\bin
USERNAME=David
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 17 Model 3 Stepping 1, AuthenticAMD



---------------  S Y S T E M  ---------------

OS: Windows Vista Build 6001 Service Pack 1

CPU:total 2 (2 cores per cpu, 1 threads per core) family 17 model 3 stepping 1, cmov, cx8, fxsr, mmx, sse, sse2, sse3, mmxext, 3dnow, 3dnowext

Memory: 4k page, physical 2097151k(1706988k free), swap 4194303k(4194303k free)

vm_info: Java HotSpot(TM) Client VM (10.0-b23) for windows-x86 JRE (1.6.0_07-b06), built on Jun 10 2008 01:14:11 by "java_re" with MS VC++ 7.1

time: Sun Nov 30 16:13:14 2008
elapsed time: 9 seconds
195  Game Development / Newbie & Debugging Questions / Re: WTF? on: 2008-12-13 13:09:43
#
# An unexpected error has been detected by Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d9b2084, pid=4388, tid=4460
#
# Java VM: Java HotSpot(TM) Client VM (10.0-b23 mixed mode, sharing windows-x86)
# Problematic frame:
# V  [jvm.dll+0x142084]
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#

---------------  T H R E A D  ---------------

Current thread (0x01380400):  VMThread [stack: 0x01450000,0x014a0000] [id=4460]

siginfo: ExceptionCode=0xc0000005, reading address 0x01dd104b

Registers:
EAX=0x00374560, EBX=0x01380e54, ECX=0x01dd1043, EDX=0x01380ddc
ESP=0x0149f7e0, EBP=0x01380dd8, ESI=0x01dd1043, EDI=0x0149f870
EIP=0x6d9b2084, EFLAGS=0x00010212

Top of Stack: (sp=0x0149f7e0)
0x0149f7e0:   6d9131cc 00374560 04564400 0149f870
0x0149f7f0:   00000000 00000001 01380dd8 0149f870
0x0149f800:   0149f870 0149f83c 01380400 6d8e6391
0x0149f810:   6d8e63a0 0149f83c 6d8c5c10 6d8c5c28
0x0149f820:   0149f870 6d9137cf 04c2f2a0 04c2f2d4
0x0149f830:   022b9c6f 0149f9e4 00000001 6d913552
0x0149f840:   0149f9e4 0149f888 00000001 0149f9e4
0x0149f850:   6da14f5b 0149f9e4 0149f888 00000001

Instructions: (pc=0x6d9b2084)
0x6d9b2074:   40 10 c3 cc cc cc cc cc cc cc cc cc 8b 44 24 04
0x6d9b2084:   2b 41 08 83 e8 30 c2 04 00 cc cc cc 8b 54 24 04


Stack: [0x01450000,0x014a0000],  sp=0x0149f7e0,  free space=317k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [jvm.dll+0x142084]

VM_Operation (0x0785f0bc): GenCollectForAllocation, mode: safepoint, requested by thread 0x04594800


196  Discussions / Miscellaneous Topics / Re: Your password must contain a mix of upper and lower case letters, as well as dig on: 2008-12-13 08:37:43
I can login again, after I forgot my password...
But why did I forget my password I never do.

Your password must contain a mix of upper and lower case letters, as well as digits.  is the reason why. I have like 4 passwords and none of them uses a uppercase letter, so I changed one of the 4 abit and the next time i visit the site I have to think(ouch) and try 3 passwords before i'm locked out  Shocked

Isn't this a bit too restrictive? Email sites don't even require this and this forum does?



I just tick login forever
197  Game Development / Newbie & Debugging Questions / WTF? on: 2008-12-13 07:42:09
init:
deps-jar:
Compiling 1 source file to C:\Users\David\Documents\NetBeansProjects\Renoria\build\classes
compile:
run:
Loading image: resources/images/IDGames.jpg
Loading image: resources/images/cursor.png
Loading image: resources/images/idlogo.png
Loading image: resources/images/gui/textbox/textboxLeft.png
Loading image: resources/images/gui/textbox/textboxRight.png
Loading image: resources/images/gui/textbox/textboxCenter.png
Loading image: resources/images/icon.png
Object List Initiallized.
Loading MIDI sound: resources/sounds/intro.mid
Added Panel: SplashScreen
Removed Panel: renoria.game.panels.SplashScreen
Object List Initiallized.
Loading MIDI sound: resources/sounds/menu.mid
Object List Initiallized.
Loading MIDI sound: resources/sounds/menu.mid
#
# An unexpected error has been detected by Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d541b30, pid=5308, tid=7832
#
# Java VM: Java HotSpot(TM) Client VM (10.0-b23 mixed mode, sharing windows-x86)
# Problematic frame:
# C  [jsound.dll+0x11b30]
#
# An error report file with more information is saved as:
# C:\Users\David\Documents\NetBeansProjects\Renoria\hs_err_pid5308.log
Loading image: resources/images/loginscreen.jpg
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Java Result: 1
BUILD SUCCESSFUL (total time: 10 seconds)


whats does this error mean?
198  Game Development / Shared Code / Re: A* Pathfinding through 2d polygons on: 2008-12-13 00:02:53
wow, ticking show nodes halves the FPS...
199  Game Development / Newbie & Debugging Questions / Re: How do you split a string? on: 2008-12-13 00:00:38
I have already got some code that works, but it splits words too.
200  Game Development / Newbie & Debugging Questions / How do you split a string? on: 2008-12-12 10:44:19
How could I split a string into a List<String> not breaking words, but breaking apart really long words?

Example: "This is a very long text"

Becomes

"This is a"
"very long"
"text"

But a string like "asdfawerawefefrafewa"

Becomes

"asdfaw"
"erawefe"
"frafewa"

even though its got no spaces.

I've already got this code but it splits words too Sad
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
    public ArrayList<String> splitLines(String s) {
        ArrayList<String> ret = new ArrayList<String>();
        char c; String ln = "";
        FontMetrics fm = Console.getWindow().getGraphics().getFontMetrics();
        for (int i = 0; i < s.length(); i++) {
            c = s.charAt(i);
            if (fm.stringWidth(ln) >= maxWidth) {
                ret.add(new String(ln));
                ln = "";
            }
            ln += c;
        }
        return ret;
    }


Thanks.
201  Game Development / Newbie & Debugging Questions / Re: Merging an image with a color? on: 2008-12-12 01:32:37
What about using RBGFilter?
202  Game Development / Newbie & Debugging Questions / Merging an image with a color? on: 2008-12-11 23:51:42
How could I merge an image with a color, so that I can make frozen looking sprites while I don't need another image?
203  Game Development / Game Mechanics / Knockback Effect? on: 2008-12-10 12:01:38
Is there a way to create a knockback effect that kind of slows down as the monster gets knocked back?
204  Java Game APIs & Engines / Java 2D / Re: Scoller (like on news channels) object in swing? on: 2008-12-07 04:55:01
you could just use a JLabel then use setLocation() repeatedly
205  Game Development / Newbie & Debugging Questions / Re: Extreme lag... on: 2008-12-05 23:52:53
yep it worked. thanks. Grin
206  Game Development / Newbie & Debugging Questions / Re: Extreme lag... on: 2008-12-05 22:25:00
so do I replace it with

1  
dos.write(b, 0, b.length);

??
207  Game Development / Newbie & Debugging Questions / Re: Extreme lag... on: 2008-12-05 22:23:12
okay I will try that Cheesy
208  Game Development / Newbie & Debugging Questions / Extreme lag... on: 2008-12-05 21:49:02
When I use my server, if I get more than 2 clients connected onto it, I get massive lag. this is my socket.

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  
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


/*
 * This file is part of the "Renoria" Game.
 * Copyright (C) 2008
 * IDGames.
 */


package renoria.net;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.*;
import renoria.Console;
import renoria.GameProperties;
import renoria.tools.HexTool;
import renoria.tools.data.input.ByteArrayByteStream;
import renoria.tools.data.input.GenericSeekableLittleEndianAccessor;
import renoria.tools.data.input.SeekableLittleEndianAccessor;

/**
 *
 * @author David
 */

public class PacketHandler implements GameProperties, Runnable {
    private Socket sock;
    private Thread runThread;
    private DataOutputStream dos;
    private DataInputStream dis;
    private PacketProcessor processor;

    public PacketHandler() throws IOException, Exception {
        runThread = new Thread(this, "Packet Processor");
        //runThread.setPriority(Thread.MAX_PRIORITY);
        runThread.start();
        processor = new PacketProcessor();
        sock = new Socket(ip, port);
        sock.setTcpNoDelay(true);
        sock.setKeepAlive(true);
        dos = new DataOutputStream(sock.getOutputStream());
        dis = new DataInputStream(sock.getInputStream());
        System.out.println("Packet processor started.");
    }
   
    @Override public void run() {
        while(true) {
            try {
                if (sock.isInputShutdown() || sock.isOutputShutdown()
                        || sock.isClosed() || !sock.isConnected()) {
                    Console.getWindow().showError("Connection Lost", "The connection with the server was lost.");
                    sock.close();
                    return;
                }
                byte[] data = new byte[1024];
                byte[] rdata;
                byte b;
                int c = 0;
                while ((b = dis.readByte()) != -1) {
                    data[c] = b;
                    c++;
                }
                rdata = new byte[c];
                for (int i = 0; i < c; i++) {
                    rdata[i] = data[i];
                }
                SeekableLittleEndianAccessor slea = new GenericSeekableLittleEndianAccessor(new ByteArrayByteStream(rdata));
      short packetId = slea.readShort();
                if (processor.getHandler(packetId) != null) {
                    processor.getHandler(packetId).handlePacket(slea);
                } else {
                    System.out.println("Got unhandled packet: " + HexTool.toString(rdata));
                }
            }catch (UnknownHostException e) {
                e.printStackTrace();
            } catch (Exception e) {
               
            }
        }
    }
   
    public Socket getConnection() {
        return sock;
    }
   
    public void close() throws IOException {
        sock.close();
    }
   
    public void write(RenoriaPacket packet) throws IOException {
        if (packet.getOnSend() != null) {
            packet.getOnSend().run();
        }
        byte[] b = packet.getBytes();
        try {
            for (int i = 0; i < b.length; i++) {
                dos.writeByte(b[i]);
            }
            dos.writeByte(-1);
        } catch (IOException ioe) {
           
        }
        System.out.println("Sent packet: " + HexTool.toString(packet.getBytes()));
    }
   
    public void write(byte[] b) throws IOException {
        try {
            for (int i = 0; i < b.length; i++) {
                dos.writeByte(b[i]);
            }
            dos.writeByte(-1);
        } catch (IOException ioe) {
           
        }
    }
}
209  Game Development / Game Mechanics / Is there a better way to jump? on: 2008-12-05 21:43:50
My jumping right now is constant motion. I would like to add acceleration to the motion.

Please help.
Pages: 1 ... 5 6 [7]
 
Riven (848 views)
2019-09-04 15:33:17

hadezbladez (5799 views)
2018-11-16 13:46:03

hadezbladez (2605 views)
2018-11-16 13:41:33

hadezbladez (6215 views)
2018-11-16 13:35:35

hadezbladez (1501 views)
2018-11-16 13:32:03

EgonOlsen (4736 views)
2018-06-10 19:43:48

EgonOlsen (5794 views)
2018-06-10 19:43:44

EgonOlsen (3278 views)
2018-06-10 19:43:20

DesertCoockie (4176 views)
2018-05-13 18:23:11

nelsongames (5503 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08
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!