Java-Gaming.org Hi !
Featured games (87)
games approved by the League of Dukes
Games in Showcase (672)
Games in Android Showcase (194)
games submitted by our members
Games in WIP (727)
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 ... 305
1  Java Game APIs & Engines / OpenGL Development / Re: LWJGL 3 vs JOGL on: 2016-05-02 19:15:27
Offtopic: passing null to glTexImage2D is tricky, not because it is theoretically incorrect, but it trips up drivers occasionally. Among other issues, it can leave a texture in a state that makes it unusable in an FBO (non-deterministically). I had a loop that created a few hundred FBOs and 1-3% would be 'incomplete' and always render as white. After forcing the textures to be initialized with arbitrary texels, the problem went away. Just allocate 1 buffer in your app and use it to initialize all textures that are not 'naturally' filled with data.
2  Game Development / Game Mechanics / Re: Hardware-like software cursor. on: 2016-05-01 20:16:56
Preferably you would want to smear every gameplay-frame over N render-frames - but... what a contrived solution for a problem that might be fixable in a much more sensible way (aim for 60fps, you can do it!)
3  Game Development / Game Mechanics / Re: Hardware-like software cursor. on: 2016-05-01 16:35:08
I (honestly) was thinking about that solution too - but it makes your (gameplay) framerate issues even worse, especially when vsync is on.

4  Game Development / Game Mechanics / Re: Hardware-like software cursor. on: 2016-05-01 13:15:34
There is no simple solution here. As you expected: either increase the framerate or use the hardware cursor.
5  Games Center / WIP games, tools & toy projects / Re: ExoSim - Exoplanet Simulator (CWSF 2016) on: 2016-04-24 09:32:40
I'd prefer experience over awards. When you have a proper job the former is what matters.
6  Discussions / Jobs and Resumes / Re: [3dFoin] Female centaur - 55% off all items Spring Sale on: 2016-04-16 14:57:56
This is just sexist. Why don't you balance it a bit and have a male mythical creature with 25% of his dick furred up?
7  Discussions / General Discussions / Re: Blog six replies limit on: 2016-04-14 13:25:53
In my opinion it is a disadvantage for readers and writers, if a new thread is started for the same game.
It's not even allowed to have multiple threads for 1 game.

Your options when you run into this 'harsh/unfair' limit:
- You hope somebody posts in your thread
- You just have to request somebody to post in your thread
- You amend your last reply
- You copy the contents of your last post, delete it, add it to a new post, make the post more interesting, add whatever you want.

You can easily play the system, it's trivial. It's just meant as a hint that you might have to change your ways somewhat.
8  Java Game APIs & Engines / Android / Re: Google releases vulkan samples on: 2016-04-14 09:28:01
So I've got to write 800 LOC to draw a triangle? Ridiculous. Short live Vulkan!
And it's still a relatively high level abstraction layer...

Think of the console engines, where engine-developers interact with the GPU directly.
9  Discussions / Miscellaneous Topics / Re: Realistic graphics -- how can it be achieved? on: 2016-04-13 12:56:54
Realism is pretty hard when you've only got 3 wavelengths of light to use to generate colours, too...
Not sure if sarcastic Smiley

But as long as these 3 wavelengths match our eye's 3 types of color-receptors, we're all set for a healthy chunk of virtual realism Smiley



RGB colorspace, however, is indeed a mess, hardly useful for anything, except in the very last phase, on a monitor or image file.
10  Game Development / Networking & Multiplayer / Re: Kryonet hosting? Where and how? on: 2016-04-11 20:40:23
Linode: slightly higher end? lol first time i ever heard that.
Compared to Digital Ocean Pointing
11  Game Development / Networking & Multiplayer / Re: Kryonet hosting? Where and how? on: 2016-04-11 19:37:00
AWS EC2 has a free tier: 750 CPU hours / month for the first year (months with 31 days have 744 hours).

Digital Ocean is nice for cheap but sturdy VPSes.

Linode is slightly higher end, has lots of scripts for you to configure your server with a few clicks.



Those are bare bones Linux boxes though. You'd have to do some sys-admin to get everything to work nicely.
I have no experiences with 'push to deploy' hosters especially for anything else than services running on web-containers (tomcat, jboss, etc) - that may be tricky.

