Java-Gaming.org Hi !
Featured games (87)
games approved by the League of Dukes
Games in Showcase (649)
Games in Android Showcase (181)
games submitted by our members
Games in WIP (700)
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 4
1  Game Development / Newbie & Debugging Questions / Re: How to load .obj file into JOGL program on: 2016-02-11 11:51:04
Quote
1- What is this?
obj = new Simple[your_implementation]ObjFile();
obj.load("meshes/some.obj");

what should be my implementation?
what is "meshes/some.obj" ?


Your implementation is the code you write, if you are going to write a class to load obj files then you need to call it something.

"meshes/some.obj" is the path to where your obj file is.

You are taking things too literally in the post, the post contained some abstract code which you need to build and implement.

Quote
2- At the beginning of the code the example says "assuming blending and color is set up before." what is blending & color?

This is just assuming some opengl defaults have been setup before

2  Discussions / Miscellaneous Topics / Re: How do I get Java and Javascript working together? on: 2016-02-03 21:39:45
Why not try (marytts)

http://mary.dfki.de/index.html

3  Discussions / General Discussions / Re: Oracle kills webstart on: 2016-01-30 08:39:54
Applets yes, java web start no. In the corporate environments its still used a lot because its an easy way to control updating applications.

To get around the self signing issues present since java 7 you can use deployment rule sets

https://docs.oracle.com/javase/7/docs/technotes/guides/jweb/security/deployment_rules.html

Corporations will use this as a way of allowing only what they want run.

As a local developer there are a few ways to get around this

  • Buy a certificate yourself (not practical)
  • Ask your end user to add an exception for your site
  • if you initially deploy via a custom jvm then you can custom add a deployment rules set. You can use this jvm to launch web start directly

None are that great to be honest. I would have to add though I haven't seen many games / apps being deployed this way (and the couple of times I have seen it it didn't work anyway).

I suspect not many people on this forum would be crying if it actually did go in the future, but it does have it's uses, just else where.
4  Game Development / Newbie & Debugging Questions / Re: Using the Java port of Theora on: 2016-01-28 06:35:06
I'm just in the middle of writing a pure java decode as we speak!!

The cortado decoder that is written by the xiph team is pure java, it uses the jcraft ogg vorbis decoder for both the ogg decoder decoding and the vorbis container decoding.

The code is quite confusing to use, it really is a complete port of the c version and written is a very c style (very functionally). If you have any specific questions either reply here or send me a pm as I am using this implementation to help test that what I am doing is right so I have used it  to debug the theroa ogg container code I have (I have already written a working ogg and vorbis decoder)
5  Game Development / Newbie & Debugging Questions / Re: Crash but no crash log! on: 2016-01-26 20:09:06
Try replacing

1  
2  
3  
4  
                glVertexAttribPointer(0, 3, GL_FLOAT, false, 20, 0);
      glVertexAttribPointer(1, 2, GL_FLOAT, false, 20, 12);

      glBindBuffer(GL_ARRAY_BUFFER, this.vbo);


to

1  
2  
3  
                glBindBuffer(GL_ARRAY_BUFFER, this.vbo);
                glVertexAttribPointer(0, 3, GL_FLOAT, false, 20, 0);
      glVertexAttribPointer(1, 2, GL_FLOAT, false, 20, 12);


Not sure if its your issue but it is wrong
6  Discussions / Community & Volunteer Projects / Re: looking for developers for porting project for IK lib on: 2016-01-26 05:41:19
The site you linked to is a Java version? What's is the help you need?
7  Games Center / Android Showcase / Re: FiveMinuteGame on: 2016-01-26 05:39:02
I'd have to agree with @Abuse, with a random board layout you are left at the mercy of the rotation God. To get a high score you need a bit of luck.
8  Game Development / Game Mechanics / Re: 2D point in polygon algorithm on: 2016-01-25 22:01:29
Quote
But it will be quite some work to get the winding order algorithm at even the same order of magnitude of performance of what I currently have with the modified even/odd algorithm. Smiley Some k-nearest neighbor search with an appropriate data structure seems to be called for with that algorithm.

