Java-Gaming.org Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (594)
Games in Android Showcase (168)
games submitted by our members
Games in WIP (646)
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] 2 3 ... 69
1  Discussions / Miscellaneous Topics / Re: My local library only allows boys in their sessions on: 2015-07-01 23:10:03
My advice would be to forget about petitions.
Instead, bypass this Elaine De Bonis, and talk to someone more senior.
Get in writing as to why a student is being discriminated against according to their gender.

Of course, she should get an Adult to do the representation on her behalf.

:edit:

Oh never mind, read a bit further down the petition and saw that's almost exactly what they're doing Smiley
2  Discussions / Miscellaneous Topics / Re: My local library only allows boys in their sessions on: 2015-07-01 22:20:35
How is that even legal?

Is it a session being offered to members of a single gender (male) school?
3  Discussions / General Discussions / Re: Oracle are winning in the 'copyright an api' legal fight on: 2015-07-01 12:06:56
What I'm saying is that an API could embody all of the expression of the idea, where the implementation of each individual method (the code) is trivial / only expressible in one form and therefore can't be copyrighted.

Surely it's quite the opposite though; the API can *only* be expressed in one form, a precise set of class, field & method signatures.
If any deviation from this precise set is made, the function of the API changes and is no longer compatible.
While the API as a whole is complex, it is also in its simplest form, as it cannot be expressed in any other way without changing its function.

Just as a trivial method body cannot be copyrighted (there is no other way of implementing it), an API cannot be copyrighted because it too is in its simplest expressible form & cannot be constructed in any other way while retaining compatibility.
4  Discussions / General Discussions / Re: Oracle are winning in the 'copyright an api' legal fight on: 2015-07-01 10:57:18
....but processes are not subject to copyright.

If Oracle's current claim is that Google copied portions of documents describing the API, then fair enough.
The breach is copying the documents describing the API, not copying the API itself.

If Google (actually Apache~Harmony) had extracted the APIs from rt.jar, I think their 'fair use' defence would be stronger.

The US really needs to add an interoperability exception to their copyright law....

5  Discussions / General Discussions / Re: Oracle are winning in the 'copyright an api' legal fight on: 2015-07-01 10:14:48
I really don't see how APIs can be copyrighted; they're not an expression of an idea, they're a document describing an idea. The expression of the idea is the implementation itself.

The parallel is patent submissions; they too are documents describing an idea, and sensibly they are (by default at least) not subject to copyright.
6  Discussions / General Discussions / Re: Oracle are winning in the 'copyright an api' legal fight on: 2015-06-30 17:18:10
So am I right in understanding that Oracle winning this case would basically destroy the 'clean room' design technique?

If so, Oracle simply can't be permitted to win, as the ramifications would be disastrous to the entire IT industry.
7  Game Development / Newbie & Debugging Questions / Re: Issue with reading a file that was generated when JAR is run for second time on: 2015-06-23 08:18:38
getResource returns a file from the classpath.

As you rightly point out, "aas.script" is not on the classpath.

Use File / FileInputStream
8  Java Game APIs & Engines / OpenGL Development / Re: [LWJGL] Java 8 Dependency? Or is it just me? on: 2015-06-22 10:31:29
Surely the debugger halts when the class loader attempts to load the incompatible class?

Seems like a trivial issue to track down.
9  Java Game APIs & Engines / Java 2D / Re: Approaches to active rendering with no libraries on: 2015-06-17 13:53:49
Keep in mind that Java2D/AWT/Swing are now deprecated

Bwah? Do you have an "official" source for this? I know JavaFX is the supposedly preferred UI library, but *deprecated* is a strong word.

Surprised me too.

Closest I could find was this (in the JavaFX faq):
Quote
6. Is JavaFX replacing Swing as the new client UI library for Java SE?
Yes. However, Swing will remain part of the Java SE specification for the foreseeable future, and therefore included in the JRE. While we recommend developers to leverage JavaFX APIs as much as possible when building new applications, it is possible to extend a Swing application with JavaFX, allowing for a smoother transition.
10  Discussions / Miscellaneous Topics / Re: Free game/addon keys! :) on: 2015-06-16 23:06:06