12  Discussions / General Discussions / Re: Blog six replies limit on: 2016-04-11 19:17:06
How can 'odds are...' not be entirely true? (or any other of the sentences in my reply, for that matter). I know right, semantics, but still Tongue
13  Discussions / General Discussions / Re: Blog six replies limit on: 2016-04-11 16:35:44
Like SHC said, JGO should not be used as a blog. If people haven't responded after you made 5 consecutive posts, odds are you're not doing it quite right.
It's okay to reach out to the community to work around this limit, the point of it is mainly to address the issue and hopefully alter the behavior somewhat Wink Even on a technical forum such as this you have to think a little about your 'marketing'.
14  Game Development / Game Mechanics / Re: [SOLVED] Limiting camera rotation? on: 2016-04-11 06:04:49
Please share your solution so that others can build upon it too. Smiley

15  Game Development / Performance Tuning / Re: Fastest binary search on 4GB worth of long[] on: 2016-04-08 10:49:30
Depending on what the "important" operations are, there's also bloom-filters.
Interesting concept.

There are no important operations though, as I don't have a use-case yet where a factor 3 performance increase in memory access is actually meaningful. Whatever accesses this read-only 'index' is going to be the bottleneck.
16  Game Development / Performance Tuning / Re: Fastest binary search on 4GB worth of long[] on: 2016-04-08 10:09:13
Big-O notation is about performance degradation over a growing data-set. O(1) can be dreadful.

Hashing is not so usable for 1:N indexes. You'd need a fairly large data-structure behind every hash-key, and how do you optimize that?

Also, you can't traverse (in-order) a hashed data-structure.


Anyway, I'll give it a shot, for direct lookups (when time permits).
17  Game Development / Performance Tuning / Re: Fastest binary search on 4GB worth of long[] on: 2016-04-08 10:05:59
The break even point for linear vs binary-search is:

*drum roll*

1  
2  
3  
4  
long[12]

norm took 3.757029ms (100%, 49906K op/s)
linr took 3.698955ms (101%, 50689K op/s)


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
   private static int linearSearchLo(long[] data, long key) {
      for (int i = 0; i < data.length; i++) {
         if (data[i] == key) {
            return i;
         }
         if (data[i] > key) {
            return -(i + 1);
         }
      }
      return -(data.length + 1);
   }
18  Discussions / General Discussions / Re: SMF is falling apart. on: 2016-04-08 10:04:59
You are working way too hard. I only have a 42hr week including travel, and I still get next-to-nothing else done!
But you have kids to hunt down.
19  Game Development / Performance Tuning / Re: Fastest binary search on 4GB worth of long[] on: 2016-04-08 09:37:30
Data-set
Linear ops/s
Naive binary search ops/s
Hierarchical binary search ops/s
512 MB
50 ops/sec
1,097,000 ops/sec
2,702,000 ops/sec
4096 MB
6 ops/sec
667,000 ops/sec
2,027,000 ops/sec

I killed the process... would have taken eons.
20  Game Development / Performance Tuning / Re: Fastest binary search on 4GB worth of long[] on: 2016-04-08 09:21:22
That's still a binary search time in norm isn't it? I mean literally this:
1  
for (int i = 0; i < in.length; i ++) if (in[i] == findThis) return i;
Arg... I should learn to read. But then again, it's a mad suggestion! Pointing

Are you suspecting that the reduced cache-trashing of a linear search may be in the same ball-park as a cache-trashy binary search? Madness, I tell you! Tongue

I just added it, and it struggles with the 'sanity-check' already - not with correctness, but with performance. I'll report back when my poor CPU finished the benchmark on the 512MB data-set, 4GB may take a few days.
21  Game Development / Performance Tuning / Re: Fastest binary search on 4GB worth of long[] on: 2016-04-08 09:08:36
I do this sort of thing all day long at work, and they pay me for it!
What I wouldn't give for such a job! I'm integrating stuff into other stuff, and mapping stuff to stuff.
Meetings, presentations, politics, getting everybody to agree. Pays big bucks, drains the soul.


But as you've got a bit of spare time, how about you give us the raw speed of the naive search algorithm (that is, scan 4gb of sorted longs linearly in memory).

