Java-Gaming.org Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (612)
Games in Android Showcase (172)
games submitted by our members
Games in WIP (658)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 7 8 [9] 10
 81 
 on: 2015-08-29 18:31:17 
Started by Void_Massive - Last post by NivaGameStudios
You could just simply run another thread to handle the monster calcualtion, that would probably be better and more efficient anyways.

 82 
 on: 2015-08-29 18:24:22 
Started by BurntPizza - Last post by chrislo27
Finally decided to separate the big chunk of code that's always in my games for screens, registries, transitions, utilities, and the like into its own mini-engine/library. I can just access it using git submodules in my actual games. Hopefully this'll make it much easier to make a bunch of little games instead of tediously copying alllll the old files and refactoring it to death.

 83 
 on: 2015-08-29 17:08:59 
Started by ags1 - Last post by ags1
Just a little update, I've been working on the AI code for the past weeks. It's going well but slowly.

 84 
 on: 2015-08-29 17:06:15 
Started by gram7gram - Last post by gram7gram
Well, I am sorry I cannot provide you with the link.
This project is a Work In Progress, so there is no enjoyable version...

 85 
 on: 2015-08-29 16:46:39 
Started by Void_Massive - Last post by chrislo27
Kryonet is not a game engine with its own update methods for you to run your logic. It is merely a networking library for general purposes.

As Drenius said, KN has its own internal update thread that can be started with start() where it continually updates itself, checking for incoming packets and processing them with the received method. It doesn't do any game related things, only networking.

For your server logic instance, you'll have to set up some loop that gets updated X times per second where it updates all your logic. After you compute the new positions, create/re-use a packet instance with the correct information and send it via the Kryonet Server instance using sendToAllTCP/UDP().

 86 
 on: 2015-08-29 16:00:34 
Started by Void_Massive - Last post by Drenius
You should probably just try what you think might work...
You are aware that Kryo is mostly running in it's own background thread, right?

 87 
 on: 2015-08-29 15:56:42 
Started by BurntPizza - Last post by Opiop
Oh girlfriends. Mine just had her birthday yesterday except I didn't get to see her for reasons. Needless to say last night was not a good night for me. *Sigh*

 88 
 on: 2015-08-29 15:39:00 
Started by BurntPizza - Last post by Slyth2727
Got my driver's license! Could've gotten it almost a year ago, but never really took the time. My girlfriend and I also celebrate our 1 year anniversary very soon.

Smiley

 89 
 on: 2015-08-29 14:56:38 
Started by Cyraxx - Last post by theagentd
It doesn't matter what kind of projection you're using. You can easily reconstruct the view space position anyway. The idea is to upload the inverse of the projection matrix to the shader, reconstruct the NDC (normalized device coordinates) of the pixel and "unproject" it using the inverse projection matrix, hence it works with any kind of projection matrix.

NDC coordinates are coordinates that go from -1 to +1 in all 3 axes. When you multiply the view space position by the projection matrix in the vertex shader when filling the G-buffer, you calculate NDC coordinates, and the GPU hardware maps XY to the viewport and Z to the depth buffer. We can undo the projection, but first we need to get all the data to do that.

First of all, you need the XY coordinates. These are easy to calculate. They basically go from (-1, -1) in the bottom left corner to (+1, +1) in the top right corner. The easiest way is to calculate them from gl_FragCoord.xy, which gives you the position (in pixels) of the pixel. Divide by the size of the screen and you have coordinates going from (0, 0) to (+1, +1). Remapping that to (-1, -1) to (+1, +1) is easy. The Z coordinate is the depth buffer value of that pixel, but the depth buffer value also goes from (0) to (+1) and needs remapping. With this, we have the NDC coordinates of the pixel. Now it's just a matter of multiplying the NDC coordinates with the projection matrix and dividing by the resulting W coordinate.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
uniform sampler2D depthBuffer;
uniform vec2 inverseScreenResolution; //Fill with (1.0 / screen_resolution) from Java.
uniform mat4 inverseProjectionMatrix;

...

vec2 texCoords = gl_FragCoord.xy * inverseScreenResolution; //Goes from 0 to 1
float depthValue = texture(depthBuffer, texCoords); //Goes from 0 to 1

vec3 ndc = vec3(texCoords, depthValue) * 2.0 - 1.0; //Remapped to -1 to +1

vec4 unprojectResult = inverseProjectionMatrix * vec4(ndc, 1.0);

vec3 viewSpacePosition = unprojectResult.xyz / unprojectResult.w;

//Use viewSpacePosition for lighting



An example G-buffer layout for deferred shading is:

COLOR_ATTACHMENT0: GL_RGBA16F: (diffuse.r, diffuse.g, diffuse.b, <unused>)
COLOR_ATTACHMENT1: GL_RGBA16F: (packedNormal.x, packedNormal.y, specularIntensity, specularExponent)
DEPTH_ATTACHMENT: GL_DEPTH_COMPONENT24: (depth)


EDIT: Actually, if you're only using an orthographic projection, you don't need the W-divide (but it doesn't harm to keep it there).
EDIT2: Also, there are lots of optimizations you can do to this. I opted to just give you the basics before diving into those. I can answer whatever questions you have about deferred shading.

 90 
 on: 2015-08-29 10:46:44 
Started by BurntPizza - Last post by KaiHH
KaiHH managed to figure out how to get Nvidia Optimus laptops to use the Nvidia card. It required making a custom exe file though.
Yes. Since I was really shocked by you telling me that launch4j just executes javaw.exe in the background, I just *had* to create a custom executable. Smiley
See the LWJGL thread for more info.

Pages: 1 ... 7 8 [9] 10
 
afikri (11 views)
2015-08-31 09:30:22

afikri (18 views)
2015-08-31 09:30:07

afikri (8 views)
2015-08-31 09:27:24

afikri (12 views)
2015-08-31 09:26:40

Roquen (16 views)
2015-08-29 11:30:54

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

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

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

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

GamerC4 (26 views)
2015-08-22 01:00:24
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!