I'd disagree here, you are close to doing it already, I'll write you some untested code

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  
public boolean pointInPolygons(float x, float y) {
        // check bounding sphere first
        float dx = (x - centerX);
        float dy = (y - centerY);
        if (dx * dx + dy * dy > radiusSquared)
            return null;
        // check bounding box next
        if (maxX < x || maxY < y || minX > x || minY > y)
            return null;
        // ask interval tree for all polygon edges intersecting 'y'
        int c = tree.traverse(y, intervals, 0);
        // check the polygon edges
        int windingNumber = 0;
        for (int r = 0; r < c; r++) {
            Interval ival = intervals[r];
            float[] verticesXY = polygons[ival.polygonIndex];
            // order i and j in the order they are drawn in (assume verticesXY is ordered correctly)
            int i = Math.min(ival.i,ival.j);
            int j = Math.max(ival.i,ival.j);
            float y1 = verticesXY[2 * i + 1];
            float y2 = verticesXY[2 * j + 1];
            float x1 = verticesXY[2 * i + 0];
            float x2 = verticesXY[2 * j + 0];
            //no need to test intervals which are definitely on the wrong side of the point to be tested
            if (x1 && x2 < x)
            {
                continue;
            }
            // test that the interval is an upward interval
            // test also that y is to the left of this interval in the direction of travel (last logic condition)
            if ((y1 < y) && (y2 >= y) && (( (x2 - x1) * (y - y1)- (x - x1) * (y2 - y1) )>0))
            {
                windingNumber++;
            }
            // test that the interval is an downward interval
            // test also that y is to the right of this interval in the direction of travel (last logic condition)
            else if ((y2 < y) && (y1 >= y) && (( (x2 - x1) * (y - y1)- (x - x1) * (y2 - y1) )<0))
            {
                windingNumber--;
            }
        }
        return windingNumber !=0;
    }


If your code already filters out intervals that don't need to be counted (wrong side of the point to be tested) then ignore the last logic statement in the 2 if's. If you don't then this could be an optimisation.
9  Game Development / Game Mechanics / Re: 2D point in polygon algorithm on: 2016-01-24 20:56:02
Kai

