Java-Gaming.org Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (611)
Games in Android Showcase (172)
games submitted by our members
Games in WIP (657)
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 ... 70
1  Game Development / Newbie & Debugging Questions / Re: Launching multiple clients - Android Studio + LibGDX on: 2015-08-24 00:32:29
Never used Android Studio (nor IntelliJ IDEA), but if it can't run multiple instances of any given project, it isn't a very well designed IDE.
2  Game Development / Newbie & Debugging Questions / Re: Eclipse, multiple classpaths? on: 2015-08-21 11:21:06
I have Eclipse project A which loads resources found in its project root.

I have Eclipse project B which uses project A. Whenever I execute project B, the resources A tries to load is not found, obviously because it's looking for the resources in project B root rather than A.

How do I address this issue?

For Project A:
"Java Build Path" -> "Order and Export" tab -> check the classpath elements that you wish dependent projects to have access to.
3  Game Development / Game Play & Game Design / Re: Article on pay to win games in Japan on: 2015-08-19 00:24:42
Choosing stupid* people as your target demographic is never a bad business decision. As true in mobile games as in door to door sales.

*I suppose the politically correct term would be 'vulnerable'.
4  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-18 03:22:04
Finally got a deobfuscated & decompiled project running!
No nefarious intent! I'm writing a multiplayer mod (deterministic lockstep) that will be implemented via bytecode instrumentation.
However concocting bytecode injections into obfuscated code for which I have no runnable source was proving to be extremely hard work.
So now that I have compilable source, I'm able to write the mod using regular techniques, and from this construct the instrumentation code necessary for injection into the compiled binaries.

On a related note:
Did you know; nesting interfaces into inappropriate classes is an incredibly simple technique for creating cyclic dependency chains that bork recompilation!
e.g.

A extends B
B implements A.C

legal bytecode; illegal sourcecode.

The solution is deceptively simple though; elevate all static nested member classes/interfaces to be top-tier. (which involves nothing more than removing the innerclass attribute from every class that references them)

Oh, another thing I learnt today; Enum.valueof(Class<T>,String) doesn't use reflection for finding members.
Enum members have their name (and ordinal) passed into the constructor as the 1st & 2nd parameters.

This means you can obfuscate enums without worry of breaking external dependencies that might rely upon the enum names.
Though obviously you shouldn't, because:
1) Obfuscation of the enum member names will introduce new constant pool entries without making the old ones redundant, thus increase class size
2) The redundant information makes deobfuscation trivial anyway.

:edit:

Oh yeah, and I finally understand the bytecode implications of all the different flavours of nested classes (along with their formal names!)

inner class:
1  
2  
3  
class A {
class B {}
}

static nested class:
1  
2  
3  
class A {
static class B {}
}

anonymous class:
1  
2  
3  
4  
5  
class A {
{
new B() {};
}
}

local class:
1  
2  
3  
4  
5  
class A{
{
class B {};
}
}


I must confess - in all my years of Java, I've never encountered a local class.
5  Java Game APIs & Engines / OpenGL Development / Re: Vulkan ETA late 2015, Android support, Apple NOT supported on: 2015-08-17 00:19:13
Apple isn't stupid, they'll do what's best for their business.
6  Game Development / Game Mechanics / Re: How to code a sword swipe? on: 2015-08-16 16:21:02
I want to know what will be the position of A after rotating by 45°, from 0° to 45°

So just a simple rotation?

Translate so the origin of the rotation is @ [0,0], then apply the appropriate maths. (Silly old harry, caught a herring, trawling off America.  Cheesy)

Or better yet use whatever Math API you have to hand; the JDK can do rotation using AffineTransform.

So O is the center point, A is the sword's tip position, and A' is the sword's tip position after rotated by 45°.
The positions are in pixels and I use radians

The question is what is the formula to find the position A have after rotating this way? Grin
Do you mean you want to get back to position A after rotating 45 degrees? If so, just rotate -45 degrees or 315 degrees

Though inverting transforms like that is generally bad practice, as it'll introduce fp imprecision.
7  Game Development / Game Mechanics / Re: How to code a sword swipe? on: 2015-08-16 12:02:08
You don't say what API you're using, so I guess you aren't expecting code.

Regardless, the solution is to transform the polar coordinates of your arc to the Cartesian coordinates of the texture you want to map to it.

In Java2D you'd do this with a custom Paint/PaintContext.
If you look at the source for RadialGradientPaintContext, you'll see roughly what the transformation involves.

:edit:

That said, if it's for 2D, and the arc is always going to be the same, you really should make it part of your art assets - it's far less complex to implement/maintain, and has the potential to look better too.
8  Discussions / General Discussions / Re: Oracle working on an AOT compiler for Java on: 2015-08-14 00:36:41
Tbh I thought that presentation sucked.

