Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (623)
Games in Android Showcase (176)
games submitted by our members
Games in WIP (674)
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 ... 299
1  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-03 22:13:09
Math.sin(): 15.01ms
9-bit lookup with interpolation: 4.45ms
6-bit lookup with interpolation: 4.45ms
I am curious as how to 12-bit without interpolation performs. Kiss
2  Game Development / Performance Tuning / Re: Sharing data between threads on: 2015-10-03 11:14:27
Sooo.... does that mean the best thing to do is to have each thread having a local buffer for their own portion of the work and copy that to the render thread when complete?
Memory copies are exceptionally expensive.

As for your case, simply try to have each thread work on data in a set of rows in the grid, not interleaved columns, which would be worst case, obviously). Each row should have its data in a (segment of a) primitive array, say a boolean[] or even a BitSet (which is 8x as memory efficient, although it introduces some computational overhead)

As for whether a 30% performance increase is OK: multi threading introduces some overhead, so it won't help much in small data sets (or few calculations). Try to increase (and later decrease) the grid with factor 4, and see whether that affects the performance gains of multi threading.
3  Game Development / Performance Tuning / Re: Sharing data between threads on: 2015-10-03 11:01:45
What I was wondering is whether there is any penalty getting each thread to write into the same array?  I had assumed that as each thread writes to a different area in the array then that should not suffer any kind of slow down due to the threaded access.  Is that correct?

If thread A writes into
and thread B reads from or writes into
, odds are these values are in the same cache line (which are 64 bytes wide). At this point we get in the realm of false sharing, which you can google if you please. Simply put: try to have your threads not write into memory adjacent to memory that other threads access (reads or writes).
4  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-03 10:48:10
As cache is that important, simply merge the cos and sin lookup tables and test whether that reduces cache-misses to the point the overall performance (in real world tests) increases.

