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 ... 159
1  Game Development / Newbie & Debugging Questions / Re: Problem with splitting BufferedImage on: 2015-08-14 05:44:30
I don't see where you are drawing to the BufferedImage. Of course the internal array is going to be all 0's when you first create it, so all black.
2  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-08 01:23:27
You had to ask? Isn't that the whole point of an internship? Usually companies hire interns as a source of future employees. My manager's manager offered me a permanent position by himself, explaining this fact to me.
3  Game Development / Newbie & Debugging Questions / Re: UDP packet ~1400 byte maximum on: 2015-07-26 20:04:58
That's a hard limit of the packet size so there is no way around it. As for splitting size, I want to say pack as much as possible into a packet but that might increase the rate at which you lose packets. Try different max sizes and see what kind of drop rate you get.
4  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-26 07:38:07
Ahhh this makes sense. 5 registers is insane though, I'm curious how it does it!
Inlining, simple good old liveness analysis and instruction reordering. See here for liveness analysis: http://www.cs.colostate.edu/~mstrout/CS553/slides/lecture03.pdf.
Once the liveness of variables are known, the jit can allocate registers. And it only needs at max 'n' registers where 'n' is the maximum variables that are alive at any given moment.
Liveness analysis also outputs "gaps", that are instructions where a variable is actually not alive (i.e. not needed).
So before actually doing register allocation, other instructions can be reordered before the first or after the last usage of these identified live variables to allow those registers to become free for those instructions.

Oh wow I need to remember to take some Data-Flow Analysis and Compiler classes! That was incredibly interesting, thanks for the link!

@KaiHH
Nice idea with the JOML-2D branch.
Thanks! Smiley

Now about the earlier discussion with absolute vs relative, should we go ahead with having get(buffer)/set(buffer) be relative while get(index, buffer)/set(index, buffer) be absolute? I'm working on those changes and will submit a pull request if that's the final decision.
I'm not quite sure if there is a final decision, or if there can be any.

The last thing mentioned in the topic was yourself showing the example API and sounding decided. I'll add the missing Byte/Float/Double-Buffer methods and wait for a decision Cheesy
5  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-25 21:25:51
I understand your points and see where you're coming from, but I'm coming from the standpoint of how NIO was supposed to be used (ignoring Riven's distaste for it Grin).

NIO made so many new things possible when it was released (including LWJGL). But it also is just a plain bad API. I mean no disrespect to the people that wrote it, they did what they had to do at the time. I mostly blame the platform/industry that makes it so hard to fix/replace standard APIs.

There are many high-profile developers that are looking for a NIO replacement these days. Look for the sun.misc.Unsafe drama that's been unfolding recently (it's being hidden away in Java 9, without a complete replacement) and you'll find several references to why NIO needs a redesign.

I really don't think NIO has that bad of an API design though.... but yeah I've been following the Unsafe drama. I hope Oracle puts in a suitable replacement if they do remove it.

Or did you refer to the optimization of less CPU registers being used as all the values wouldn't need to be stored in registers until they are all evaluated?

This. More info:

The optimized code (without the method call) needs a couple of registers to do the whole thing. But it's not massively faster than the alias-sensitive call. One would think that the method call pushes the arguments to 16 registers or the stack. But it's much better than that. The JIT does a fantastic job with reordering operations, such that it works correctly (when argument = dest) and also the registers required are as few as possible. IIRC it does the job in 5 registers, last time I checked. This is also the reason that using Unsafe (e.g. via LibStruct) does not result in better performance*: the JVM never reorders Unsafe accesses and the resulting code is suboptimal.

* pure CPU performance, ignoring the better cache utilization that LibStruct enables

Ahhh this makes sense. 5 registers is insane though, I'm curious how it does it!


@KaiHH
Nice idea with the JOML-2D branch.

Now about the earlier discussion with absolute vs relative, should we go ahead with having get(buffer)/set(buffer) be relative while get(index, buffer)/set(index, buffer) be absolute? I'm working on those changes and will submit a pull request if that's the final decision.
6  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-24 00:19:45
1 flip() after filing my buffer is better than continuously setting the position, and it is especially less error prone in case I add another get(buffer) in there in complex code and forget to adjust the position increment properly.