This presentation was much better:

https://www.youtube.com/watch?v=uNgAFSUXuwc (completely different topic ofc Smiley
9  Game Development / Networking & Multiplayer / Re: How to deal with different packet sizes? on: 2015-08-11 01:13:11
If you're using TCP, then you're primarily working with streams not packets.

How the data you write to a stream is segmented into packets is (almost) completely beyond your control, and more importantly is completely irrelevant.
All you should care about is that the data you write to the OutputStream on one end, will be read back from the InputStream at the other.

It sounds like you've misunderstood some of the fundamentals.
10  Game Development / Networking & Multiplayer / Re: Fast Paced Multiplayer Interpolation/Extrapolation or both? on: 2015-08-09 12:42:58
http://gdcvault.com/play/1022195/Physics-for-Game-Programmers-Networking

Really good talk.

Given how easy Java makes it to implement deterministic lockstep (w.r.t. strictfp), I'm surprised it's not a more popular choice for Java games - especially with the quite significant downsides of the alternatives. (bandwidth / maintainability)
11  Discussions / General Discussions / Re: Windows 10 on: 2015-08-04 21:17:14
Windows 10 forced me to append "_optout" to my wifi SSID.
That's all I know so far.  Angry

How approachable is Win10's UI for those of us who use Win7 and skin it to work as much like WinXP as possible?

Have they finally sorted out the Explorer UI?
By sorted out, I mean have they got rid of the cluttered, wasteful, redundant (and worst of all compulsory!) Explorer navigation, status, tool & ribbon bars?

That would be the 1 thing that might make me upgrade from Win 7, that and a restored Windows search that is capable of doing *exhaustive* searches.

Basically I want the best bits of Win7 + best bits of WinXP, and none of the shiz that's in Win 8.
Is Win 10 configurable enough to satisfy these desires?
12  Game Development / Newbie & Debugging Questions / Re: My map load parser is taking ages on android on: 2015-07-29 17:44:42
Is there a reason you're using human-readable map files?

Loading 4 bytes into an int is a lot more efficient* than loading half a dozen chars into an array, then parsing them into an int.

*smaller data files, lower peak memory consumption & faster execution.
13  Game Development / Performance Tuning / Re: Optimizing Conway's Game of Life on: 2015-07-24 13:40:02
Ew, all that unnecessary branching (e.g. in setBit )
Clear the bit, then OR it with the desired value. No need for a branch!

Also, while it's probably not your performance bottleneck, it's good practice to only treat your bitsets as bytes when you're putting them into your byte[], in all other cases handle them as ints.
Otherwise the compiler will end up adding implicit casts around operators. (as Java only has operator bytecodes for integer types, not byte types)
14  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-05 00:25:44
Got frustrated by how:
- restrictive consumer zip programs are
- horrible every API is for manipulating zips is

All I wanted to do was set the execute flag for a .sh script inside a zip intended for linux users...

At the lowest level, all that needed to be done was change 2 sets of 2 bytes ('made by' and 'external attributes') in the appropriate file's central directory header entry.
Wishful thinking...... I've not found a single zip API that allows you to manipulate a zip file header in situ.

Java's own zip API is atrocious; lacking functionality (can't set either 'external attributes' or 'made by'), & hopelessly outdated.

I then tried the newer stuff; mount the zip as a FileSystem, and modify the file's attributes using PosixFilePermission.
HA! Unfinished pile of ****; all you get is an UnsupportedOperationException.

Apache's implementation is functionally more complete, though its documentation is practically non-existent and it's still far too inflexible, requiring the zip to be essentially reconstructed from scratch, de+recompress every damn zip entry.

It works.... but it's so incredibly inefficient.
I hate wasting time on such frustratingly trivial issues that have fallen between the cracks of abstraction.
15  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
16  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?
17  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.
18  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....

19  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.
20  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.
21  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
22  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.
23  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.
24  Discussions / Miscellaneous Topics / Re: Free game/addon keys! :) on: 2015-06-16 23:06:06

Redeemed fine, thanks very much!
25  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!
26  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....
27  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)
28  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.
29  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();
         }
      });
   }

}
30  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.
Pages: [1] 2 3 ... 70
 
Roquen (9 views)
2015-08-29 11:30:54

GamerC4 (23 views)
2015-08-22 20:38:50

GamerC4 (22 views)
2015-08-22 20:37:18

GamerC4 (25 views)
2015-08-22 20:37:01

Kefwar (30 views)
2015-08-22 18:07:24

GamerC4 (24 views)
2015-08-22 01:00:24

GamerC4 (37 views)
2015-08-22 01:00:17

GamerC4 (23 views)
2015-08-22 00:57:35

GamerC4 (25 views)
2015-08-22 00:56:59

BurntPizza (29 views)
2015-08-21 01:38:01
HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36

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
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!