public static float cos(float v) {
   return sin(v + PI2);

with 9 bits, that would use (512+1)*4 = 2052 bytes, which hopefully lies in one 4K page.
5  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-03 10:26:40
Now I can really reduce the bit depth of the lookup table to 6 bits and still have ten times the accuracy of the non-interpolating algorithm.
At such few discrete values (2^6=64, 360/64=5.6deg per value) you start to need to renormalize your interpolated values... I'd say that you'd at least use 8 bits, for game purposes.

cos(0.0deg) = 1.0
sin(0.0deg) = 0.0

cos(5.6deg) = 0.99522739998
sin(5.6deg) = 0.09758289975

cos(2.8deg) = 0.99880613734
sin(2.8deg) = 0.04884976979

dx = (cos(0.0deg) + cos(5.6deg)) * 0.5 = 0.99761369999
dy = (sin(0.0deg) + sin(5.6deg)) * 0.5 = 0.04879144987
err = 1.0 - sqrt(dx*dx + dy*dy)
err = 0.00119386265

this might seem low, but this inaccuracy will quickly propagate up to noticeable errors, not in direction but in magnitude.
6  Games Center / Featured Games / Re: RFLEX *Available on Steam* on: 2015-09-30 15:52:47
Also you could do the drunken mode by switching the controls to the acceleration sensor  Roll Eyes
But what about all those smartphones that will be accidently flung into medium sized ponds due to this game.
7  Game Development / Game Mechanics / Re: How to properly avoid ConcurrentModificationException when running two threads on: 2015-09-29 20:26:49
Wow, thanks for the fast answers guys!

I tried basil_ attempt, and it worked like a charm.
Would not have thought that a basic for loop would not cause that error at all.

Also, thanks for the resources!
You just made the problem worse by supressing and ignoring it.

Instead, try to apply what BurntPizza and jonjava suggested: redesigning the code with the linked resources in mind.
8  Games Center / WIP games, tools & toy projects / Re: Praxis LIVE v2 - live visual / coding env on: 2015-09-28 17:31:46
Unlock request granted Pointing
9  Game Development / Game Mechanics / Re: Case Studies on: 2015-09-28 15:34:42
Monologue granted Pointing
10  Games Center / WIP games, tools & toy projects / Re: TritonForge || 2D RPG Sandbox (DOWNLOAD V2 NOW-AutoUpdater!) on: 2015-09-24 02:08:45
I am confused. What did I watch. Clueless This concept reel is not usable for the target audience of the game.

What do you mean? and It is a bit hard to recognize because i literally just threw together all of the scribbles i had without taking clarification into consideration..

Well, that is exactly what it looks like. Arbitrary stuff thrown together with a random soundtrack (that takes ages to get up to speed). It's like dragging whatever is in the garage on the sidewalk, taking photos of it, making it into a video, and calling it a 'garage content reel'. People are not going to bother unless you engage them.
11  Games Center / WIP games, tools & toy projects / Re: TritonForge || 2D RPG Sandbox (DOWNLOAD V2 NOW-AutoUpdater!) on: 2015-09-24 00:09:13
I am confused. What did I watch. Clueless This concept reel is not usable for the target audience of the game.
12  Game Development / Networking & Multiplayer / Re: Implementing TLS with a NIO client/server on: 2015-09-23 23:57:31
The SSL/TLS handshake is a semi-manual process in NIO. You will be notified of the state of the handshake, and make the appropriate callsbacks to the SSLEngine. Just read the javadocs.

If you prefer handholding, go from here:

You really don't want to go this route. What made you think you needed NIO TLS?
13  Game Development / Newbie & Debugging Questions / Re: Three Dimensional Array 'dupe' glitch on: 2015-09-20 17:27:21
You are creating ONE instance of InventoryCell(null), and put that in every slot of the array.

As the array only holds references, you'll see that changing the data in the InventoryCell instance, will be visible from every slot in the array.

      inventorySpells = new InventoryCell[INV_WIDTH][INV_HEIGHT][2];
      for (InventoryCell[][] square: inventorySpells) {
         for (InventoryCell[] line : square) {
-            Arrays.fill(line, new InventoryCell(null));
+            for(int i=0; i<line; i++) line[i] = new InventoryCell(null);
14  Discussions / General Discussions / Re: Interesting proposals: Java 9 and beyond on: 2015-09-20 10:40:39
Well, it is a truly unusual experience of revolution, after all.
15  Discussions / General Discussions / Re: Programmer jokes on: 2015-09-19 19:46:19
he means: in screen space Z is depth, by definition, while in world space you can make up your own rules. which implies that whether 'Z is up' or 'Y is up', does not affect whether we name the depth-buffer the Z-buffer.
16  Game Development / Networking & Multiplayer / Re: Best conventions for using kryonet on: 2015-09-17 18:19:24
It depends. Clueless
17  Discussions / General Discussions / Re: Interesting proposals: Java 9 and beyond on: 2015-09-13 13:05:13
Doesn't seem that much different to Closeable to me.  Some resources require explicit life-cycle management and direct buffers should have been one of them!
With the exception that mishandling Closeables will cause memory leaks, whereas mishandling malloc/free causes native crashes and/or security issues.
18  Discussions / Miscellaneous Topics / Re: Social Stigma of Game Dev and Peer Pressure on: 2015-09-12 22:03:47
There is this time in your life where it's okay to be socially inept with, say, girls. In this period you are supposed to acquire these skills. Spending that period behind a computer might affect attaining these skills in a timely manner. Before you know you are supposed to have these skills, and you wouldn't want to be empty handed.

Surely it's not all this black and white, but unless you dig being socially awkward with the opposite gender, you actually should care about what people, whose opinion you value, think about you. We are social beings after all... they say.
19  Game Development / Networking & Multiplayer / Re: NitroNet - New, High-Level Networking Library on: 2015-09-12 12:36:53
I decided to peek at the sourcecode, starting with, when I stumbled onto this:

      try {
         tcpSocket = new ServerSocket(tcpPort, 1, InetAddress.getByName(""));
      } catch (IOException e) {
         throw new NNCantStartServer();

A ServerSocket with a
of 1. I have never seen this before and hopefully never will again, as it's a sure way to bounce/drop incoming connections. By default the backlog is 50, I have had busy servers where I had to bump it to 200. A value of one would have gotten me pulled off the project instantly.

Not to meantion line 4 and 5 force log-verbosity, while hiding information (the true cause of the IOException) from the application, which is exactly the opposite of what one would want in a serious application.
20  Game Development / Networking & Multiplayer / Re: NitroNet - New, High-Level Networking Library on: 2015-09-12 11:30:55
The myths in this thread are trivial to debunk.
Socket s = new Socket(...);
OutputStream os = s.getOutputStream();
os.write(new byte[414 * 1024]);

No exception is thrown, all data is sent, there is no need to split your data into tcp-packets by yourself, the TCP layer does that for you.

As for checksums: this is (hopefully!) not about information integrity, but about data integrity. Even with TLS your (generated?) private key is on the client's machine, so it's all hackable. What actually happens IRL however, is that the IP-packet checksum is merely checking the packet header, not the payload. Adding a checksum to the payload is ensuring that the data that the client sent (however malicious) is verifiable by the server as what the client intended to send. CRC32 is enough for this, as we're checking for TCP payload-corruption, not an attack of any sort.

Data integrity, information integrity (signatures) and information secrecy (encryption) are entirely different topics. That SSL/TLS incorporates them all does not imply SSL/TLS is the right tool if one merely needs integrity. If you need information integrity, as to prevent a man-in-the-middle from altering your data, there is no need to add encryption to the mix. You can cryptographically sign raw data just fine and send it over the wire. There is just this pesky problem of which public keys you deem trustworthy to verify the signatures. In the end it's about trusting a session, not a party and especially not a packet.

Anyway, the amount of misinformation on which this library was built, does not bode well for its potential users.
21  Games Center / WIP games, tools & toy projects / Re: TritonForge || 2D RPG Sandbox (DOWNLOAD V1.1 NOW) on: 2015-09-09 11:25:20
Unlock request granted Pointing
22  Game Development / Newbie & Debugging Questions / Re: OpenAL - AL_MAX_DISTANCE on: 2015-09-06 18:13:16
AL_MAX_DISTANCE and 3D effects in general, only work for MONO sources, think about it.

For further reading:
23  Discussions / General Discussions / Re: Interesting proposals: Java 9 and beyond on: 2015-09-06 08:58:00
-  return (int) VERSION.addAndGet(this, 1);
+  return (long) VERSION.addAndGet(this, 1);
24  Games Center / WIP games, tools & toy projects / Re: [libgdx] Cthulhu ftaghn on: 2015-09-01 19:10:19
Granting unlock-request. Pointing
25  Discussions / Miscellaneous Topics / Re: My Latest Project: Wagery on: 2015-08-30 08:38:23
Your Dropbox images are not public - you are the only one who can see them.

Your domainname redirects to, which is accepting connections but timing out.
26  Discussions / Miscellaneous Topics / Re: OpenAL fails on my computer on: 2015-08-27 22:34:05
Am I, as a socially awkward overlord, simply too lenient? For years, hell, probably a decade, Julien has fought this wars of the APIs on JGO, spreading annoyance and misery to those involved. We had to close down entire boards, had to issue countless warnings and moderations (after which Julien threatened to sue JGO into oblivion, and as he has sued websites before, it wasn't an idle threat).

He has been banned, warned again, escorted to the padded room and resided there for months, and then... only weeks later, there are these insinuations, indirect references to 'the others which are different which should not be compared', causing even those among our elite to finally... lash out.

Julien, I am lenient once again, because somehow I feel sorry for you, but this is your last warning: one more insidious remark about the 'profound' difference between LWJGL and JogAmp, and you are out. Forever. Joining only a handful of people that were ever perm-banned on JGO. We can do without the toxicity.
27  Game Development / Newbie & Debugging Questions / Re: About separating game logic from rendering on: 2015-08-26 12:07:26
Take into consideration that this should be considered a guideline, not a holy grail. When you develop your game, you will most likely suck at it at some level, and the code will be a complete mess. This is okay, as long as you learned something developing these small games. People who get stuff done, tend to be less uncomfortable with crappy code.

So don't start refactoring just yet - developing and finishing a game is - at this point - the goal. Keep general guidelines in mind, but by all means don't try to make the renderer swappable. Such things are incredibly hard for developers with a decade of experience under their belt. Ask yourself this: will you port your game to another platform any time soon? If not, don't bother, just get your game playable, that is hard enough as it is, when you're new to the game.
28  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-23 14:06:47
My impression is that here are no optimal values, as we have different CPU brands, controllers, generations, frequencies - same applies for RAM. Then you have all permutations of those. Each system will have its own sweetspot. Redistribution of entities over cells is a relatively cheap operation, as it is O(n), and the operation is cache friendly, as you use a more or less ordered dataset to fill another ordered dataset.

Lets say you adjust the cellsize every 20 frames (3Hz). Then you have a dataset of avg performance over the last 20 frames, and the avg performance over the 20 frames before that. If the performance improved, make the same change you did last time (grow or shrink cell size),  if performance degraded, do the opposite. Outliers will have been averaged out (with 20 frames, their effect is 5%). In the grand scheme of things it is not even bad to guess wrong quite frequently anyway. It will converge back to a more optimal cell size within the next second or so.
29  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-22 21:58:08
I once has this grid that was self-adjusting. Every N frames it would either grow or shrink in cell size, and measure performance differences. It would converge to the optimal solution, and then adjust itself when the environment changed, and converge to the new optimal solution. Give it a try, it is easy to implement.
30  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-21 07:21:18
4) Discovered that FP abs (which ignores negative zeros) really should look like this
as opposed to which implementation?

return Float.intBitsToFloat((Float.floatToRawIntBits(a) & (-1>>>1)));

About three weeks ago I had the same idea, and I'm still not sure why there is a discrepancy between Math.abs(float) and Math.abs(double), according to the javadoc.

Math.abs(float) --> Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))
Math.abs(double) --> Double.longBitsToDouble((Double.doubleToLongBits(a)<<1)>>>1)

The result is the same, but why would you want two shifts instead of one masking operation.
Pages: [1] 2 3 ... 299
basil_ (36 views)
2015-09-30 17:04:40

shadowstryker (17 views)
2015-09-29 15:55:06

TheSpaceHedgehog (23 views)
2015-09-29 01:58:48

GamerC4 (46 views)
2015-09-24 21:10:38

GamerC4 (67 views)
2015-09-24 21:09:48

htuy (22 views)
2015-09-24 04:57:24

htuy (31 views)
2015-09-24 04:56:35

htuy (23 views)
2015-09-24 04:56:09

htuy (22 views)
2015-09-24 04:47:33

Roquen (59 views)
2015-09-21 12:54:28
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

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