Redeemed fine, thanks very much!
11  Discussions / Miscellaneous Topics / Re: Free game/addon keys! :) on: 2015-06-16 18:31:14
Would love to replay M2:TW; been ages since I last played it!
12  Discussions / General Discussions / Stack traces when no LineNumberTable attribute exists... on: 2015-06-15 19:43:52
Sure, if there's no LineNumberTable attribute to lookup into, the stack trace can't give you a line number.....
However why doesn't the VM spit out the bytecode offset at which the Throwable occurred?

Seems logical if you can't do the bytecode offset -> line number conversion, then you should just 'do the best you can', return the bytecode offset, and the let developer do the rest.
Unless I'm overlooking some VM argument that alters this behavior, potentially useful information is being discarded unnecessarily.

It doesn't even seem to have been considered when the java.lang.StackTraceElement API was retrofitted in Java 1.4. (StackTraceElement only deals with line numbers, not bytecode offsets)

Anyone else encountered this, and wished for better stack traces?

:edit:

Quick search turned up this:
https://bugs.openjdk.java.net/browse/JDK-4185378

So I guess I'm not the only one....
13  Game Development / Networking & Multiplayer / Re: JBox2D-Networking, Reproducibility and Determinism on: 2015-06-15 10:48:57
Darn.. Smiley You are totally right. Sorry.
I should have clicked on that ACC_STRICT field in the IDE to see this in ASM's source code:
1  
int ACC_STRICT = 0x0800; // method

Sorry, for posting. I'll delete that.

Don't feel bad, I made the exact same mistake myself when I first implemented my StrictifingVisitor Wink. (some time ago for a different project)
14  Game Development / Networking & Multiplayer / Re: JBox2D-Networking, Reproducibility and Determinism on: 2015-06-15 10:44:15
Just one note: Setting the flag on the class itself would also work:
1  
2  
3  
4  
5  
6  
7  
        cr.accept(new ClassVisitor(Opcodes.ASM5, cw) {
           @Override
              public void visit(int version, int access, String name,
                    String signature, String superName, String[] interfaces) {
                 super.visit(version, access | Opcodes.ACC_STRICT, name, signature, superName, interfaces);
              }
        }, 0);


Not according to the class file format specification.

The class file format specifies ACC_STRICT valid as a Method access_flag only, not a Class access_flag.

The ability to flag a whole class as strictfp in source code is purely a syntactic convenience.
15  Game Development / Networking & Multiplayer / Re: JBox2D-Networking, Reproducibility and Determinism on: 2015-06-15 09:28:49
Use a javaagent, along with a bytecode instrumentation api.

The javaagent has to be packaged in a jar, with a manifest that includes the property:
1  
Premain-Class: some.package.Agent

...and the jar supplied to the jvm using the -javaagent command-line parameter.

Using ASM, it goes something like this:
(For succinctness I've used anonymous classes)

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  
package some.package;
import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.IllegalClassFormatException;
import java.lang.instrument.Instrumentation;
import java.security.ProtectionDomain;

import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
public class Agent {
   
   public static void premain(String agentArgs, Instrumentation inst) {
     
      inst.addTransformer(new ClassFileTransformer() {
         
         @Override
         public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
            ClassReader cr = new ClassReader(classfileBuffer);
            ClassWriter cw = new ClassWriter(cr, 0);
            cr.accept(new ClassVisitor(Opcodes.ASM5, cw) {
               @Override
               public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
                  if((access&Opcodes.ACC_ABSTRACT)==0) {
                     // According to the JVM spec, it is illegal for abstract methods to have the strict flag set.
                     access|=Opcodes.ACC_STRICT;
                  }
                  return super.visitMethod(access, name, desc, signature, exceptions);
               }              
            }, 0);

            return cw.toByteArray();
         }
      });
   }

}
16  Game Development / Networking & Multiplayer / Re: JBox2D-Networking, Reproducibility and Determinism on: 2015-06-15 00:02:02
Quote
I did. See my test class here: http://pastebin.com/xRhd9kaf
....and the Float class is strictfp too?

If not, all your benchmark confirms is that there is a significant overhead when transitioning between strictfp & non-strictfp.
17  Game Development / Networking & Multiplayer / Re: JBox2D-Networking, Reproducibility and Determinism on: 2015-06-14 22:20:40
Quote
Using strictfp is not an option, because of the significant performance hit you get from using it.