If you draw a 5 pointed star (https://en.wikipedia.org/wiki/List_of_regular_polytopes_and_compounds#/media/File:Star_polygon_5-2.svg) you get overlapping (but its a continuous drawn polygon), the centre part of the star is currently seen as "out" when it is actually "in" but the 5 points of the star show correctly "in".

This is an example where the odd / even test fails.

The winding number algo is more accurate and potentially faster (http://geomalgorithms.com/a03-_inclusion.html). Most packages seem to offer both methods so it might be good to be able to select either algorithm depending on whether you have basic geometry or complex.

10  Game Development / Game Mechanics / Re: 2D point in polygon algorithm on: 2016-01-23 07:09:54
This is pretty much the way I have done it (except for the interval tree, I only had small polygon counts to deal with), what I would suggest though is to use the winding number to determine in or out as the odd / even method breaks down in certain circumstances. Is your interval tree like a quad tree?
11  Games Center / WIP games, tools & toy projects / Re: Making a game with Euphoria Engine - A Cross Platform Game Engine on: 2016-01-22 21:07:06
Hey

Congrats on the engine! I would say, don't give up and keep going. There are people on this forum who are purely interested in making games and there are those that like the to be involved in the whole journey. The first group are less interested in creating tools and would just like to program content and the second group like to build their own tools to then go on and create content. People will offer advice from both categories so don't be put off if people recommend going in a different direction to what you want to do.

There maybe many game engines out there and you maybe the only person using your engine but don't let that stop you.
12  Games Center / WIP games, tools & toy projects / Re: Pong in Java on: 2016-01-22 19:07:15
I doesn't seem to matter where in the paddle you hit the ball, it will always come off the bat in the same way. The AI is already moving to the right position before the ball even gets to you because it looks like it has already calculated where it is going. With out variation of how the ball comes off the paddle there isn't really much for the AI to think about. It could probably calculate the next 1000 positions it needs to go to before I get the first bounce in.
13  Game Development / Shared Code / Re: Audio: Write generated PCM to file on: 2016-01-12 19:39:37
A nice easy to ready bit of code! Although I know what this bit does

1  
2  
3  
4  
               // convert signed, normalized float to bytes:
               audioVal *= 32767; // scale value to 16 bits
               frameBytes[0] = (char)audioVal; // little byte
               frameBytes[1] = (char)((int)audioVal >> 8 ); // big byte


I would have wrote it as the below for clarity

1  
2  
3  
4  
5  
6  
               // convert signed, normalized float to bytes:

               short pcmValue = audioVal * 32767; // scale audioValue to 16bits
               // convert short to byte array
               frameBytes[0] = (byte)pcmValue;
               frameBytes[1] = (byte)(pcmValue >> 8);
14  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-01-12 19:32:48
Finished writing a true type font renderer in Java. What I thought would be something fairly simple turned out to be a much larger project. For those that don't know the true type font comes with its own language which is defined by op codes. The op codes allow you (the font creator) to program how best to grid fit the font at different sizes so that when you draw the pixels you get text that doesn't have gaps in (more for very small text).

I now have something that builds a font object directly (texture, glyph data etc) and can render it in my 2D ui components!

It doesn't currently do anti aliasing, it only grid fits so I might add that later. I also want to see if I can write a shader to render the the font characters directly (ie skip the whole texture generation stage), I can already draw the font outlines in 3d so not too much of a step forward from there.

One interesting thing I noticed was the formula for working out the initial grid positions. It uses the dpi of your monitor to convert font coordinates to screen coordinates, the old documentation from Microsoft talks about the old VGA monitor days where VGA was seen as 96 dpi. But when drawing the characters I noticed that 96dpi seems to be the default number all the renders use. I originally put in the actual dpi of my monitor (around 165dpi) and the characters look much bigger that they normally do.
15  Discussions / General Discussions / Re: Packaging a Java Application on: 2016-01-08 19:18:04
What's the rationale behind not obfuscating? Primarily speed?

I've not used one so I am not really familiar with the negatives.
16  Games Center / WIP games, tools & toy projects / Re: Lookout! Early concept - any feedback appreciated (Lots of bugs) on: 2016-01-05 12:15:19
Interesting concept, and you are not wrong about the bugs  Cheesy

I found placing objects hard, it mostly didn't place even after many left clicks

The console had this error

1  
2  
3  
4  
5  
6  
7  
java.lang.RuntimeException: Resource not found: Fonts/DS-DIGI.ttf
   at org.newdawn.slick.util.ResourceLoader.getResourceAsStream(ResourceLoader.java:69)
   at net.zrev.Resources.Fonts.loadFonts(Fonts.java:18)
   at net.zrev.Core.Core.init(Core.java:35)
   at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393)
   at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317)
   at net.zrev.Core.Core.main(Core.java:150)

17  Game Development / Newbie & Debugging Questions / Re: Multiple textures inside a triangle strip on: 2016-01-01 11:26:03
You just need to convert everything to the pipeline way of doing things

Some comments

move
1  
2  
3  
int shaderID = ShaderLoader.loadShaderPair("/resources/shaders/terrain.vs", "/resources/shaders/terrain.fs");
Texture texture1 = new Texture(Terrain.class.getResourceAsStream("/resources/textures/grass.jpg"));
Texture texture2 = new Texture(Terrain.class.getResourceAsStream("/resources/textures/stone.jpg"));
to your initialisation method

move
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
for (int i = 0; i < data.length - 1; i++) {
            GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
            for (int j = 0; j < data[i].length; j++) {
                if (j % 2 == 0) // Second triangle
                    GL11.glTexCoord3f(0, 1, 0);
                else
                    GL11.glTexCoord3f(0, 0, 0);
                GL11.glVertex3f(j - xOffset, data[i][j] - yOffset, i - zOffset);

                // We need to render the next strip to "link up" the two strips.
                // If this is commented out, you would just have a load of strips
                // that aren't connected.
                if (j % 2 == 0)
                    GL11.glTexCoord3f(1, 0, 1);
                else
                    GL11.glTexCoord3f(1, 1, 1);
                GL11.glVertex3f(j - xOffset, data[i + 1][j] - yOffset, (i + 1) - zOffset);
            }
            GL11.glEnd();
        }


in to 2 byte buffers, one containing the vertex data and one containing the texture coordinate data. Then create 2 VBO's and pass these to your vertex shader

There is an excellent tutorial post from @riven describing different ways to do this

http://www.java-gaming.org/topics/introduction-to-vertex-arrays-and-vertex-buffer-objects-opengl/24272/view.html