1  
2  
3  
4  
5  
norm took 12564ms (100%, 667K ops/s) // <--- naive binarySearch, finding *lowest* index of value
rec1 took 8137ms (154%, 1030K ops/s)
rec2 took 5306ms (236%, 1580K ops/s)
rec3 took 4962ms (253%, 1690K ops/s)
rec4 took 4137ms (303%, 2027K ops/s) // <--- 4 layers of indirection
22  Discussions / General Discussions / Re: SMF is falling apart. on: 2016-04-08 08:46:43
Is JGO2 still in the pipeline, or is it on hold?

@Riven

Both. Work takes up 14h/day (including travel), in weekends I maybe have 1-2 hours free per day. It's hard to get anything done. That QuickBinarySearch thingy was the first code I wrote in my spare time in 2 months...
23  Game Development / Performance Tuning / Re: Fastest binary search on 4GB worth of long[] on: 2016-04-08 08:27:31
I don't want no stinkin' medals, I want competition! Kiss

Nobody's up for a challenge? Nobody? Surely your fingers must be itching.
24  Game Development / Performance Tuning / Re: Fastest binary search on 4GB worth of long[] on: 2016-04-07 19:53:43
Ah, it's not that complex Smiley

Let's say you do a binary search, and find your cache to be trashed.
Now shrink the ordered data-set, by taking every n-th value.
Perform the binary search on that smaller data-set.
You now have an index at which (after scaling up) you can expect the value to be in the larger data-set.
Now do a binary search on the larger data-set within a very small range.

Rinse and repeat, until the smallest data-sets fits into L1-cache, and the second in L2-cache.
25  Game Development / Newbie & Debugging Questions / Re: Exception in thread "Thread-0" java.lang.IllegalArgumentException: input == null on: 2016-04-07 19:32:33
The new error is unrelated, you are specifying 0 or less as width to the SpriteSheet.crop() function - which calls getSubImage() - which complains about nonsensical input.
26  Game Development / Performance Tuning / Fastest binary search on 4GB worth of long[] on: 2016-04-07 18:49:06
I had an hour to spare, and decided to write and optimize something that I did not need.
I decided to try to make Arrays.binarySearch(...) less cache-trashy.

I also changed the specification of my binarySearch algorithm a bit, to make it behave more like a traversable database-index, by demanding it must return the lowest index of a specific value in the array, in case the value occurs multiple times.

My initial (hierarchial) approach shows (on average) performance 3.1x as fast as a naive implementation:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
Creating data-set...
Generating random values...
Sorting data-set...
Generating lookup indices...
Generating lookup tables...
Printing table lengths...
67108864
2097152
65536
2048
64
Performing sanity-checks...
Starting benchmark...

...

norm took 955ms (100%, 1097K ops/s)
rec1 took 610ms (156%, 1718K ops/s)
rec2 took 523ms (182%, 2004K ops/s)
rec3 took 505ms (189%, 2076K ops/s)
rec4 took 388ms (246%, 2702K ops/s)

...


4GB: (die hard mode)
1  
2  
3  
4  
5  
6  
7  
8  
9  
...

norm took 12564ms (100%, 667K ops/s)
rec1 took 8137ms (154%, 1030K ops/s)
rec2 took 5306ms (236%, 1580K ops/s)
rec3 took 4962ms (253%, 1690K ops/s)
rec4 took 4137ms (303%, 2027K ops/s)

...


Die-hards are supposed to set
isDiehard
to
true
.
Who feels like wasting some time squeezing even more single threaded performance out of this puppy?
Low hanging fruits are frowned upon, but graciously incorporated!

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  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
import java.util.Arrays;
import java.util.Random;

