Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (636)
Games in Android Showcase (178)
games submitted by our members
Games in WIP (685)
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 / Networking & Multiplayer / Re: Introduction to Network multiplayer game in Java on: 2015-10-22 11:31:06
Write a latency port forwarder! That's what I did  Pointing

- XML document that describes which protocols/ports/ranges are forwarded to which destination(s), and with what latency range & packet loss probability.
- port forwarder configures itself according to the document, and sits in the background buffering & forwarding traffic.

It's useful in 2 regards:
- It'll familiarize you with NIO's Channels, Selectors, and the necessary threading structure.
- It'll be a useful tool for when you come to write a future realtime multiplayer game, and want to emulate different connection conditions. (high latency, high packet loss, highly variable latency, asymmetric latency, etc etc)
2  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-10-20 17:13:04
Finished making this goliath for my 4yo nephew:

Base is Mary Berry's chocolate sponge cake. (3 layers, 10 inch)
Tower is sculpted from a Rice Krispies/butter/melted marshmallow mix.

Nom nom nom...


Excuse the chandeliers in the background; my sister has no taste Roll Eyes
3  Game Development / Networking & Multiplayer / Re: 1v1 real-time game - UDP - resending player's lost position packets on: 2015-10-20 01:13:25
If it's only 1v1, there's no need for an authoritative server; take the simple route and make it deterministic lockstep between equal peers.
Much simpler to implement and lower bandwidth requirements, though less flexible if the scope of your project changes.
4  Discussions / Miscellaneous Topics / Re: Generating .java file before compilation during build time on: 2015-09-02 10:46:35
I avoid preprocessors wherever possible, as it interferes with other tools that expect well formed Java source.
You can achieve the same effect with:
  • platform specific implementations of classes that are substituted in as part of the build process
  • platform specific constants that alter behaviour of shared classes(the constants themselves being contained within the aforementioned platform specific classes)

You can even have a form of inheritance with your constants via hiding.

Ideally though, you should write your code in such a way as it'll work on both platforms without need to rebuild it.
5  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.
6  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.
7  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'.
8  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!

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.


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

inner class:
class A {
class B {}

static nested class:
class A {
static class B {}

anonymous class:
class A {
new B() {};

local class:
class A{
class B {};

I must confess - in all my years of Java, I've never encountered a local class.
9  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.
10  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.
11  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.


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.
12  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: (completely different topic ofc Smiley
13  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.
14  Game Development / Networking & Multiplayer / Re: Fast Paced Multiplayer Interpolation/Extrapolation or both? on: 2015-08-09 12:42:58

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)
15  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?
16  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.
17  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)
18  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.
19  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.


Oh never mind, read a bit further down the petition and saw that's almost exactly what they're doing Smiley
20  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?
21  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.
22  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....

23  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.
24  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.
25  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
26  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.
27  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):
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.
28  Discussions / Miscellaneous Topics / Re: Free game/addon keys! :) on: 2015-06-16 23:06:06

Redeemed fine, thanks very much!
29  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!
30  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?


Quick search turned up this:

So I guess I'm not the only one....
Pages: [1] 2 3 ... 70
Dwinin (60 views)
2015-11-07 13:29:08

Rems19 (73 views)
2015-10-31 01:36:56

Rems19 (65 views)
2015-10-31 01:32:37

williamwoles (102 views)
2015-10-23 10:42:59

williamwoles (88 views)
2015-10-23 10:42:45

Jervac_ (102 views)
2015-10-18 23:29:12

DarkCart (129 views)
2015-10-16 00:58:11

KaiHH (112 views)
2015-10-11 14:10:14

KaiHH (150 views)
2015-10-11 13:26:18

BurntPizza (164 views)
2015-10-08 03:11:46
Rendering resources
by Roquen
2015-11-13 14:37:59

Rendering resources
by Roquen
2015-11-13 14:36:58

Math: Resources
by Roquen
2015-10-22 07:46:10

Networking Resources
by Roquen
2015-10-16 07:12:30

Rendering resources
by Roquen
2015-10-15 07:40:48

Math: Inequality properties
by Roquen
2015-10-01 13:30:46

Math: Inequality properties
by Roquen
2015-09-30 16:06:05

HotSpot Options
by Roquen
2015-08-29 11:33:11 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‑
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!