You then need to integrate these VBO's in to your shaders so you can pass in the vertex/texture data to be drawn. You can do this in different ways depending on the shader version you want to use. I use the below way

1  
2  
layout(location = 0) in vec3 vertexData;
layout(location = 1) in vec2 textureData;


You can tell opengl to use the vertexData you pass (assuming no other manipulation of the data)
1  
gl_Position = vertexData;


You then need to pass the texture data from the vertex shader to the texture shader and use that in the texture2D method you have. If you use a variable called theTextureData to pass this then you can extract the correct fragment by doing

1  
texture(texture_number, theTextureData);


This should be enough to give you a very basic understanding of what to do, you can easily google to find the more detailed information
18  Game Development / Newbie & Debugging Questions / Re: Multiple textures inside a triangle strip on: 2015-12-28 15:10:59
You can't mix your intermediate mode calls with your pipeline calls
19  Game Development / Networking & Multiplayer / Re: KryoNet detecting disconnections. on: 2015-12-23 23:30:32
The LWJGL client thread would stop because :

1) You stopped it programatically
2) An exception was thrown on the thread and you caught it in a try / catch
3) An exception was thrown on the thread and was not caught anywhere, but you were clever and had an uncaught exception handler which caught it as a last resort.

In all these cases you know when they happen and can call the resultant kryo.dispose() method.

20  Discussions / Miscellaneous Topics / Re: Benchmark this JAR - yes, a Vangard demo! on: 2015-12-06 05:45:18
my laptop has both an intel and nvidia card. Strangley the render cycle was slower when using the nvidia card. I don't think your render cycle is GPU bound, more likely CPU bound.

The other thing  noticed was that you are writing a lot of debug text to the console. This will slow things down considerably,

I typically got 8ms log and 4-5 ms render at all zoom levels.
21  Java Game APIs & Engines / OpenGL Development / Re: Transforming model vertices after loading to vao on: 2015-10-30 03:48:34
You could pass in a custom flag with your vertex data then upload 2 transformation matrix to the shader and then use the flag to switch between which one you use (a very basic form of skinning).
22  Discussions / General Discussions / RSS feed for this site on: 2015-10-15 10:58:24
Hi

I read new forum entries on this site via an RSS reader (feedly), since the 12th October there have been no updates even though there most definitely have been new posts on the site.

Is the RSS now broken? I tried it with another reader and saw the same issues.
23  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-08 05:18:23
These latest benchmarks aren't really giving a fair comparison. There are 2 measurable items

1) The method for calculating Sin  or Cos = Java / Agent / Riven
2) The method for calculating Sin (t+x) and Sin (t+y)  = Scalar / Sum of Angles/ Sum of Angles SOA

To be a fair comparison you need to test all the possible combinations, so far Sum of Angles / Sum of Angles SOA are only tested using the slowest sin and cos method (Java)
24  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-06 18:19:36
Quote
Quote
yet you expect every single person who read (and actually want to understand) your comments to spend a significant amount of time Googling to decode your posts.
Or simply post:  can you explain this?  Look above I talk about dependency chains.  Explaining that for the widest audience would require giving a complete overview of how modern CPUs work. Or dig up a bunch of URLs for people to wade through.  

Roquen

One end of the spectrum is to post in extreme detail and provide a complete overview on the topic that even the stupidest of people can understand (high effort  / low reward for effort) and at the other end is to post a set of facts without any explanation at all and no detail as to why the facts are relevant to the conversation (very low effort / still low reward for effort). You tend to post very much on the later side of the scale, the fact that there is little or no explanation means you get very little interaction with the community even if the community is knowledgeable in the field you are posting about.

I'm not asking you to change your style as its a personal choice and you are free to post what you want and in any style you want but I wanted to illustrate why people get frustrated with the confusion nature of your posts.
25  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-10-05 18:19:58
sin(t+x) = cos(x)sin(t)+cos(t)sin(x)
sin(t+y) = cos(y)sin(t)+cos(t)sin(y)

per sim step is cos(t) & sin(t) which is really one trig op...not that it would matter.

{....cos(x),sin(x),cos(y),sin(y)...} packed array.  Speculate loading and skips the trig table lookup.  More accurate, but that probably doesn't matter either.  So 2x (2 look-up, 2 mul, 1 add) per entry.