public class QuickBinarySearch {
   public static void main(String[] args) {
      Random rndm = new Random(1235L);

      boolean isDiehard = false; // 4 GB (512 MB for whips)

      System.out.println("Creating data-set...");
      long[] somedata = new long[(isDiehard ? 512 : 64) * 1024 * 1024];

      System.out.println("Generating random values...");
      for (int i = 0; i < somedata.length; i++) {
         somedata[i] = Math.abs(rndm.nextLong()) % somedata.length * 8;
      }

      System.out.println("Sorting data-set...");
      Arrays.sort(somedata);

      System.out.println("Generating lookup indices...");
      long[] lookups = new long[somedata.length / 64];
      for (int i = 0; i < lookups.length; i++) {
         lookups[i] = somedata[rndm.nextInt(somedata.length)] + rndm.nextInt(10) - 5;
      }

      System.out.println("Generating lookup tables...");

      final int shift = 5;
      long[] reduced1 = new long[somedata.length >> (shift * 1)];
      long[] reduced2 = new long[somedata.length >> (shift * 2)];
      long[] reduced3 = new long[somedata.length >> (shift * 3)];
      long[] reduced4 = new long[somedata.length >> (shift * 4)];

      reduce(somedata, reduced1, shift);
      reduce(reduced1, reduced2, shift);
      reduce(reduced2, reduced3, shift);
      reduce(reduced3, reduced4, shift);

      System.out.println("Printing table lengths...");
      System.out.println(somedata.length);
      System.out.println(reduced1.length);
      System.out.println(reduced2.length);
      System.out.println(reduced3.length);
      System.out.println(reduced4.length);

      System.out.println("Performing sanity-checks...");
      {
         for (int i = -1_000_000; i <= 1_000_000; i++) {
            int i1 = binarySearchLo(somedata, i);
            int i2 = binarySearchLo(somedata, reduced1, shift, i);
            int i3 = binarySearchLo(somedata, reduced1, reduced2, shift, i);
            int i4 = binarySearchLo(somedata, reduced1, reduced2, reduced3, shift, i);
            int i5 = binarySearchLo(somedata, reduced1, reduced2, reduced3, reduced4, shift, i);
            if (i1 != i2)
               throw new IllegalStateException();
            if (i1 != i3)
               throw new IllegalStateException();
            if (i1 != i4)
               throw new IllegalStateException();
            if (i1 != i5)
               throw new IllegalStateException();
         }
      }

      int dummy = 0;
      System.out.println("Starting benchmark...");
      for (int k = 0; k < 8; k++) {
         System.out.println();
         long normTook;
         {
            long t0 = System.nanoTime();
            for (long lookup : lookups) {
               dummy += binarySearchLo(somedata, lookup);
            }
            long t1 = System.nanoTime();
            long took = (t1 - t0) / 1_000_000L;
            System.out.println("norm took " + took + "ms (100%, " + (lookups.length / took) + "K ops/s)");
            normTook = took;
         }
         {
            long t0 = System.nanoTime();
            for (long lookup : lookups) {
               dummy += binarySearchLo(somedata, reduced1, shift, lookup);
            }
            long t1 = System.nanoTime();
            long took = (t1 - t0) / 1_000_000L;
            System.out.println("rec1 took " + took + "ms (" + (int) (normTook * 100.0f / took) + "%, "
                  + (lookups.length / took) + "K ops/s)");
         }
         {
            long t0 = System.nanoTime();
            for (long lookup : lookups) {
               dummy += binarySearchLo(somedata, reduced1, reduced2, shift, lookup);
            }
            long t1 = System.nanoTime();
            long took = (t1 - t0) / 1_000_000L;
            System.out.println("rec2 took " + took + "ms (" + (int) (normTook * 100.0f / took) + "%, "
                  + (lookups.length / took) + "K ops/s)");
         }
         {
            long t0 = System.nanoTime();
            for (long lookup : lookups) {
               dummy += binarySearchLo(somedata, reduced1, reduced2, reduced3, shift, lookup);
            }
            long t1 = System.nanoTime();
            long took = (t1 - t0) / 1_000_000L;
            System.out.println("rec3 took " + took + "ms (" + (int) (normTook * 100.0f / took) + "%, "
                  + (lookups.length / took) + "K ops/s)");
         }
         {
            long t0 = System.nanoTime();
            for (long lookup : lookups) {
               dummy += binarySearchLo(somedata, reduced1, reduced2, reduced3, reduced4, shift, lookup);
            }
            long t1 = System.nanoTime();
            long took = (t1 - t0) / 1_000_000L;
            System.out.println("rec4 took " + took + "ms (" + (int) (normTook * 100.0f / took) + "%, "
                  + (lookups.length / took) + "K ops/s)");
         }
      }
      System.out.println("dummy:" + dummy);
   }

   public static int binarySearchLo(long[] data1, long[] data2, long[] data3, long[] data4, long[] data5, int shift,
         long lookup) {
      int idx = binarySearchLo(data2, data3, data4, data5, shift, lookup);
      return binarySearchLoNextLevel(data1, idx, shift, lookup);
   }

