Java-Gaming.org Hi !
Featured games (88)
games approved by the League of Dukes
Games in Showcase (679)
Games in Android Showcase (194)
games submitted by our members
Games in WIP (731)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 6 7 [8] 9 10
 71 
 on: 2016-05-22 13:57:32 
Started by pw - Last post by pw



Hello guys, i'd like to show you my first mobile game Racing2D.

It's a cross platform multiplayer topdown racing game for iOS and Android.

I programmed it entirely in java, using libgdx as framework and overlap2d as level-editor.

For the networking part i programmed my own udp network library with hole punch support.

I would be really happy if you could test the multiplayer part with your friends and post some feedback.There are probably some bugs too, so i apologize in advance  ; Cheesy (it's only working with a wifi connection - the hole punch over mobile connection is not working









Big shoutout to the guys working on libgdx and overlap2d,awesome stuff!

 72 
 on: 2016-05-22 13:26:41 
Started by P0jahn - Last post by VaTTeRGeR
yes it would mess up collision if kept unbounded, physics simulations often use fixed time steps to not allow any glitches of that kind.

if your delta values get too small or to big, numeric stability goes out of the window and everything breaks,
so you need to bound it.
If you add a very very small float value to a very big float value only the big value remains as the result because of limited precision and rounding.

in a game this results in a unit not moving at all if it is very slow.

 73 
 on: 2016-05-22 13:16:30 
Started by stoony - Last post by stoony
Quote
I can't rotate the camera, it either can't be done or there is no obvious way how to do it
==> You cannot, cam is managed by game (more convenient on tablets) but maybe something could be added for PC, I gonna think about it
Quote
It says I have 1 skill point to spend but I can't spend it no matter how often I click save in the skill tree
==> You have to double click/tap (first time, only select and display the effect of the skill in the bottom bar)
Number of available skill points should be decreased before saving the dialog.

Quote
There is a big blue arrow at one place, looks like it is a zoning point but I don't know how to zone
==> You are required to assign you skill point before leaving.

 74 
 on: 2016-05-22 12:54:15 
Started by P0jahn - Last post by P0jahn
So basically it's like if the computer is unable to run the game at 60fps, we "jump" the characters to trick the human eye into smoothness. Wouldn't that mess up collision detection?

 75 
 on: 2016-05-22 09:49:08 
Started by thedanisaur - Last post by elect
Some tips:

- use (int) direct buffers for handling opengl names, such as m_handle
- no need to call glBindBufferBase and glUniformBlockBinding multiple time if the block_index is not used from other UBOs, same for the model_matrix, anim_joint and inv_bind
- don't query every time uniform locations
- use explicit locations if available, this will avoid you a lot of uniform binding stuff
- merge projection and view matrix in one unique UBO and upload them together
- ibo is part of the vao, you don't need to bind/unbind it

I see only one glDrawElements

 76 
 on: 2016-05-22 09:31:09 
Started by thedanisaur - Last post by basil_
i dont think i got it yet, .. you're drawing same thing multime times and not all passes work ?


 77 
 on: 2016-05-22 09:15:28 
Started by stoony - Last post by ziozio
Just created a new character, here is some feedback from me

  • I can't rotate the camera, it either can't be done or there is no obvious way how to do it
  • It says I have 1 skill point to spend but I can't spend it no matter how often I click save in the skill tree
  • In the main screen the options allow me to change the keys for things, the keys come up as numeric values so I don't actually know what the defaults are. I also can't find this options screen in the main game
  • There is a big blue arrow at one place, looks like it is a zoning point but I don't know how to zone

For me it was mostly a lot of confusion Smiley On the positive side, the game looks good!

 78 
 on: 2016-05-22 06:49:31 
Started by thedanisaur - Last post by thedanisaur
I'm having trouble drawing objects with uniformbuffers multiple times per frame (mapping the buffer calling glDrawElements, mapping to the buffer and calling glDrawElements again).

Generating the buffer:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
   public UniformBuffer(GL4 gl, int buffer_draw, int binding_index, float[] data)
   {
      m_handle = new int[1];
     
      FloatBuffer buffer_data = SNumberUtils.convertToFloatBuffer(data);
     
      gl.glGenBuffers(1, m_handle, 0);
      gl.glBindBuffer(GL4.GL_UNIFORM_BUFFER, m_handle[0]);
      gl.glBufferData(GL4.GL_UNIFORM_BUFFER, data.length * Buffers.SIZEOF_FLOAT, buffer_data, buffer_draw);
      gl.glBindBuffer(GL4.GL_UNIFORM_BUFFER, 0);
   }


Mapping the buffer:
1  
2  
3  
4  
5  
      
      gl.glBindBufferBase(GL4.GL_UNIFORM_BUFFER, block_index, m_handle[0]);
      gl.glUniformBlockBinding(program, bind_location, block_index);
      gl.glMapBuffer(GL4.GL_UNIFORM_BUFFER, GL4.GL_WRITE_ONLY).asFloatBuffer().put(data);
      gl.glUnmapBuffer(GL4.GL_UNIFORM_BUFFER);



Then binding before glDrawElements():

1  
2  
      gl.glBindBufferBase(GL4.GL_UNIFORM_BUFFER, block_index, m_handle[0]);
      gl.glUniformBlockBinding(program, bind_location, block_index);


render:
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  
   public void render(GL4 gl, GLU glu)
   {
      if(m_ibo == null) return;
      bindTextures(gl);
      map(gl);
      gl.glPolygonMode(m_face, m_mode);
      gl.glEnable(GL4.GL_DEPTH_TEST);
      gl.glEnable(GL4.GL_CULL_FACE);
      gl.glEnable(GL4.GL_BLEND);
      gl.glBlendFunc(GL4.GL_SRC_ALPHA, GL4.GL_ONE_MINUS_SRC_ALPHA);

      Matrix4f projection_mat = m_camera.getProjectionMatrix();
      float[] projection_array = projection_mat.get(new float[16], 0);
      Matrix4f view_mat = new Matrix4f().identity();
      float[] view_array = view_mat.get(new float[16], 0);

      m_model_ubo.bind(gl, m_shader.getUniformBlockLocation("model_matrix_buff"), UniformBuffer.MODEL_INDEX, m_shader.getHandle());
      m_joint_ubo.bind(gl, m_shader.getUniformBlockLocation("anim_joint_buff"), UniformBuffer.JOINT_INDEX, m_shader.getHandle());
      m_inv_bind_ubo.bind(gl, m_shader.getUniformBlockLocation("inv_bind_buff"), UniformBuffer.INVERSE_BIND_INDEX, m_shader.getHandle());
      m_vao.bind(gl);
      m_ibo.bind(gl);
      m_shader.update(gl);
      m_shader.setUniformMatrix4f(gl, false, "projection_matrix", projection_array);
      m_shader.setUniformMatrix4f(gl, false, "view_matrix", view_array);
      gl.glDrawElements(GL4.GL_TRIANGLES, m_vert_count, GL4.GL_UNSIGNED_INT, 0);
      m_ibo.unbind(gl);
      m_vao.unbind(gl);
      m_inv_bind_ubo.unbind(gl);
      m_joint_ubo.unbind(gl);
      m_model_ubo.unbind(gl);
      //gl.glFinish();
   }



This way the only objects that end up on screen are the last ones to get drawn, if I add glFinish() to the end of each render pass then I get all of the objects on screen.

Edit: code formatting

 79 
 on: 2016-05-22 05:40:58 
Started by Wiki Duke - Last post by Wiki Duke
I've noticed the serious lack of good explanation of FPS camera methods. I've seen everything from using cross product to using sketchy pi calculations and back around to poorly explained trigonometry. I am writing this forum post for novices in hopes that a random google search will pick it up... but whoever browses is good too! Smiley

This tutorial is not based off OpenGL and doesn't use 3rd party libraries. I've seen many people use OpenGL fixed function pipeline and many other inadapatable means of showing what entails a FPS camera. So.. that was a problem. I am going the trig route because its fast, simple, and easy to understand. Pure math.

Things you should know before this:
Using trigonometry functions sin, cos, and tan (sin and cos are to be used)

I am writing this in Java, because well... this is JGO.
Okay let's get started!



We are in the main game loop, what we want to do is this:
If a key is down move, in the direction the object is facing, with respect to the key's direction. Also, strafing.



Simple enough. As you see in the picture, I've put out a right triangle on a smiley face. Since, in game, we allot a predefined variable for speed, we can set this as the Hypotenuse, or the distance. In the game, the object has rotation. Let the Yaw value (pitch = x, yaw = y, roll = z) be the angle between the hypotenuse and the adjacent side. I am calling this angle A for alpha, as per the angles name. We have everything we need now.

This is what they mean, in case you had no idea. Sine works with opposite and hypotenuse, Cosine works with adjacent and hypotenuse, and tangent works with opposite and adjacent. We are going to use both Sine and Cosine.
S.oh C.ah T.oa
Sine Cosine Tangent


Looking back at the picture, let's imagine the hypotenuse, coming out of Mr. Smiley, is the direction that we want to go. Now look at the adjacent side and the opposite side... they describe how much you need to "go over" and "go up" in order to reach that goal. Genius right?

So if the adjacent comes out to be 5 and the opposite comes out as 5 (no you don't just get an equilateral triangle) you need to translate your object's x by 5 and y by 5.
Opposite = y
Adjacent = x


We need to do maths for that now.

Here is the formula for the adjacent side (what we are trying to find)
Cos(A) = adj / hyp

Here is the formula for the opposite side (what we are trying to find)
Sin(A) = opp / hyp

Since we have the hypotenuse, and opp and adj are variables, we should multiply hyp over.
hyp * Cos(A) = adj
hyp * Sin(A) = opp


Now we have obvious means.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
// define some variables

float hypotenuse = 1f; // our distance we want to travel
float rotation = 0f; // the rotation of our object around the y axis (yaw), in degrees

// do the calculations

float adjacent = hypotenuse * Math.cos(Math.toRadians(rotation)); // note, toRadians because we were working in degrees
float opposite = hypotenuse * Math.sin(Math.toRadians(rotation)); // cos and sin only accept radians

// move the camera

Camera.x += opposite;
Camera.z += adjacent;


That wasn't so bad. You want to make this code run when you have arrow key up or W pressed. This allows you to move forward. If you want to move backwards instead, repeat the code... but switch the +='s with -=, naturally.

If you increase and decrease the rotation with keys A and D plus move the object as shown, you get a normal FPS camera, but you maybe want strafing. Strafing is the act of looking forward, but moving to the side, still looking forward. Like the hammer time dance.

<a href="http://www.youtube.com/v/otCpCn0l4Wo?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/otCpCn0l4Wo?version=3&amp;hl=en_US&amp;start=</a>

If you think about it, we are going to rotate 90 degrees to the right and 90 degrees to the left then move. Naturally, we want to not alter the rotation permanently, because we don't want to instantly face the way we are walking... or have to translate the rotation back. This would be an example of redundancy. So we will just add 90 degrees to our Yaw (y) temporarily.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
// code as before

float hypotenuse = 1f;
float rotation = 0f;

// manipulated rotation with not permanent 90 degrees

float adjacent = hypotenuse * Math.cos(Math.toRadians(rotation+90));
float opposite = hypotenuse * Math.sin(Math.toRadians(rotation+90));

Camera.x += opposite;
Camera.z += adjacent;


That wasn't so bad. You want to make this code run when you have arrow key left or A pressed. This allows you to move left. If you want to move right instead, repeat the code... but switch the +='s with -=, naturally.

Alternatively, you can do use ternary operations.

1  
float hypotenuse = isADown() || isWDown() ? 1f : isDDown() || isSDown() ? -1f : 0f;


Anything I didn't go over? Any questions? I will edit this post.


 80 
 on: 2016-05-22 02:38:00 
Started by Hydroque - Last post by Hydroque
The smilies and markup page is outdated.

I don't know all the tags and attributes you can set under the tags...
Does [ youtube time=115] [/youtube] work?

[youtube time=115]otCpCn0l4Wo[/youtube]

Pages: 1 ... 6 7 [8] 9 10
 
Mac70 (32 views)
2016-05-24 21:16:33

theagentd (41 views)
2016-05-14 18:38:35

theagentd (73 views)
2016-05-10 22:37:41

theagentd (79 views)
2016-05-10 22:33:46

IanParcs (110 views)
2016-04-18 14:18:53

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

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

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

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

IanParcs (251 views)
2016-04-12 03:51:16
FPS Camera Tutorial
by Hydroque
2016-05-22 05:40:58

Website offering 3D Models specifically for games for free
by vusman
2016-05-18 17:23:09

Website offering 3D Models specifically for games for free
by vusman
2016-05-09 08:50:56

Website offering 3D Models specifically for games for free
by vusman
2016-05-06 11:10:21

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