Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (796)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (864)
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]
1  Discussions / General Discussions / How do you build your 3D environments? on: 2019-05-22 15:08:38
For those of you that work on 3D projects, what are your preferred methods for creating the environments?

The ways that I can imagine are:
1) Build the entire map in a 3D modeling software
2) Build the landscape in a 3D modeling software, procedurally place objects on the landscape
3) Build a map-making tool custom to your game to allow easy map building

Each of the three have their own benefits and drawbacks, but what have you found that is realistic for a one-man show?

P.S. - for number 3, at what point in the game making process do you decide to duplicate the project and make one side become the game and the other side become the map maker? Or, do you make them one-in-the-same?
2  Game Development / Newbie & Debugging Questions / Re: [LWJGL] How to handle separate OBJ Groups and their materials on: 2019-05-22 11:59:25
Thank you for the fast response!

So, considering your first option:
Suppose I have a model which has two groups: a character body and a metal arm
I would batch render all of the character bodies and then all of the metal arms (or vice versa)?

Considering the second option:
I would need to store all vertex/normal/texture/index information in buffers for the VAO and then ALSO pass it in to the shader as a uniform buffer object?

(I've never used UBO's before, so pardon me if I don't understand!)

~QuicK
3  Game Development / Newbie & Debugging Questions / [LWJGL] How to handle separate OBJ Groups and their materials on: 2019-05-21 21:32:27
OBJ File structure allows for groups of faces to have a single material attached to them.
I have written a parser which separates groups and they each have their own material.

How can I go about getting that data to the shader?
I figure my two options are:

1) Load them in as a vertex array object attribute
2) Load them in as uniform variables

The only way I know how to implement option 1 is to load an array of material data for every vertex which seems to be a LOT of extra information. Is there a way to point to the current group's material while it's being drawn and then switch to a new material for the next group? Or, is there something I'm missing completely?

Option 2 doesn't seem viable because it seems to persist throughout the whole draw call.

Any information would be greatly appreciated.

Thanks,

~QuicK
4  Games Center / Showcase / Re: Clarence's Paradise on: 2017-01-05 20:27:06
Cool stuff, man!

This forum is a great place to learn. The pros here are extremely knowledgeable about not only Java and game libraries, but most of them know quite a lot about memory management, the OpenGL graphics pipeline, resources that will help you get started or point you in the right direction, and many, many more topics. Smiley

Stick with it!

Cheers,

-QuicK
5  Game Development / Newbie & Debugging Questions / Re: Tile movement toward mouse not working correctly on: 2017-01-05 14:04:42
When I face a problem like this (one in which it seems simple, yet I can't get it to work no matter what), I do one of two things:
1) I start from scratch and develop a system that works (not recommended)
2) I start simple. In your case, making a function that successfully moves an entity from one tile to an adjacent tile and keep improving on this until you have reached the desired effect.

I would try first getting adjacent tile movement working (where you can freely move an entity around one tile at a time using wasd or any simple movement controls).

I would then work on automating movement along the axes so that I could move the entity any number of spaces in any of the four directions (or 8 if you are allowing diagonal movements).

Once both of these are functioning properly, I would use the axis aligned movement to create an 'L' shaped path to the point where I want the entity to move.

From there, you should be able to implement any kind of path-finding algorithm you would like.
(most of them could probably be done without the axis aligned movement)

As far as the "move extremely fast to the tile clicked" issue...try doing some research on delta-time for game development.
6  Game Development / Newbie & Debugging Questions / Re: Cubes - Individual faces [SOLVED] on: 2017-01-04 20:17:54
Just a quick update:

I overhauled the rendering method for this project and it is not running a LOT better.

Before, I had trouble rendering even two 16x16x16 chunks of cubes and now I can render multiple 16x32x16 chunks with no issue.

The solution for me was to load all vertex, texture, and index data into one VAO per chunk and this seems to be working very well so far.

Cheers,

-QuicK
7  Game Development / Newbie & Debugging Questions / Cubes - Individual faces on: 2017-01-03 15:58:55
I am using a VAO to render a voxel landscape. I am working on some rough optimizations currently and I just had a couple of questions about best practices.

1) Is it enough to exclude index data or should I get rid of the vertex data too? (it seems faster to just keep the vertex data loaded)
2) Should I disable drawing by excluding index data or should I use glCullFace(front and back)?
3) If anybody could point me to some documentation on how to analyze OpenGL efficiencies/run-time, that would be awesome!

Cheers,

-QuicK
8  Game Development / Newbie & Debugging Questions / Re: FPS Sensitive Jumping on: 2016-12-26 01:54:16
Thank you for the replies guys.

I am currently on vacation and will look back into this when I get back!

However to answer your question:
The gravity appears to be lower when my fps drops however the height of my jump is correct. And it is only the velocity.y that feels this effect.
When my fps is at 60 the gravity speed is fine
9  Game Development / Newbie & Debugging Questions / FPS Sensitive Jumping on: 2016-12-22 21:59:55
I am working a 3D project.

