Show Posts
|
|
Pages: [1] 2 3 ... 7
|
|
1
|
Game Development / Newbie & Debugging Questions / Re: NIO for networking
|
on: 2010-11-04 00:37:12
|
Thanks! Confirms my doubts, with that out of the way, does anyone know a good networking (p2p) library? Ironically most of them seem to be build around NIO (and client/server for that matter). I know about JXTA, but it's way too bloated and over-engineered for my taste. Edit: Just found this lib ( http://code.google.com/p/ice4j/) which should take care of most p2p NAT traversal issues.
|
|
|
|
|
2
|
Game Development / Newbie & Debugging Questions / NIO for networking
|
on: 2010-11-03 10:48:19
|
|
Hi,
I'm about to start work on a simulation which sends its updates p2p. Depending available bandwidth a peer will have between 6 - 20 active connections.
I haven't done any tests yet, but would NIO be helpfull here? I've read mixed stories; That NIO is overly complex, that a thread per socket performs better for a small number of connections than NIO, and conversely that the memory footprint of a thread per socket adds up quickly...
Thanks!
Matthijs
|
|
|
|
|
3
|
Game Development / Newbie & Debugging Questions / Re: Floating Point Determinism in Java
|
on: 2010-10-14 09:12:52
|
As i understand you should only have to add strictfp to the class. Not the fields or methods etc...
Yes, I thought so too. I may try that out just to see for sure that it works, the question comes up a lot (though not enough to use strictfp in the library by default).
It would be cool if jbox2d supported deterministic simulation as an option, fx like Riven suggest through an manipulation framework like ASM ( http://asm.ow2.org/) Please keep us updated on your findings.. Im particularly interested as I'll have a go on a p2p networked physics simulation in the near future.
|
|
|
|
|
8
|
Java Game APIs & Engines / Java 2D / Re: Vectorization of image in Java (triangles on top of image)
|
on: 2009-07-08 12:45:22
|
|
About the multiple image issue: Can't you split them in a seperate images? You can identify an mask color for transparant pixels (fx black) in the image, which you can use as empty space for the marching squares algorithm or "cut" out seperate images from your map.
About the holes: You could repeat the process for the marching squares from within the first transparant pixel you find within the bounds of the already vectorized outline in the image. That will give the vector outline for the hole.
About the triangles: Once you have created the concave polygon for your image you can use a tesselator to split the concave polygon into triangles which the gpu can render. JOGL has a nice tesselator in the glu package, if you dont want to stick to jogl, there are plenty of others around. But be aware that the quality of these tesselators can vary a great deal, some cant deal with concave polys, other cant handle holes in polys etcetc. I know the opengl version is very robust and I believe Slick also has a good one for tesselating SVG shapes.
Good luck!
Thijs
|
|
|
|
|
12
|
Discussions / General Discussions / Re: What happened to java.com?
|
on: 2009-03-17 20:47:27
|
Thank you for your feedback. Sun's professional translator and reviewers disagree with you and consider the Dutch translation on that page correct.
Dmitri
Argh! I'm also Dutch, and though I'm no Dutch linguist, I know for fact that the Dutch translation is horrible! edit: and like Riven said, it isnt anything like "Belgium Dutch" neither, its more like broken English-Dutch translated by an chief Indian alike 
|
|
|
|
|
14
|
Discussions / Business and Project Discussions / Re: Skill games
|
on: 2009-02-01 10:10:59
|
|
Me and some fellow java delopers tried this once, with a games portal (see sig). You could compete in cash competitions in return for a micro payment (sms, pay phone or paypal). This is legal in most countries / states, as long as you make sure no chance / luck is involved. For example, in an arkanoid type of game, the powerups that you get after destroying a brick should be the same for all payers competing in that same competition, so I ended up calculating all random events based on an random seed, which could be feed to a competition. Still, there are some states where this is illegal, this is a snippet from the conditions and terms we made back then:
"Player's that reside in one of the following US states are not eligible to participate in prize competitions: Alaska, Iowa, Arizona, Louisiana, Arkansas, Maryland, Connecticut, Missouri, Delaware, South Dakota, Florida, Tennessee, Illinois, Vermont"
But note this list is probably not up to date, you should get some legal advice first, or only open it for countries you do know it's legal.
|
|
|
|
|
15
|
Game Development / Performance Tuning / Re: java cache
|
on: 2008-12-11 19:04:36
|
You can also manually cache by storing the file at user.home + .whatever/ and you basically have your own resource folder on their HD.
Thats only possible with webstart and signed applets I'm afraid. If they use the JOGLAppletLauncher they wont have those rights from their own classes
|
|
|
|
|
16
|
Game Development / Performance Tuning / Re: java cache
|
on: 2008-12-11 14:02:47
|
Yup, Rename your resource files to .jar, download them over an urlconnection with setUseCache set to true (or false if you dont want to cache). Read in the byte[] and feed it to a zipstream and your done. If you try to load it with cache set to true, it will load the resource jar from the applet cache if its there. The only downside is that during the download (with caching on) the urlconnection wont tell you the nr of bytes it downloaded. This is because of some stupid implementation detail, if setUseCache is enabled, it's downloaded in an private stream somewhere deep in Suns classes. That stream is passed until the whole jar is downloaded and cached to disc... so no progress monitoring is possible :/ EDIT: .jar should read .class 
|
|
|
|
|
17
|
Java Game APIs & Engines / Java 2D / Re: Weird symbol on java applet windows
|
on: 2008-12-11 10:47:33
|
<edit> Just 1 further point you might want to chew on: you lot are all geeks. Proper, high-order grand wizard pointy propeller head geeks. You know about this stuff and even more strangely, you care. You are fundamentally interested in how things work and what they're doing. But the rest of the world does not give 2 shits. They just want stuff to work (which is largely why they click yes on nearly any dialog - "Do you want to grant permission to DodgyCorp.ru to access your computer so you can play Craptris?") Given that, they don't care about files being written to their hard drive any more than they care about how much heap the VM allocates on startup. They don't care, they don't understand, they don't even want to understand. All that matters to a normal person, a non-geek, is that the machine does what it is asked! Cas  True, true... And (I assume) we're all good geeks here, but we know there are evil geeks too. The problem with the web is that you can easily stumble upon a website you didnt want to (redirect, wrong click etc). And if such a page contains an evil applet that screws the computer without notice, the user probably wants to disable all applets, and asociates applets==bad, and then we're all back in 1997 again :/ A popup doesnt have to be bad, can be userfriendly and maybe popup only once per author (signer) if you tell it so, it can simply say something like: "Yes i want to play games from this author". The notice must be clear (the flash way), and prefably be skinnable in some way, because Sun's own look&feel doesnt look/feel too good.
|
|
|
|
|
18
|
Java Game APIs & Engines / Java 2D / Re: Weird symbol on java applet windows
|
on: 2008-12-10 23:18:24
|
Nice. How does it do that? Reload a signed version of the applet or something?
It works like this: An additional jar is added to the applet archive list, which is signed containing a loader class and a custom classloader. When this loader class is called it replaces the loaded securitymanager with its own (after the user has accepted the security question), which basically allows everything. Now you can tell the loader class to load a jar, it will load its classes through the custom classloader which has the original classloader as a parent. The beauty of this, is that the security popup is deferred until the unsigned applet loads the loader class from the signed jar. The question is, why you need signed application? I bet it's because of 3D acceleration. If that would be handled gracefully (as outlined in my previous post here), it would leave signed applications only for special purpose things, where I find current security dialog a very proper solution. I agree with Matzon that signed code shouldn't be allowed to run by default.
I agree the current way it works (security popup) is fine for privileged actions, the user can accept it or not. And we developers can detect if the user accepted or not and act accordingly. Instead of using an "extensionloader" like I outlined above it would be nice if the JVM did this for us, check if an privileged action is invoked, check if the user accepted the security popup or not. Of course with this security popup it should have an option "reject", "accept once" and "always accept (for this applet)".
|
|
|
|
|
19
|
Games Center / Showcase / Re: Mini 3D FPS in an Applet Update 9
|
on: 2008-12-10 15:21:05
|
+! for cross-hair with the new mouse-look.
By the way, how did you do mouse capture without using Robot and all permissions? (or did you use Robot?)
Cross-hair is on the way, together with some menu's to help the user tune all settings. The mouse capture is done using the Robot class, but I ask for permission before doing so, using the extensionloader I posted some while back. This means the applet can start within the sandbox, and ask for special rights at runtime when the user request a special feature like hw rendering or mouselook etc. The user only has to trust the applet once, from then on the applet is granted all privileged rights just like a normal signed applet. Now you need to make some interesting levels  Amazing, amazing work, the graphics are phenomenal. You guys just need some artists to help you out with models and you can churn out flash-style 3d games.
Well if you happen to know an artist who's willing to work for free we'd be glad to hear 
|
|
|
|
|
20
|
Java Game APIs & Engines / JavaFX / Re: JavaFX 1.0 released
|
on: 2008-12-05 09:56:44
|
|
I've downloaded the SDK too, while the examples look very nice, I too had the problem that it took up to 2 minutes(!) until they showed something, in the console it displayed loading & validating the resource jars... Now i noticed it happens only the very first time that you try to load an fx applet. It would be nice if it at least displayed something in the applet (what it is exactly doing / progress)
|
|
|
|
|
21
|
Games Center / Showcase / Re: Mini 3D FPS in an Applet Update 8
|
on: 2008-11-28 13:21:01
|
I remind you that I worked on the Java Game Tome some months ago at the beginning of the project and I tested lots of games successfully (hundreds). My sound driver is fine, it works fine with TUER (webstart) and Tesseract (applet) that are both open source and use both AudioClip. I don't have to place it, it is up to the author to do it and I see that he copied some jars on my machine when I activate the hardware rendering.
Well, something seems to break down with the AudioClip, especially since you say it happens when you try to walk; Thats when the footstep audioclip is played. We'll put a nosound version online to test. I don't have to place it, it is up to the author to do it and I see that he copied some jars on my machine when I activate the hardware rendering.
I never said you'd have to, I said we forgot  Nice game! I just love these oldskool raycasted type of games. Those controls work very well for that type of game indeed, but I guess it'd work less intuitive in full 3d where 6dof mouselook is important. I'm working on a option that uses the robot class for mouselook, but it will require the user to accept a certificate when they chose that option. I guess it's the same dilema as console gamers vs pc gamers. Maybe we can give the non robot-mouselook players a slight advantage using limited auto-aiming or something.
|
|
|
|
|
22
|
Games Center / Showcase / Re: Mini 3D FPS in an Applet Update 8
|
on: 2008-11-27 23:53:54
|
I watch this in JConsole: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| Name: Thread-58 State: BLOCKED on java.lang.Object@1b94ea2 owned by: Direct Clip Total blocked: 1 Total waited: 0
Stack trace: com.sun.media.sound.DirectAudioDevice$DirectDL.flush(DirectAudioDevice.java:672) com.sun.media.sound.JavaSoundAudioClip.stop(JavaSoundAudioClip.java:205) - locked com.sun.media.sound.JavaSoundAudioClip@13dc4d5 sun.plugin.viewer.context.AppletAudioClip.stop(AppletAudioClipFactory.java:340) - locked sun.plugin.viewer.context.AppletAudioClip@161def0 sun.plugin.viewer.context.PluginAudioClip.stop(AppletAudioClipFactory.java:181) game.spiderExperiment.FPSSampleMain.playerControl(FPSSampleMain.java:789) game.spiderExperiment.FPSSampleMain.doGameLogic(FPSSampleMain.java:521) game.spiderExperiment.FPSSampleMain.render3DWorldSpace(FPSSampleMain.java:435) net.dzzd.core.ap.render(Unknown Source) net.dzzd.core.ap.run(Unknown Source) java.lang.Thread.run(Thread.java:619) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| Name: AWT-EventQueue-2 State: WAITING on java.awt.EventQueue@90ed81 Total blocked: 2 Total waited: 1 391
Stack trace: java.lang.Object.wait(Native Method) java.lang.Object.wait(Object.java:485) java.awt.EventQueue.getNextEvent(EventQueue.java:479) java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:245) java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) java.awt.EventDispatchThread.run(EventDispatchThread.java:121) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| java.io.FileNotFoundException: http: at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1296) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1290) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:944) at net.dzzd.extension.jogl.JOGLLoader.a(Unknown Source) at net.dzzd.extension.jogl.JOGLLoader.load(Unknown Source) at net.dzzd.extension.loader.ExtensionLoader.loadExtension(Unknown Source) at net.dzzd.DzzD.newRender3D(Unknown Source) at net.dzzd.core.r.run(Unknown Source) at java.lang.Thread.run(Thread.java:619) Caused by: java.io.FileNotFoundException: http: at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1239) at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:2052) at java.net.URLConnection.getHeaderFieldInt(URLConnection.java:579) at java.net.URLConnection.getContentLength(URLConnection.java:474) ... 6 more |
After some minutes, the game is no more frozen but when I try to walk again, it gets frozen  I succeed in going forward when I press the right button on the mouse without releasing it. When I touch the floor, it gets frozen again. Looks like the cause is the first exception; its a problem with the sounddriver... or your sounddriver and jvm not liking eachother. Can you play sound (using AudioClip) with other Java apps/applets on that config? I'm not sure about the second, the stacktrace doesnt seem to trace back to the applet, it seems related to the first exception. The last exception is because you tried to switch to hardware rendering, but we havent placed the necesary jar online for your jvm (gluegen-rt-natives-linux-i586.jar) 
|
|
|
|
|
24
|
Discussions / General Discussions / Re: Applet Reliability: Test with me! (MSIE 7.0 please)
|
on: 2008-11-20 11:25:03
|
It seemed to work fine in IE, though at some point it threw some exceptions 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| java.lang.InterruptedException at java.lang.Object.wait(Native Method) at java.lang.Thread.join(Unknown Source) at java.lang.Thread.join(Unknown Source) at main.SpookyApplet$1.run(SpookyApplet.java:49) at java.lang.Thread.run(Unknown Source) SpookyApplet.run() -> stopped java.lang.InterruptedException at java.lang.Object.wait(Native Method) at java.lang.Thread.join(Unknown Source) at java.lang.Thread.join(Unknown Source) SpookyApplet.run() -> stopped at main.SpookyApplet$1.run(SpookyApplet.java:49) at java.lang.Thread.run(Unknown Source) java.lang.InterruptedException at java.lang.Object.wait(Native Method) at java.lang.Thread.join(Unknown Source) at java.lang.Thread.join(Unknown Source) at main.SpookyApplet$1.run(SpookyApplet.java:49) at java.lang.Thread.run(Unknown Source) |
Argh, I just had an exception after many page refreshes and a click on the remove button, but appearantly the whole JVM died, cant access console anymore..
|
|
|
|
|
27
|
Games Center / Showcase / Re: Battle tank 2 - a bird eye view shooter
|
on: 2008-11-17 12:53:06
|
Damn! The applet failed me a couple of times too, it just suddendly stopped showing anything. Also the console shows nothing (unlike ur case). I think it could be a flaw in my timer class, which cases the system to sleep forever.
May I ask what is your JVM version and what browser, operating system you are using?:
Ah sorry, forgot to post that: Java Plug-in 1.6.0_10-beta IE7.0 Windows XP Also, with unresponsive browser window I meant the IE window didnt respond to anything (close, mini/maximize).. The applet kept updating, but couldnt get focus and my last key command was kept repeated (the turret kept rotating). Actually the same thing happend just again while typing this message; I can play the game for a while but then it just stops responding to input. IE becomes unresponsive and the tab keeps "loading" (the IE page loading indicator keeps spinning). So the liveconnect exception could be related... I noticed you dont provide a mayscript ( http://java.sun.com/javase/6/docs/technotes/guides/plugin/developer_guide/java_js.html) param to your applet? Not sure if you use js communication, but given the liveconnect bug in my console and the page that keeps loading... PS: I just tested it in FF 3.03 and that works perfectly!
|
|
|
|
|
28
|
Discussions / General Discussions / Re: monitoring loading progress in Applet
|
on: 2008-11-17 12:33:40
|
Thanks for posting the code, however I have a question: Suppose now I have the raw data of a jpg image in the format of byte[], how do I create an Image object from it?
Ah, thats the easy part  Image = Toolkit.getDefaultToolkit().createImage( imagebyte[] ); Or BufferedImage image = ImageIO.read ( new ByteArrayInputStream ( imagebyte[] ) );
|
|
|
|
|
29
|
Games Center / Showcase / Re: Battle tank 2 - a bird eye view shooter
|
on: 2008-11-16 23:44:44
|
|
Cool game! Has lots of potential...
Unfortunatly it only worked ok for a minute or so, I had multiple tabs open and when I switched between them, the game became uncontrollable and the browser window became unresponsive. I could access the java console though, it displayed an exception (might be unrelated), but still:
Exception in thread "Applet 1 LiveConnect Worker Thread" java.lang.ClassFormatError: Incompatible magic value 1008813135 in class file netscape at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$JavaNameSpaceProxy.getJavaClass(Unknown Source) at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$JavaNameSpaceProxy.getField(Unknown Source) at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$2.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo.doObjectOp(Unknown Source) at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$LiveConnectWorker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
|
|
|
|
|
30
|
Discussions / General Discussions / Re: monitoring loading progress in Applet
|
on: 2008-11-11 09:59:55
|
Java 6 will cache it. I get 304 "Not Modified" responses in my apache logs all the time.
And if you're stuck with jre < 1.6 compatibility, you could always just zip your images and rename the zip to .class. f you download it over an urlconnection with the property useCache(true) it will cache your zip... Below is an excerpt I copy pasted from my IO lib (some helper methods might be missing, but you get the point), the download method would return a byte[] of the zipped data in your case, which you can then feed to the decompress method: 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
| public synchronized static byte[] downloadData(String resource, Class loader, ResourceInfo info, ProgressListener plistener, boolean cache) { try { InputStream is = openStream(resource, loader, info, cache); DataInputStream dis = new DataInputStream(is); if (dis==null) { Log.log(this, "Resource not found: " + resource); return null; }
int length=dis.available(); if (length <= 0) length = 8192; if (length >= 10240) length = 10240;
byte[] chunk=new byte[length]; ByteArrayOutputStream bos = new ByteArrayOutputStream();
int bytesRead = 0; while((bytesRead = dis.read(chunk,0,length)) != -1) { bos.write(chunk,0,bytesRead); }
bos.flush(); closeStream(dis); closeStream(is); return bos.toByteArray(); } catch(Exception e) { Log.log(this, e); return null; } }
public synchronized static void decompress(byte[] data, ProgressListener plistener) { int size=getNrEntries(data),index=0;
sizes = new String[size*2];
if(size>0) { Log.log(this, "Decompressing: "+size+" zipentries found"); } else { Log.log(this, "Decompressing: no zip entries in data"); return; }
try { ZipEntry ze; ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(data));
while ((ze=zis.getNextEntry())!=null) { if (ze.isDirectory()) { continue; } size=(int)ze.getSize(); sizes[index++]=ze.getName(); sizes[index++]=""+size; Log.log(this, "Decompressing: zip entry: "+ze.getName()+","+"size="+size); if (size>-1) { byte[] decompData = new byte[(int)size]; int bytesRead=0; int chunk=0; while ((size - bytesRead) > 0) { chunk=zis.read(decompData,bytesRead,(int)size - bytesRead); if (chunk==-1) { break; } bytesRead+=chunk; } GameContext.addObject(ze.getName(),decompData); Log.log(this, "Decompressing: zip entry: "+ze.getName()+" bytes read="+bytesRead+",size="+size+",compressed size="+ze.getCompressedSize()); } else { Log.log(this, "Decompressing: zip entry: "+ze.getName()+" has unknown size"); continue; } } } catch (NullPointerException e) { Log.log(this, e); } catch (FileNotFoundException e) { Log.log(this, e); } catch (IOException e) { Log.log(this, e); } } |
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|