Quote
For N objects he's performing 2N forward trig ops per simulation step.  The sim only requires two per step.

To decode this a bit for the people that are interested. I believe this is what Roquen is trying to say.

If you pre compute cos(x), sin(x), cos(y), sin(y) and save these values for each of the N objects you only need to compute sin(t) and cos(t) for each render cycle because these are the only variables that change. As you already have cos(x),sin(x),cos(y),sin(y) saved you just need to perform 4 multiplications and 2 additions per render cycle. Comparing both methods you get (Theagentd vs Roquen)

2N Lookups + 2N additions vs 4N multiplications + 2N Additions + 2 Lookups = 2N Lookups vs 4N Multiplications + 2 Lookups

Assuming multiplications are more than 2x quicker than lookups and N is sufficiently large you will save time using this method.

Hope this helps clears things up a bit
26  Game Development / Newbie & Debugging Questions / Morph + Particle Animation - Best way to store the data on: 2015-09-19 07:55:13
Hi

I have a setup where I am storing model data, these models can be reused by passing in a different ModelMatrix in the draw calls to allow the model to be drawn in multiple places. This means a single model can be used multiple times, all pretty standard I think. If there are any animation events such as standard transformation changes or the more complicated skeletal animation, this can be handled easily while still keeping with the single model being reused many times design.

That all works pretty well, I also have some animations which effect the vertex data directly (Morph animation and particle animation), with these my single model design principal kind of breaks down. The VBO data needs updating each frame which means the VBO is not generic any more.

An example which I have is a head that blinks. If I use this skeleton model multiple times I will have multiple heads but I would want them to all independently blink separately. So we come to the main point of the post. Is there a way to design things such that I can keep the single model being reused design? If not (this is what I suspect) are there any other ways, from a design perspective, that are more optimal than just loading up a new copy of the model each time?

Thanks

Ziozio
27  Java Game APIs & Engines / Tools Discussion / Re: jBullet3 on: 2015-09-05 06:20:20
I would vote yes for a java only physics engine, I dislike having the requirements for native files being bundled up in a java projects. This might mean there is a bit of "re inventing the wheel" but I think there a lot of advantages for this for the people that dislike natives.

@gouessej - quoting buzzwords to dissuade people from trying a project like this isn't very helpful and doesn't really mean much. Porting a library, essentially requires no knowledge because you are just porting code, you just need an understanding of the computer languages at both ends. A long while back I started porting bullet2 to java (a more up to date version of jbullet), I didn't know anything about physics at that point but by porting the code I actually went off and learnt about the topic and I actually learned quite a lot in the process. Everyone starts somewhere.
28  Game Development / Newbie & Debugging Questions / Re: OpenAL - 2 channel OGG sound on: 2015-09-04 20:42:10
openal uses pcm format, how are you converting ogg in to pcm? Are you doing all of channel1 then channel2 or are you interleaving them?
29  Java Game APIs & Engines / OpenGL Development / Re: LWJGL jemalloc bindings on: 2015-08-09 21:21:07
Spasi

Hi, do you know when the javadoc will be up for this new set of bindings? I don't immediately see a use case for this in a typical opengl scenario because the render cycle shouldn't be creating ByteBuffer's ideally and this is where the time sensitive processing happens.  But in principal this sounds like something that could shave off time from a performance perspective for other use cases.

I'd be interested to hear where you think this could be used in LWJGL itself.
30  Games Center / Showcase / Re: Little War: Shatter of Serenity on: 2015-08-09 18:29:56
Nice trailer! What did you use to create it?
Pages: [1] 2 3 4
 
KaiHH (146 views)
2016-01-31 23:15:29

sci4me (151 views)
2016-01-23 21:47:05

sci4me (137 views)
2016-01-23 21:46:58

KaiHH (171 views)
2016-01-19 13:26:42

theagentd (256 views)
2016-01-05 17:10:00

ClaasJG (270 views)
2016-01-03 16:58:36

chrisdalke (261 views)
2015-12-28 06:31:21

Guerra2442 (267 views)
2015-12-25 03:42:55

Guerra2442 (267 views)
2015-12-25 03:27:21

theagentd (295 views)
2015-12-21 14:43:24
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

Rendering resources
by Roquen
2015-10-15 07:40:48
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!