My movement is scaled by a delta factor so that it is not affected by fps drops, however...
When my fps drops:
1) My jump height is correct
2) My movement speed is correct
3) My gravity's speed is not

Any suggestions as to why this is occurring? (Code below..)
Sorry, I can't figure out how to put the code in a spoiler tag.

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  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
public class Player extends MovableGameObject {
   
   private boolean inAir = false;
   private final float GRAVITY = -0.015f;
   private final float JUMP_POWER = 0.22f;
   private final float WALK_SPEED = 3.5f;
   private final float RUN_MODIFIER = 3f;
   private final float CROUCH_MODIFIER = 2.5f;
   
   private final Vector3f[] collisionPositions;
   private Vector3f hitBox = new Vector3f(0.4f, 1.9f, 0.4f);
   private final int collisionPointCount = 8;
   private int direction;
   
   public Player(TexturedModel model, Vector3f position, float rotX,
         float rotY, float rotZ, float scale) {
      super(model, position, rotX, rotY, rotZ, scale);
      calculateDirection();
   }
   
   public void move(ChunkEngine chunkEngine) {

      Vector2f direction = new Vector2f((float)Math.cos(Math.toRadians(rotY)), (float)Math.sin(Math.toRadians(rotY)));
     
      boolean W = Keyboard.isKeyDown(Keyboard.KEY_W);
      boolean A = Keyboard.isKeyDown(Keyboard.KEY_A);
      boolean S = Keyboard.isKeyDown(Keyboard.KEY_S);
      boolean D = Keyboard.isKeyDown(Keyboard.KEY_D);

     
      int runFlag = isRunning ? 1 : 0;
      int crouchFlag = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 1 : 0;
      if (isRunning)
      System.out.println("Running!");
     
      velocity.x = 0;
      velocity.z = 0;
     
      float speedModifier = (WALK_SPEED + RUN_MODIFIER * runFlag - CROUCH_MODIFIER * crouchFlag);
     
      if (W) {
         velocity.z += -direction.x * speedModifier * DisplayManager.getDelta();
         velocity.x += direction.y * speedModifier * DisplayManager.getDelta();
      }
      if (S) {
         velocity.z += direction.x * speedModifier * DisplayManager.getDelta();
         velocity.x += -direction.y * speedModifier * DisplayManager.getDelta();
      }
     
      if (D) {
         velocity.x += direction.x * speedModifier * DisplayManager.getDelta();
         velocity.z += direction.y * speedModifier * DisplayManager.getDelta();
      }
      if (A) {
         velocity.x += -direction.x * speedModifier * DisplayManager.getDelta();
         velocity.z += -direction.y * speedModifier * DisplayManager.getDelta();
      }
     
     
      if (Keyboard.isKeyDown(Keyboard.KEY_SPACE) && !inAir) {
         inAir = true;
         velocity.y = JUMP_POWER;
      }
     
      if (!W && !S) {
         velocity.z *= 0.9f;
      }
     
      if (!D && !A) {
         velocity.x *= 0.9f;
      }
     
      if (velocity.x > 0) {
         if (chunkEngine.getBlockAt(position.x + velocity.x + hitBox.x, position.y, position.z + hitBox.z).getBlockID() != 0
          || chunkEngine.getBlockAt(position.x + velocity.x + hitBox.x, position.y, position.z - hitBox.z).getBlockID() != 0)
            position.x -= velocity.x;
      }
      if (velocity.x < 0) {
         if (chunkEngine.getBlockAt(position.x + velocity.x - hitBox.x, position.y, position.z + hitBox.z).getBlockID() != 0
          || chunkEngine.getBlockAt(position.x + velocity.x - hitBox.x, position.y, position.z - hitBox.z).getBlockID() != 0)
            position.x -= velocity.x;
      }
     
      if (velocity.z > 0) {
         if (chunkEngine.getBlockAt(position.x + hitBox.x, position.y, position.z + velocity.z + hitBox.z).getBlockID() != 0
          || chunkEngine.getBlockAt(position.x - hitBox.x, position.y, position.z + velocity.z + hitBox.z).getBlockID() != 0)
            position.z -= velocity.z;
      }
      if (velocity.z < 0) {
         if (chunkEngine.getBlockAt(position.x + hitBox.x, position.y, position.z + velocity.z - hitBox.z).getBlockID() != 0
          || chunkEngine.getBlockAt(position.x - hitBox.x, position.y, position.z + velocity.z - hitBox.z).getBlockID() != 0)
            position.z -= velocity.z;
      }
     
      if (inAir) velocity.y += GRAVITY;
      else {
         velocity.y = 0;
      }
     
      if (chunkEngine.getBlockAt(position.x, position.y-0.5f, position.z).getBlockID() == 0) {
         inAir = true;
      }
     
      if (velocity.y <= 0) {
         if (chunkEngine.getBlockAt(position.x + hitBox.x, position.y + velocity.y, position.z + hitBox.z).getBlockID() != 0
           || chunkEngine.getBlockAt(position.x - hitBox.x, position.y + velocity.y, position.z + hitBox.z).getBlockID() != 0
          || chunkEngine.getBlockAt(position.x - hitBox.x, position.y + velocity.y, position.z - hitBox.z).getBlockID() != 0
          || chunkEngine.getBlockAt(position.x + hitBox.x, position.y + velocity.y, position.z - hitBox.z).getBlockID() != 0) {
            position.y -= velocity.y;
            inAir = false;
         }
      }

      // Apply velocities to position
      super.increasePosition();
     
      rotX -= Mouse.getDY() * 0.1f;
      rotY += Mouse.getDX() * 0.1f;
     
      // Post-Movement corrections
     
      y[0] = (int)position.getY();
     
      if (rotX > 90) rotX = 90f;
     
      calculateDirection();
   }