Have you actually benchmarked this assumption?
My experience is that, so long as you're not mixing strictfp & non-strictfp code, there's zero performance impact.
18  Game Development / Game Play & Game Design / Re: Game armor/weapons: random attributes or predefined attributes? on: 2015-06-11 18:05:02
- Play many action RPGs
- Decide which loot system you like the most
- Implement it.

Research->Design->Implement->Huh?->Profit.
19  Game Development / Newbie & Debugging Questions / Re: Input polling on: 2015-06-11 10:27:22
If you don't want to miss events, don't use flags.
Store the input events in a queue and process them in your game loop.
20  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-06-07 00:02:45
Yes! Managed to get the depth of field as good as physically possible when generating it from a sharp image.

Looks technically very impressive, but depth of field....blergh.
Fine in a cutscene where you might want to guide the user's focus.
However in an interactive game it just doesn't make sense; the player's eyes are never fixed on a single focal point.

A huge misapplication of technology.
21  Game Development / Newbie & Debugging Questions / Re: Interpreting a VerifyError on: 2015-05-29 11:29:14
Never mind, found it  Grin

This VerifyError does indeed mean that:

A) Somewhere within SomeClass.actionPerformed(...) a method was being invoked with invalid parameters.

That was the last bug; deobfuscator now fully functional - don't you just love it when you get something quite complicated 'almost' first time.

Spoke too soon persecutioncomplex
22  Game Development / Newbie & Debugging Questions / Interpreting a VerifyError on: 2015-05-29 11:11:08
I'm writing a deobfuscator, and my transformations are obviously generating something the VM doesn't like, as I'm getting this verify error:

1  
java.lang.VerifyError: (class: blah/blah/blah/SomeClass, method: actionPerformed signature: (Ljava/awt/event/ActionEvent;)V) Incompatible object argument for function call


Does it mean:

A) Somewhere within SomeClass.actionPerformed(...) I'm invoking a method with invalid parameters
or
B) Somewhere in my code base, I'm invoking SomeClass.actionPerformed(...) with invalid parameters.

I'd logically have thought the latter, but:

1) My deobfuscator doesn't touch the name or descriptor of actionPerformed (as it obviously isn't obfuscated!)
2) actionPerformed is obviously an awt callback method, and I'm pretty sure the code base I'm working with never invokes it itself.

Anyone with experience of this error have any ideas?
23  Game Development / Networking & Multiplayer / Re: Handling both UDP and TCP input. Multithreading? on: 2015-05-24 09:39:33
Don't use blocking IO; use non-blocking Channels along with a Selector.
It should be just as simple to just use a thread-per-client model with blocking IO... you might want to give your reasons for the advice.

Cas Smiley

My suggestion was responding to this request by the OP.

Quote
The simplest solution would be to split the packet-input thread into a TCP-input and UDP-input thread, but I'd want to avoid this if possible.

If he doesn't want blocking, and doesn't want lots of threads, non-blocking Channels accessed through a Selector is the logical suggestion.
24  Game Development / Newbie & Debugging Questions / Re: Ok to assume Instrumentation#retransformClasses(Class....) is synchronous? on: 2015-05-17 18:30:29
A 'massive' increase in bytecode footprint sounds like a misnomer. It's doubling a number that's typically tiny compared to the application. There is also no need to keep it all in memory. Once the class has been transformed, you can remove it from your collection of bytecodes that are loaded-but-not-redefined yet. With this approach it would be surprising to have more than a dozen 'pending' classes at a time in memory, on even the worst behaving VMs. So either way it seems trvial to support this - were reduction of memory footprint seems just as trivial, yet highly likely premature optimisation.

