Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
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 ... 13
1  Game Development / Newbie & Debugging Questions / Re: Getting null pointer exception when tring to add/remove objects. on: 2014-12-20 16:11:30
Well where do you set the "playState" variable of Ex? Either you haven't posted that code or you don't set it which would give you a NPE.
2  Game Development / Game Mechanics / Re: How to do 3D Animation on: 2014-12-18 21:44:02
I would recommend the COLLADA format. It is an open-source, xml based format which supports pretty much anything you can think of. Can be a bit of a complex thing to parse but you can ignore most of it so it is OK.

As for consistent rate of animation, you need to use a time step. You calculate the time difference between the last loop and the current loop and use that as a parameter for how far the animation should move on. 
3  Game Development / Newbie & Debugging Questions / Re: LWJGL calls in Slick2D code. on: 2014-12-18 10:46:00
OpenGL is a state machine. Slick sets its state up to be right for how it renders it. You can't just type some code and assume it'll be in the right state for exactly what you want to do. Use Slick or use OpenGL directly.
4  Game Development / Newbie & Debugging Questions / Re: LWJGL - Immediate rendering alternative on: 2014-12-18 00:17:14
Well in fixed function pipeline (which you are probably using with calls like glVertex3f()) there are a couple of matrices defining transformations. GL_PROJECTION_MATRIX and GL_MODELVIEW_MATRIX. The matrix you are currently working on is defined with glMatrixMode(). Modifying these matrices is done with glLoadMatrix(), glLoadIdentity(), glTranslatef(), glRotatef, glScalef(), glOrtho(), glFrustum() and similar calls.

But tbh I would try to stick with deferred rendering. You can use the variant of the glVertexAttribPointer() command which takes a buffer directly to achieve what is essentially immediate mode rendering without changing any of your rendering setup and without the hassle of messing around with VBOs.   
5  Game Development / Newbie & Debugging Questions / Re: "Wrong Component Type or Count" GLSL shader error on: 2014-12-14 14:54:27
Actually I agree with @SHC. I think you are calling one of the glUniformXX() variants with the wrong number / type of arguments which if you read the docs:

Quote
GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the glUniform command.

GL_INVALID_OPERATION is generated if one of the integer variants of this function is used to load a uniform variable of type float, vec2, vec3, vec4, or an array of these, or if one of the floating-point variants of this function is used to load a uniform variable of type int, ivec2, ivec3, or ivec4, or an array of these.

I can't see any shader creation/compiling/linking functions that will generate a GL_INVALID_OPERATION if the shader compilation failed. And if it fails, the shader definitely should not work. But a uniform set fail can still work if the default value works or it is set elsewhere.
6  Discussions / Miscellaneous Topics / Re: Pathfinding, making it efficient but basic on: 2014-12-13 13:26:13
Why do you need to make a copy? Why can't you just use the same instance every time?
7  Java Game APIs & Engines / OpenGL Development / Re: Slick2D Shader Crash on: 2014-12-05 21:54:04

Ah, I can explain!

1) It's an error.pid trace. The program crashed in native code.
2) The disjoint between the function called and the function in the trace is because the JVM optimized out intermediate function calls. So setUniform4f calls nglUniform4fARB.

1) I know it is a crash in native code. That much is evident, I meant that I've never seen it (Windows?) fail to print the native stack trace.
2) Whilst the JVM may or may not optimize out deferred function calls, 99% of the time you will never see it in debugging, and the other 1% of the time, it is usually to do with implicit anonymous classes or automatic (un)boxing and the like.

I'm inclined to agree with @theagentd btw. Smells like a driver bug, random intermittent crashes in a function called repetitively in the same context. Try searching online to see if the graphics cards have any known problems.
8  Java Game APIs & Engines / OpenGL Development / Re: Slick2D Shader Crash on: 2014-12-03 13:21:56
To be honest, what concerns me is the error message.

1) I've never seen a an error printing the native stack.
2) The stack trace doesn't make sense.