There's probably not a right answer here and comes down to personal opinion. My personal opinion is:

- Having to deal with flip() means having to mentally track two variables; position and limit. This is more complex than dealing with position() only.
- Having a method call mutate arguments (i.e. changing a buffer's current position) is fundamentally bad practice and bad API design. I don't know about you, but I can reason better about method calls that are free of side-effects and any mutations to my objects are explicit.
- Last but not least, I've spent 12 years of my life reading posts on the LWJGL forum about people forgetting to .flip() a buffer.

I understand your points and see where you're coming from, but I'm coming from the standpoint of how NIO was supposed to be used (ignoring Riven's distaste for it Grin). Either way, providing both relative and absolute methods would be best in my opinion.

Ah you misunderstood me as you worded my intentions exactly. I did notice how this.m00 is read after dest.m00 has been set, which is why the conditional is there to make sure it's not written to before it is read again in the case the destination is the same as either operands. I wasn't arguing for the inlining, I was arguing that avoiding a function call by adding a branch is not worth it as the function call will most likely be inlined by Hotspot anyway.

I must still be misunderstanding you. As I explained above, you cannot use a method call there as that would lead to different semantics (and defeat the optimization).

Ahhh I missed that part. Hmm different semantics I agree, but how would the optimization be defeated? this.m00 is still read 3 times using the method call so that could be optimized just as well. Or did you refer to the optimization of less CPU registers being used as all the values wouldn't need to be stored in registers until they are all evaluated?
7  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-23 23:57:05
Oh I like Riven's idea: a separate NIO Buffers class that deals with Buffer -> Vector/Matrix and Vector/Matrix -> Buffer. I support this idea, and we can then have both relative and absolute methods there for reading/writing.

After giving this much thought, I realized how annoying the code would be with a separate class. Calling a get(...) on the instance itself is much more elegant, at the cost of "bloat"... however....

This would raise the question of how likely JOML is going to be used without a Java/OpenGL binding, in such a way that having NIO buffer methods in the matrix classes would actually "pollute" those classes. That I honestly cannot tell. But I guestimate: not very likely.
...
So, I would currently like to leave the NIO buffer conversion methods in the matrix classes, because as I see it, that supports the anticipated use case of JOML being used with LWJGL/JOGL.

... Kai is right. This library is meant for use with OpenGL in Java, with the two major libraries, LWJGL and JOGL, using NIO buffers thus they should be integrated into the core math classes.
8  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-23 03:07:51
Note that all those increments, rewinds and flips do memory writes. They do have an unnecessary performance cost.

Memory writes = only the position, limit, and/or mark variables so not really. Also most of my use cases aren't for uploading 1 Vector/Matrix to GL, it's for filling up a big buffer of many Vectors/Matrices. It's much cleaner for me to do:
for(MyObject m : objects)
    m.position.get(buffer);
buffer.flip();

than
int position = 0;
for(MyObject m : objects) {
    m.position.get(position, buffer); // assuming Vec4
    position += 4;
}


1 flip() after filling my buffer is better than continuously setting the position, and it is especially less error prone in case I add another get(buffer) in there in complex code and forget to adjust the position increment properly.

It's not about inlining. Besides, if you used dest.set(...), then there would be no difference between the two branches.

It's about semantics. With dest.set(...) you're ensuring that all arguments will be evaluated before any memory write happens in the destination. Even if the method call is inlined, this invariant will make it all the way to the JITed code. The conditional detects that there's no aliasing and the semantics can be different: note how this.m00 is read 3 times after dest.m00 has been written to. This results in more efficient code (less CPU registers required).

The increased bytecode size and the branch itself have a cost though, which may negate any benefits. It might be better to offer a version of mul with explicit no-aliasing semantics. The user would be responsible to use it when appropriate.


Ah you misunderstood me as you worded my intentions exactly. I did notice how this.m00 is read after dest.m00 has been set, which is why the conditional is there to make sure it's not written to before it is read again in the case the destination is the same as either operands. I wasn't arguing for the inlining, I was arguing that avoiding a function call by adding a branch is not worth it as the function call will most likely be inlined by Hotspot anyway.
9  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-22 10:19:19
- Why did you choose to not increment the buffer's position:
This was chosen to be compliant with how LWJGL is doing it. Since those methods are likely being used to get a Matrix4f into a ByteBuffer before uploading it to OpenGL, incrementing the buffer's position would require the client to do a rewind(), flip(), position(int), clear() on the buffer before handing it to a Java/OpenGL binding.

Ahh makes sense... although I did not like that design at all either Smiley


- Why do the Matrix/Vector constructors not call the functions their respective methods:
This was rather some insignificant design detail, but I think I thought about Effective Java's Item 17, which states that a class should be designed for inheritance, or forbid it. JOML is designed for inheritance (for whichever reason Smiley ) and therefore allows to override the Matrix4f and other classes including its methods. This would be dangerous had the constructor called an overridden method. That's the point of Item 17.

Design principles getting in the way of clean code! Tongue I see the reasoning though, thanks.


- Is a conditional really cheaper than calling 'dest.set(...)':
I honestly don't know. Smiley Maybe someone can try it out. Just did it this way, because it reads a little bit better in the case where dest != this.

Readability should be no excuse for adding a branch to critical code Smiley .... I'll write a small benchmark next time i have a chance although I expect the impact is minimal.
10  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-22 09:55:02
I've been lurking and watching this thread for a while, and I want to finally post saying that I'm really liking this library after looking through its code for a bit.

Quick questions I had:
- Why did you choose to not increment the buffer's position in the constructors and methods that read from/write to NIO Buffers?
- Why do the Matrix/Vector constructors not call the functions their respective methods rather than re-implementing the same operation?
- Is a conditional really cheaper than calling 'dest.set(...)', especially considering Hotspot inlines aggressively: https://github.com/JOML-CI/JOML/blob/master/src/org/joml/Matrix4f.java#L492

Some inconsistencies (I'll be making a pull request for these):
- Some classes are missing constructors reading from Buffers
- Some classes use both ByteBuffer and FloatBuffer and some only FloatBuffer and some missing Buffers outright
11  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-04 10:53:48
Hehe another update.... we just finished an 8-bit full adder:
12  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-04 05:20:28
NegativeZero and I have built a 1-bit full adder in a minecraft server I setup.
A and Carry-In are on, thus Out is off and Carry-Out is on. (Click for full resolution)
13  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-05-31 10:32:05
Only 400? Try a few hundred thousand Grin
14  Discussions / General Discussions / Re: Four hour downtime as mysql tumbled on: 2015-05-30 23:23:04
He's like some sort of wizard or something....
15  Discussions / General Discussions / Re: Four hour downtime as mysql tumbled on: 2015-05-29 06:48:03
Aren't team building exercises fun?? Don't you enjoy building lasting relationships with your coworkers? They're such a productive use of time! Cranky
16  Discussions / General Discussions / Re: What's your day job? on: 2015-05-28 06:18:55
Oh man, almost same exact job here: doing web dev with mostly backend programming. I have 2 monitors, a beast of a desktop, a pretty large cubicle containing a massive desk.... but no business cards Sad
17  Discussions / General Discussions / Re: What's your day job? on: 2015-05-27 07:53:04
I started an internship with Citrix last week! I'm now a software development engineer intern and I'm loving it!
18  Discussions / General Discussions / Re: Rayvolution's JGO Appreciation Thread (AKA: Free copies of Retro-Pixel Castles!) on: 2015-05-27 07:01:36
Damn... I already bought a copy... too late to the party Tongue
19  Game Development / Game Mechanics / Re: Voxel Collisions? on: 2015-05-08 15:49:07
Break it down into what two shapes you want to test for: you want a "player" vs "block" I'm assuming? Both can have simple bounding boxes and the math is straightforward to look up and implement (AABB is your best bet). Minecraft's blocks are regularly placed, which means there is no need to loop through every single block: just use the player's location to determine the location of the blocks around him and check against those.
20  Game Development / Game Mechanics / Re: Voxel Collisions? on: 2015-05-08 06:52:11
To decrease the amount of collision detection you have to do, first divide your world into segments. The simplest way voxel engines do it (including Minecraft) is using 'chunks': an WxHxD 'chunk' of blocks that have a defined boundary. You first find which chunk the object you are testing is in, then you can either subdivide again if the chunk is large enough, or you can check against each block. Alternatively, if the blocks are laid in a repeating fashion, collision detection can be done in O(1) time to find the location of the block the object is supposed to be in, and testing against that.

Google is your friend for the math part of testing if a point is inside a box.
21  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-05-06 20:53:10
Got portals working!!

<a href="http://www.youtube.com/v/jCbQDq2ubPg?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/jCbQDq2ubPg?version=3&amp;hl=en_US&amp;start=</a>
22  Game Development / Newbie & Debugging Questions / Re: Instanced Rendering LWJGL on: 2015-05-05 02:56:41
There's no setup for it, all you do is call
glDraw*Instanced
with instancecount set to how many copies you want. That's all.
When using instanced rendering with shaders, you can also have attributes that are unique per instance instead of per vertex using
glVertexAttribDivisor
.

If you need more documentation on these functions, a simple google search with just the function name should yield you with an opengl.org site.
23  Discussions / General Discussions / IRC Channel for Java-Gaming.org on: 2015-04-13 03:36:51
Hello everybody!

This is an announcement to hopefully make more people aware of our very own IRC channel for JGO, appropriately called #java-gaming on the Freenode server.

If you don't know what IRC is: it stands for Internet Relay Chat and works by having chat "channels" on a server. On public servers such as Freenode, no registration is needed, except for choosing a username to be known by. You connect to an IRC server by using an IRC client that you download but there are also web clients.

Here's a link to the Freenode web client. If you want to stay with us long-term, I highly recommend using a good desktop client, such as Hexchat (my favorite), Pidgin, irssi, and countless more! There's even Android clients such as Andchat!

See you there!
ra4king
24  Discussions / General Discussions / Re: What's your day job? on: 2015-04-04 16:56:14
I'm a student at Georgia Institute of Technology in Atlanta, and I'm a paid Teaching Assistant. It's pretty fun!
25  Game Development / Newbie & Debugging Questions / Re: Avoiding JOGL Artifacts on: 2015-04-03 01:55:40
You mentioned this is a raytracer, precision errors can be mitigated by using some epsilon value. In GL fragment shaders I usually use an epsilon of 0.0005, but adjust up and down as needed to make it as tight as possible.
This epsilon is used when comparing the values you generate to calculate the intersection of the ray with the object. Instead of comparisons against zero, you use the epsilon.
26  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LibGDX] How to check if Object is in certain part of camera? on: 2015-03-29 02:29:56
Dot product is a type of vector multiplication, it is best denoted by a *
27  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LibGDX] How to check if Object is in certain part of camera? on: 2015-03-29 00:19:45
A and C are (X,Y,Z) coordinates. You subtract them component-wise and access the X component, which is what @quew8 meant by .L.
Then you do the dot product with the L (left) vector of the camera, which is perpendicular to the forward vector and the up vector.
28  Java Game APIs & Engines / Java 2D / Re: Making my own 2D Minecraft Java game, issue with destroying tiles on: 2015-03-28 06:43:56
I'm assuming your world moves about, the tiles aren't being drawn at the same place every frame right? You translate everything by some (X,Y) offset correct? Make sure you are translating the mouse coord (in window space) is translated by (-X,-Y).
29  Java Game APIs & Engines / Java 2D / Re: Making my own 2D Minecraft Java game, issue with destroying tiles on: 2015-03-28 06:05:29
How do you translate the coordinates of the world to the screen? Make sure the transformation from screen coords to world coords is being calculated correctly.
30  Games Center / WIP games, tools & toy projects / Re: Battle Tank 3 --- an old school style RTS WIP on: 2015-03-28 06:04:55
Power produced should be the value on top, I agree with Riven on this. And yes WASD would be nicer for camera movement.
Pages: [1] 2 3 ... 159
 
GamerC4 (23 views)
2015-08-22 20:38:50

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

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

Kefwar (27 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

KaiHH (43 views)
2015-08-19 15:01:05
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

Intersection Methods
by Roquen
2015-05-29 08:19:33
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!