For my use case the transformed bytecode needs to be kept around so that future instrumentations have access to it (i.e. they may need to interrogate the instrumented classes as part of their own transformations [Especially relevant due to Javassist's tendency to check the validity of every type referenced in code fragments that it compiles]).

You're right though, doubling the memory footprint of the code is probably not that enormous.... though when it includes every class that the application touches within every library dependency too? (including the Java standard libraries!)
I can see that adding up to at least a few dozen MB's.

Atm the discussion is moot though, as I've encountered a bug relating to this very piece of code.... seems I've misunderstood precisely what retransform does.

:edit:

I thought the byte[] returned by transform(....) overwrote the VM's internal classfileBuffer.
Apparently it doesn't, it must be stored somewhere else alongside it.
So when retransformClasses(class) is called, the 2nd invocation of transform(....) is passed the *original* classfileBuffer. (not the transformed one that had been returned by the previous call to transform(....)).

So looks like I need to keep a copy of all transformed classes anyway, as this information cannot be read back from the VM.
25  Game Development / Newbie & Debugging Questions / Re: Ok to assume Instrumentation#retransformClasses(Class....) is synchronous? on: 2015-05-17 15:59:45
The alternative to this approach would be to store every "classfileBuffer" passed into transform(.....).
However I'm loath to take this approach, because it *might* result in a massive increase memory usage.  (potentially doubling the memory footprint of the program's bytecode)
26  Game Development / Newbie & Debugging Questions / Ok to assume Instrumentation#retransformClasses(Class....) is synchronous? on: 2015-05-17 13:36:02
I'm using this method to read back the byte[] representation of loaded classes.
(for read-only instrumentation requirements, not to actually modify)

The reason I need the in-memory representations (rather than simply grabbing them from the classpath) is 2-fold:
1) some of them will have already been instrumented
2) some of them are defined at run-time, so do not exist in the classpath.

However the javadoc on the method is rather lacking on implementation details.
The Oracle VM certainly executes it synchronously, which means this, while conceptually horrible, works fine:

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  
   private byte[] classBytes;

   /**
    * Reads back from the JVM the byte[] representation of an already loaded class
    *
    * @param className
    *            The name of the class to read back.
    * @param cl
    *            The class loader used to load the class.
    * @return
    */

   synchronized byte[] getClassBytes(String className, ClassLoader cl) {
      try {
         // trigger a retransformation (that will store the class's bytes in
         // classBytes[]
         inst.retransformClasses(cl.loadClass(className));
         byte[] classBytes = this.classBytes;
         this.classBytes = null;
         return classBytes;
      } catch (ClassNotFoundException | UnmodifiableClassException e) {
         throw new RuntimeException("Failed reading back class bytes from the JVM", e);
      }
   }

   @Override
   public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {

      if (classBeingRedefined != null) {
         // this will only be reachable immediately after an invocation of
         // getClassBytes.
         // fingers crossed all implementations execute this synchronously.
         // Oracle's VM certainly does, but the method that causes the call
         // (Instrumentation#retransformClasses)
         // is not very explicit on exactly how it's implemented.
         System.out.println("byte[] read-back for " + className);
         classBytes = classfileBuffer.clone();
         return null;
      }
               //<snip>
   }
27  Game Development / Newbie & Debugging Questions / Re: Creating an instance of an object in Array List supplied by another ArrayList? on: 2015-05-14 08:45:11
I'd advise not getting bogged down with generics.

They're a huge jump in complexity with very little added value; a terrible concept for new developers to waste their time understanding.

Turn off your ide's warnings and avoid using them until you've mastered every other aspect of Java.
28  Discussions / Miscellaneous Topics / Re: Most unusual/weird syntax features in non-joke languages on: 2015-05-11 13:51:05
int [] a [];

17 years of Java, and I still had to check if that was actually valid syntax.
29  Game Development / Networking & Multiplayer / Re: Handling both UDP and TCP input. Multithreading? on: 2015-05-10 10:20:13
Don't use blocking IO; use non-blocking Channels along with a Selector.
30  Game Development / Newbie & Debugging Questions / Re: how to fit a body to a sprite avoiding transparent space? on: 2015-04-10 22:27:46
i mean to remove that part manually with an image editor software, what i´m looking for is a way to do it with code

So you want to crop an Image according to the sprite's minimum bounds?

- Iterate over the source image's pixels, recording the coordinates of the left-most, top-most, right-most & bottom-most non-transparent pixels.
- create a new image, sized according to these coordinates and copy over the source image, offset according to the left/top coords.
Pages: [1] 2 3 ... 69
 
Riven (22 views)
2015-07-03 11:22:16

deepthought (46 views)
2015-06-30 15:39:44

deepthought (49 views)
2015-06-30 15:39:09

deepthought (62 views)
2015-06-30 15:36:52

Za\'Anzabar (33 views)
2015-06-29 05:44:54

TritonDreyja (45 views)
2015-06-24 17:10:40

CopyableCougar4 (44 views)
2015-06-23 00:34:45

BurntPizza (48 views)
2015-06-21 20:36:46

cookiecompiler (90 views)
2015-06-11 15:42:53

cookiecompiler (54 views)
2015-06-11 15:41:14
How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14
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!