   public int getX() {
      return x[0];
   }
   
   public int getY() {
      return y[0];
   }

   public int getZ() {
      return z[0];
   }
}
10  Game Development / Game Play & Game Design / Re: The best way to normalize chances in a two-player game? on: 2016-12-12 20:09:06
I'm not sure of the direction you would like to take the game, but...

Another option would be to add dynamics to the game that give you more of an advantage the less pieces you have left on the board. (such as more moves for less pieces or some kind of power-up, etc.)
An alternative to this would be to make things more difficult for the player for each turn they take (in a row).

From the options that you have listed, however...

>Limiting the moves will reduce the "skill" factor of the game.
>Keeping the classic rules would hit home with some people, but most might find it obnoxious (depending on how easy it is to clear the board on your first turn)
>Each of the others would keep the game fairly balanced.

Cheers,

-QuicK
11  Game Development / Game Play & Game Design / Re: How to simplify existing Inventory System? on: 2016-12-12 19:15:06
@Hydroque has a good solution to this issue.

An aside about software development:

Abstraction is good when dealing with complicated systems and abstract ideas. For something as simple as an inventory, there is no need to abstract this concept further using abstract classes. The same is true for "Item" and "ItemStack". If desired, you can use interfaces to provide a clear and explicit definition of these objects. In the code that you posted, there is a lot of unnecessary abstraction. (Your example actually makes the concepts more difficult to understand)

Combining Hydroque's approach with yours:

All you need are three classes: Item, ItemStack, and Inventory
(giving Inventory its own class will help with abstraction down the road)

Item should contain the basics of what an Item is:
an ID, Title, Description, etc.

There are multiple ways that you could conceptualize your list of Items...
1) Reference a static list of items using aliasing to create instances of particular items (I think Minecraft likes to do things this way, if I remember correctly)
2) Load items from something similar to JSON into a table (Probably only want to mess with this if you're planning a huge project)
3) Enums (blegh)
4) Flyweight or Factory design patterns
5) many many more...

ItemStack should merely be a container for Items:
It should contain what Item it is referring to, how many of that Item, and possibly a maximum stack size for that Item.

Inventory should be a structure that allows for indexing such as a 2-D table.
This structure should only contain ItemStacks, no Items.
It should provide methods to add ItemStacks and remove ItemStacks only.

If you want something that is easily sortable, you could use an ArrayList with a Comparator.
(If this interests you, I could explain this idea further)

When designing systems in the future, try to keep "KISS" in mind. (Keep It Simple, Stupid!). In general, the simpler a solution is, the more elegant it will be and the easier it will be to work with.

Cheers,

-QuicK
12  Game Development / Newbie & Debugging Questions / AABB collision detection as a filter for SAT collision detection on: 2016-01-26 14:26:35
I am currently attempting to implement basic collision detection and response in a 2D environment.

I have successfully implemented AABB collision detection, and SAT collision detection and response.

I was thinking about using the AABB check to see if SAT needs to be used in order to cut down on SAT calls.

Can anybody think of a reason why this will not work?

If so, please explain.

Thanks!
13  Game Development / Newbie & Debugging Questions / [SOLVED] Slick Texture Loading Performance Issues on: 2015-04-25 04:37:58
I have a 2D game environment set up through LWJGL and Slick-Utils. I have a player that moves around and can shoot bullets.

Every time I create a new bullet, the system has to load the bullet's spritesheet in.

I am using immediate-mode rendering (I know this isn't a very efficient way to render things)

My question is:

Is there a way to create these bullets without having slick use the file IO system every single call?
Ideally, load the image in once, and use it for every Bullet object.


Edit: LOL I'm sorry....it's late. I just created the animation object outside of the bullet class and used one global animation for all bullets........Cry
Pages: [1]
 
hadezbladez (3627 views)
2018-11-16 13:46:03

hadezbladez (1292 views)
2018-11-16 13:41:33

hadezbladez (3633 views)
2018-11-16 13:35:35

hadezbladez (695 views)
2018-11-16 13:32:03

EgonOlsen (3998 views)
2018-06-10 19:43:48

EgonOlsen (4525 views)
2018-06-10 19:43:44

EgonOlsen (2686 views)
2018-06-10 19:43:20

DesertCoockie (3546 views)
2018-05-13 18:23:11

nelsongames (3699 views)
2018-04-24 18:15:36

nelsongames (4722 views)
2018-04-24 18:14:32
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45
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!