   public static int binarySearchLo(long[] data1, long[] data2, long[] data3, long[] data4, int shift, long lookup) {
      int idx = binarySearchLo(data2, data3, data4, shift, lookup);
      return binarySearchLoNextLevel(data1, idx, shift, lookup);
   }

   public static int binarySearchLo(long[] data1, long[] data2, long[] data3, int shift, long lookup) {
      int idx = binarySearchLo(data2, data3, shift, lookup);
      return binarySearchLoNextLevel(data1, idx, shift, lookup);
   }

   public static int binarySearchLo(long[] data1, long[] data2, int shift, long lookup) {
      int idx = binarySearchLo(data2, lookup);
      return binarySearchLoNextLevel(data1, idx, shift, lookup);
   }

   public static long[] reduce(long[] data, int shift) {
      long[] lookup = new long[data.length >> shift];
      reduce(data, lookup, shift);
      return lookup;
   }

   public static void reduce(long[] src, long[] dst, int shift) {
      if (src.length != (dst.length << shift)) {
         throw new IllegalStateException();
      }
      for (int i = 0; i < dst.length; i++) {
         dst[i] = src[i << shift];
      }
   }

   private static int binarySearchLoNextLevel(long[] data, int idx, int shift, long lookup) {
      idx = (idx >> 31) ^ idx;

      // int min = Math.max(0, (idx - 1) << shift);
      int min = (idx - 1) << shift;
      min &= ~(min >> 31);

      int max = Math.min(data.length, (idx << shift) + 1);

      return binarySearchLo(data, min, max, lookup);
   }

   private static int binarySearchLo(long[] a, long key) {
      return binarySearchLo(a, 0, a.length, key);
   }

   private static int binarySearchLo(long[] a, int fromIndex, int toIndex, long key) {
      int low = fromIndex;
      int high = toIndex - 1;

      while (low <= high) {
         int idx = (low + high) >>> 1;
         long val = a[idx];

         if (val < key)
            low = idx + 1;
         else if (val > key)
            high = idx - 1;
         else if (idx != fromIndex && val == a[idx - 1])
            high = idx - 1; // find lower index
         else
            return idx; // lowest index with value
      }
      return -(low + 1);
   }
}
27  Game Development / Newbie & Debugging Questions / Re: Exception in thread "Thread-0" java.lang.IllegalArgumentException: input == null on: 2016-04-07 10:43:53
I probably (didn't test...) fixed the Exception that was thrown in the utility.

See first post, use snippet: v1.1
28  Game Development / Networking & Multiplayer / Re: Kryonet packet identifying on: 2016-04-06 15:45:23
Obfuscating is indeed a poor, sometimes horrific solution, but:
And now it is a PITA to inspect stack traces and stuff.
there's an app for that Pointing You'd simply recover the original stacktrace.
29  Games Center / WIP games, tools & toy projects / Re: Bit Siege - 2D Competitive Multiplayer PvP Game. (Patch v1.6 out now!) on: 2016-04-05 08:50:50
Unlocked Pointing
30  Discussions / Miscellaneous Topics / Re: Unsolicited blank CD in post - huhh? on: 2016-04-05 07:08:40
I did stick it in my computer, but in a new computer disconnected from the network that I can happily wipe and reinstall windows on. It's a blank CD.
You know a modern virus can survive an OS reinstall right? (they have been know to infect laptop battery firmware, for one). I wouldn't have done it, but then again, I'm weird.
Pages: [1] 2 3 ... 305
 
IanParcs (49 views)
2016-04-18 14:18:53

KaiHH (47 views)
2016-04-18 08:35:41

KaiHH (77 views)
2016-04-15 12:43:58

theagentd (81 views)
2016-04-14 02:16:17

theagentd (95 views)
2016-04-14 02:15:43

IanParcs (110 views)
2016-04-12 03:51:16

IanParcs (49 views)
2016-04-12 03:50:03

IanParcs (45 views)
2016-04-12 03:49:54

IanParcs (42 views)
2016-04-12 03:49:52

IanParcs (50 views)
2016-04-12 03:49:52
Website offering 3D Models specifically for games for free
by vusman
2016-04-29 12:56:17

List of Learning Resources
by SilverTiger
2016-02-05 09:39:47

List of Learning Resources
by SilverTiger
2016-02-05 09:38:38

List of Learning Resources
by SilverTiger
2016-02-05 09:35:50

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