this function "org.lwjgl.opengl.ARBShaderObjects.nglUniform4fARB(IFFFFJ)V" is not called in the source you have shown us. The method you are calling is "setUniform4f()" in ShaderProgram.
9  Discussions / General Discussions / Re: PrepperCraft! - A free voxel game. on: 2014-11-26 15:55:53
I would advise making some kind of playable demo at the very least before you either post in the WIP board or work on any kind of multiplayer features, like player databases.
10  Game Development / Newbie & Debugging Questions / Re: Buttons, Reading Files, and reading pastbin files. on: 2014-11-24 11:50:33
Also the Scanner class you are already using has support for reading numbers via the nextInt(), nextFloat() (or something similar to these) etc. methods.
11  Game Development / Newbie & Debugging Questions / Re: Bitshift Operators in RGB values? on: 2014-11-10 16:20:33
An excellent tutorial for understanding all things (I joke, if only) bitwise. http://www.wildbunny.co.uk/blog/2012/11/07/understanding-binary/ for future reference and future readers of this post.
12  Java Game APIs & Engines / OpenGL Development / Re: Particle/Billboard rotation issues on: 2014-11-09 11:59:02
So think about it. (Following ignored translation just to be simpler) Your camera rotates your projection matrix by -pitch and -yaw, which simulates a camera rotated by pitch and yaw. Then you have the (rotation part of) the model matrix set to the identity ie not doing anything. So essentially your particle will be rotated by -pitch and -yaw, which obviously works when pitch and yaw = 0 or 180 degrees (180 assuming back face culling isn't enabled) but no other time.

So if you want to get a nice billboard effect, you have to have the model matrix to be rotated by pitch and yaw as well, (or don't have the projection matrix rotated). Now there are better ways to do this computationally speaking but it really isn't necessary.
13  Game Development / Performance Tuning / Re: JNI passing data from Native to Java on: 2014-10-29 13:25:43
To be fair you kind of expect Windows to not allow programs to kill it. Windows is the equivalent of the JVM. It's like the JVM crashing when a Java program doesn't catch an exception. I suspect that Windows did not crash but rather it slowed down trying to find more memory to use and seemed to be non-responsive.
14  Java Game APIs & Engines / OpenGL Development / Re: [LWJGL] Making The Camera Look At A Point on: 2014-10-29 09:27:43
If you are going to roll your own camera implementation straight from the matrices, then you really need to understand the maths. I find the best place to learn this stuff is here: http://www.wildbunny.co.uk/blog/vector-maths-a-primer-for-games-programmers/. It's not too long and will give you a firm basis in vector and matrix maths as they apply to 3D graphics.

If you don't understand this stuff then I'm afraid you are just clutching at straws and you will run into problem after problem.
15  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-10-24 17:10:49
V nice.

Released alpha footage of Basingstoke today: http://www.puppygames.net/blog/?p=1585

Cas Smiley
That's awfully, awfully pretty. Not much else I can say just from the new video.
16  Game Development / Newbie & Debugging Questions / Re: Is using glScalef(...) frowned upon for 2D? on: 2014-10-24 11:37:45
The glScale(), as I stated above, is part of the fixed function pipeline. It can be used with immediate mode or deferred rendering.

There are two different options in OpenGL which everyone gets confused about.

Immediate Mode vs Deferred Rendering
Immediate mode uses commands like glVertex3f(), glTexCoord2f(), glVertexAttrib3f() in between glBegin(), glEnd() blocks. It is called immediate because you send OpenGL the vertex data and the primitives are rendered (pretty much) immediately. Deferred rendering uses VBOs. You send OpenGL the vertex data and it keeps it. You can render primitives with it at any time, hence the rendering is deferred from sending the data.

Fixed Function Pipeline vs Programmable Pipeline
Fixed function uses commands like glTranslatef(), glRotate(), glScalef(), glOrtho(), glMatrixMode() as well as (amongst other things) all of OpenGL's built in lighting support. It is called fixed function because the primitives are modified through set fixed functions, you can modify the parameters of the functions (like the contents of the matrix) but it is quite an inflexible system if you want to to do anything beyond what it is designed for. The programmable pipeline uses shaders to modify the primitives and it is called programmable because, guess what, it is programmable. This means you can do pretty much whatever you want. One important thing to note is that you can still access the fixed function matrices and lighting parameters in earlier versions of OpenGL so if you make use of them, then the above functions will still work.

I hope that clears things up.
17  Game Development / Newbie & Debugging Questions / Re: Is using glScalef(...) frowned upon for 2D? on: 2014-10-23 17:32:56
All of the OpenGL fixed function transformations ie glTranslate(), glRotate(), glScale() etc. perform the transformation the same way. They combine the transformation into the current matrix. Hence using glScale() will have absolutely no effect on performance (other than the actual call to glScale() which is trivial), doing things cpu side by drawing bigger quads would be worse.
18  Game Development / Newbie & Debugging Questions / Re: Collision with inclined plane. on: 2014-10-17 21:15:27
Firstly, that is far too much code to post. You should be posting small sections of relevant code. This code is both long and not relevant and also (and I mean no offence here) but it is in what looks like Spanish and that isn't helping the members of an English speaking forum either.

Now your question. Firstly, are you talking about just the maths of the collision, or the collision response. If you're talking about the collision then a Google search for "plane-sphere collision test" will yield all the results you should need. Come back if you have more specific questions.

If you're talking about the collision response, then you need to think about normal response, the sphere's stretching (and hence bouncing) ability and elasticity of collision.

The normal response is the force the plane exerts on the sphere to stop it falling through and it is called normal response because it acts in the direction of the plane's normal, ie perpendicular to the plane.

Bouncing occurs when the top of the sphere continues to fall whilst the bottom remains at rest, compressing the ball and giving it elastic potential which then converts to kinetic and pushes the ball up. You can cheat this by simply scaling up the normal reaction based on a coefficient of stretchiness (no idea what if any this's name is. Partly Young's modulus but something else as well must be).

Elasticity of a collision determines how much of the energy remains as kinetic and how much dissipates. This will combine with the above so that balls don't bounce infinitely.

To implement sliding properly, you will need to do friction as well.

In terms of answering implementational questions, you will need to post more succinct code. I can deal with the Spanish but English comments would be appreciated.
19  Game Development / Newbie & Debugging Questions / Re: Edge of the island (Release) Android on: 2014-10-15 10:38:27
-Wrong section.
-No description

Add a description and politely ask a mod to move it to the correct section.
20  Discussions / General Discussions / Re: painful maths that will hurt your brain... on: 2014-10-12 10:21:35
So here are my thoughts for what they are worth, bearing in mind I have also never done any algebra with modulos. But I agree with @philfrei about that being the way to solve it and the whole infinite answers of x thing. @moogie I suspect the reason Wolfram told you otherwise is that it either interpreted "log x(28274625)" as "log of (x times 28274625)" rather than "log base x of 28274625" or it misinterpreted the modulo symbol or both.

So:

7 = logx(28274625) % 17

(n * 17) + 7 = logx(28274625)  Where n = 0, 1, 2, 3... (not -ve since log(a) > 0) using @philfrei's equation.


Now it gets a bit hairy.
Take the change of base log formula


logb(a) = logd(a) / logd(b)

logd(b) = logd(a) / logb(a)      Making the original base, b, the subject.

ln(b) = ln(a) / logb(a)        Just for jollies lets make d = e -> logd(a) = ln(a)

b = e^( ln(a) / logb(a) )


Now lets sub the original equation into that. b = x, a = 28274625, logb(a) = (n * 17) + 7

x = e^( ln(28274625) / ( (n * 17) + 7 ) )

Giving some example answers (to 4dp): (n = 0, x = 11.6007), (n = 1, x = 2.0440), (n = 2, x = 1.5196) etc. and you can see the trend.

Also just noticed that final answer can be simplified to:

x = 28275625 * e ^ (1 /  ( (n * 17) + 7 ) )

However this does not use the hint at all or even give nice numbers so I don't think it is right.
21  Game Development / Newbie & Debugging Questions / Re: Box2D Circle works but not pentagon Polygon? on: 2014-10-12 09:45:12
Your way is the way I would do it and I see no problems. Are you sure there isn't an issue with how you are rendering it? As a point of interest, the one thing I can think of different between a box and a pentagon is the pentagon has an odd number of vertices whereas the box has an even number. The same (probably) goes for the circle. So maybe try a hexagon and see what happens there.
22  Game Development / Newbie & Debugging Questions / Re: Netbeans string concatenation wrap on: 2014-10-04 18:11:53
Yes and security vulnerabilities aside, in NetBeans you can set most formatting preferences by going "Tools|Options" then going to the "Editor" tab and then the "Formatting" sub-tab. There all kinds of options in there for all the various languages you have support installed for. I don't know if that is there (and off the top of my head, I thought it did it automatically) but if the option exists I recon that is where it will be.
23  Java Game APIs & Engines / OpenGL Development / Re: [batching] How to transform drawing primitives on: 2014-09-26 19:47:02
The problem with batching is that you can't really batch together meshes with different transforms because you have to modify the modelview matrix between draws, which is not batching. So if you want to do something like that then the best option really depends on what gives the best performance and is easiest to implement.

You can either compute the transforms cpu side as you have said. Or it might give better performance to give up on batching all together. Ultimately batching is a performance improvement and if your requirements mean that it isn't increasing performance then what is the point.
24  Game Development / Newbie & Debugging Questions / Re: Collada format interleaved index buffer? on: 2014-09-26 19:43:53
Ah sorry. Haven't used Blender in a while, turns out it was the Wavefront export that had those options. Well the other thing is that in the asset node in the COLLADA document, you will find an element called <up-axis> which, exporting from Blender, has the value "Z_UP". You can read this element to work out how to transform the data to get it into the y-up format.

And I would recommend transforming the vertices as you parse them. As @basil_ says, best to get it in the format you like and are used to. Otherwise you are just adding another layer of complexity which is wholly unnecessary and can only lead to bad things.
25  Game Development / Newbie & Debugging Questions / Re: LWJGL - 2D Image not rendering right on: 2014-09-26 19:22:28
I've got two issues to be starting you off for.

1) You should be calling glTexCoordf() before the corresponding glVertex() call. When you call glVertex() it sends the currently set tex coords as the ones for the vertex it creates if that makes sense. The same goes for every similar call like glColor, glNormal, glFogCoords everything. And if you are using custom attributes then index 0 takes the place of glVertex() and works the same way.

2) OpenGL used to only work with power of two dimension textures. Nowadays (since OpenGL 3.0 I think) implementations are required to support them but Slick2D still works with pot textures. So it pads out non-pot textures to make them up to pot textures. Fine except it leaves you with black borders like the ones you have.

Fix these two things and see how many of your problems go away.
26  Game Development / Newbie & Debugging Questions / Re: Using a FrameBuffer object on: 2014-09-23 09:44:05
LWJGL specific, good FBO tutorial:

http://lwjgl.org/wiki/index.php?title=Using_Frame_Buffer_Objects_(FBO)

LWJGL example of render to texture:

http://lwjgl.org/wiki/index.php?title=Render_to_Texture_with_Frame_Buffer_Objects_(FBO)
27  Game Development / Newbie & Debugging Questions / Re: Collada format interleaved index buffer? on: 2014-09-23 09:41:48
Two things to think about.

1) By default, Blender exports with a z-up system whereas chances are you want a y-up system. In the export screen in Blender, look over the options in the bottom right hand corner.

2) With COLLADA you cannot just look at a single isolated element. This <float-array> will be accessed from an <input> (well actually a <vertices> which is referenced from a <polylist> (or similar) inside a <mesh> inside a <geometry> referenced by an <instance-geometry> inside a tree of <node>s inside a <visual-scene> referenced by an <instance-visual-scene> inside the <scene> (That was from memory and some of it might be wrong). And every step along the way there can be stuff that will change the way it works. I expect that one or more of the <node>s of the scenegraph contains a transform which is distorting your quad because you are ignoring it.

So COLLADA isn't that complex but there is a lot of work to do to make a full parser. If you are going to make a fully functional parser, then you have to start in the <scene> node and follow the references all the way down to the actual data collecting all the information along the way. It is no simple matter.

However there is (I believe) another option in the Blender export screen that lets you pre-apply any kind of transform to the geometry before exporting. I believe this will mean that any transforms will be applied to the geometry rather than defined in the scenegraph.

Hope this helps, Quew8
28  Game Development / Newbie & Debugging Questions / Re: Is it Possible to use Java and send sounds through the microphone? on: 2014-09-11 09:33:34
I don't know how but, if there is a way I'd expect you to find it in one of these websites:

http://docs.oracle.com/javase/tutorial/sound/sampled-overview.html
http://www.jsresources.org/index.html
29  Game Development / Game Mechanics / Re: Rendering pixel data from array in lwjgl on: 2014-09-02 18:31:49
Textures. You have an array of rgb values, also called an image. So you can wrap up the image in an OpenGL texture and render that. You can update individual pixels in the texture with glTexSubImage2D(): http://www.opengl.org/sdk/docs/man2/xhtml/glTexSubImage2D.xml.

Depending on how much this minimap is being updated, you might get more performance out of using glDrawPixels(): http://www.opengl.org/sdk/docs/man2/xhtml/glDrawPixels.xml to render those pixels directly. But I would always go with the texture option just for ease of use and simplicity.
30  Discussions / General Discussions / Re: Performance Test for the Voxel Thing on: 2014-08-30 13:18:57
Smooth 60 fps on
Windows 7 32 bit
4 GB RAM
Intel core i3-2100 @ 3.1 GHz
ATI Radeon HD 2400

So I don't think you have a performance issue.

Also ditto on @PandaMoniumHUN's bug if it matters.
Pages: [1] 2 3 ... 13
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (33 views)
2014-12-15 09:26:44

Mr.CodeIt (23 views)
2014-12-14 19:50:38

BurntPizza (51 views)
2014-12-09 22:41:13

BurntPizza (84 views)
2014-12-08 04:46:31

JscottyBieshaar (45 views)
2014-12-05 12:39:02

SHC (59 views)
2014-12-03 16:27:13

CopyableCougar4 (59 views)
2014-11-29 21:32:03

toopeicgaming1999 (123 views)
2014-11-26 15:22:04

toopeicgaming1999 (114 views)
2014-11-26 15:20:36

toopeicgaming1999 (32 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
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!