Java-Gaming.org Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (595)
Games in Android Showcase (168)
games submitted by our members
Games in WIP (646)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2 3 ... 10
 1 
 on: 2015-07-06 03:09:57 
Started by Therobodavo - Last post by Jesse
Quote
Also, if there's already a lengthy tutorial just for this out there that explains everything I'm asking, I'll look at that instead of having you write really long threads xD. Up to you though, I'm just here to learn about the right way to make games (and make my game before August xD).

There's a lot of info out there, but honestly I wouldn't know where to send you. With all the changes OpenGL has undergone, tutorials are kind of all over the place in terms of what they cover and whether they're up to date. Maybe someone else can offer some suggestions though.

Unfortunately it's hard to give these subjects good treatment in short forum posts, so I may just be adding to the confusion here. I'll go ahead and mention a couple more things though.

Fortunately, how all this works at a conceptual level (transforms, etc.) doesn't really change in modern OpenGL, so even though the details will be different, all this knowledge will remain relevant. In simple terms, the difference as far as transforms go is just that the fixed-function pipeline does a lot of the work for you, while in modern OpenGL you have to do more of it yourself. But, the concepts are the same.

The camera thing is unfortunately a little hard to explain without getting into some complex concepts like transform inversion and concatenation. Instead of getting into all that, I'll just offer some pseudocode (off the top of my head, may be errors) showing what rendering a single frame with a camera that follows the player might look like:

clear the transform (glLoadIdentity)
glTranslatef(-player.x, -player.y)
for each entity (including the player)
  push matrix stack (glPushMatrix)
  glTranslatef(entity.x, entity.y)
  render entity
  pop matrix stack (glPopMatrix)
end for

Note that everything having to do with OpenGL transforms is confined to the rendering code - you don't have to call OpenGL transform functions from anywhere else or accumulate transforms in OpenGL or anything like that. Put another way, when it's time to render a frame, you always start with a 'clean slate' as far as the OpenGL transform is concerned, and then go from there.

 2 
 on: 2015-07-06 02:19:12 
Started by Therobodavo - Last post by Therobodavo
I thought you couldn't easily make a camera follow the player except for how I was doing it. Honestly, I was just going by what I saw in a tutorial on youtube. I would love to hear how that is done (correctly), but sorry for causing so many long threads xD. Also, I'm not dealing with any rotations or anything atm, just translations (people can jump but that's still translations). Also, just to be clear, I have a game (instance of it) running a loadScreen method every frame, which then draws every object loaded using a draw() method. This calls each objects drawEntity or drawTile method or what not, which would be the updateVBO()  method i have. IF that's the correct way to do it as you said, then I'm confused on how I should implement the translate method into everything (Player Camera vs. VBO's).

Also, if there's already a lengthy tutorial just for this out there that explains everything I'm asking, I'll look at that instead of having you write really long threads xD. Up to you though, I'm just here to learn about the right way to make games (and make my game before August xD).

 3 
 on: 2015-07-06 01:53:47 
Started by BurntPizza - Last post by philfrei
@opiop65 What a fine kitty!

 4 
 on: 2015-07-06 01:49:43 
Started by Therobodavo - Last post by Jesse
I think I should probably clarify (for you and anyone else reading) that the approach I'm describing is only one of various approaches you can take. The reason I've been sticking with it is that it's arguably simpler than approaches that use batching, and it seems like a good starting point for using VBOs. But, I don't want to give the wrong impression that it's the only way to do it.

That said, I think I'm starting to follow your line of thought more clearly. Originally, you were just specifying the vertex positions for each quad manually, e.g.:

1  
GL11.glVertex2f(x, y);

And so on. So, when you switched to VBOs, your first thought (I think) was to do the same thing with the VBO, that is, to modify the vertex positions in the VBO (just as you were doing above with glVertex2f) whenever the entity moved. That makes perfect sense, so I get where you're coming from there.

And in fact, you absolutely could do it that way. Furthermore, doing it that way is more or less required if you want to batch multiple entities into a single draw call. It's probably also the way most games and game frameworks do it. The reason I steered away from that approach is that it can be more complicated to implement, and is less straightforward with VBOs than it is with immediate mode.

So to clear things up a little, there are, roughly speaking, two approaches you can take to rendering an entity:

- Set a transform for the entity to specify its position, rotation, etc., and then render a static mesh using that transform.
- Just leave the transform at identity (basically 'no transform'), and manipulate the quad vertex positions directly, as you were doing initially and as you suspected needed to be done with VBOs as well.

So to restate, you can either change the transform and leave the vertex positions alone, or you can leave the transform alone and change the vertex positions. As far as what the user sees onscreen, the results will be the same either way. Both methods are valid, and each has its situations in which it's appropriate. I've been advocating for the 'change the transform' method because it's important to understand that method, and it's simpler in some ways, but both approaches are valid.

I'm trying (unsuccessfully) to keep these posts from being too long, so I won't get into a lengthy discussion of transforms here. Here's a couple hints though. First, from what you posted I think you're probably using glTranslatef() incorrectly. It looks like you're accumulating transforms frame-to-frame, and you don't want to do that. You shouldn't be calling any OpenGL transform functions from your 'move' functions. Those calls should only be made from your render functions. Rendering an entity would look something like this:

clear the transform (glLoadIdentity)
set the translation (glTranslatef)
set render state (textures, etc.) and make your draw call

If you intend to have a moving camera in your game (e.g. one that follows the player), things are a little more complicated, but not much.

 5 
 on: 2015-07-06 01:43:52 
Started by BurntPizza - Last post by opiop65


Say hello to Casida my kitty! Don't mind the drool falling out of her mouth, she was pretty hot in my car on the way home. Oh and yes, she is sitting near the back window of my car, she didn't want to be in her carrier box so she just wandered around the car while I drove home!

 6 
 on: 2015-07-06 01:07:29 
Started by Therobodavo - Last post by Therobodavo
Ok thank you for clearing up mesh's and how quad's are a simple form of them. I get how the textures work with quads, but the thing I still don't get is this. The way I was rendering each object before I used VBO's, each vertex would be based off of an x and y, and that would run every frame. So in a sense, those coordinates would be updated every frame based on the x and y of the object. Now, with VOB's, those coordinates are made and stay the same no matter  what x and y change to. That's because the coordinates are created once, and saved.

I'm actually using the transform method in game my currently

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
   public void moveRight(float length)
   {
      direction = 1;
      //Safely moves right by the length provided if possible
      if(canMove("Right",length) == true)
      {
         //checks if the user will stay in the position it should and can actually move to where it wants to
         if(this.x < 350 && (this.x + length) <= 350)
         {
            this.x+= length;
         }
         else if(this.x >= 350)
         {
            GL11.glTranslatef(-length,0,0);
            this.x += length;
         }
         //GL15.glBufferSubData(GL15.GL_ARRAY_BUFFER, 10, vertexData);
      }
   }

This is used in moving left, and right for the player.

From my understanding, this moves the entire world, since what acts as a "camera" is always looking at the same place. I have this all working just fine for the moment, but it doesn't translate single objects in a game. Maybe I have a misunderstanding with glTranslate, but I would think I need to update the coords for the VBO still. Also I get how the texture is static and I just need to change the texture coords (even though I've never done it before), but Idk. I'm not changing the size either atm, just the location.

Anyway, I think my confusion lies based on one thing you said.

Quote
I think some of your confusion is in thinking that the mesh and/or texture somehow have to 'move' if your entity moves. They don't. The mesh and texture can be entirely static and unchanging; you move the entity by changing the transform.

I thought the transform method transforms the world... so I guess my mind is just blown lol. Maybe the 2 zeros are what dictates that. I feel like a OpenGL noob xD But really, if the transform method is a llot more flexible than what I think, my life may be a lot easier.

 7 
 on: 2015-07-06 00:52:21 
Started by BurntPizza - Last post by chrislo27
I finally combined the block and item animations into the asset registry so I only have to call dispose() on one thing and everything will be taken care of! Grin

On a side note, I tried to design the first boss in my game. Since she'll be the first step in unlocking the first major part of the tech tree related to cloning, she'll be called Lady Redundant Woman.

I love that name.

 8 
 on: 2015-07-06 00:50:20 
Started by tommohawkaction - Last post by MrMapcom
Check some Googles : https://www.google.es/search?q=a8-6410+gta+v&ie=utf-8&oe=utf-8&gws_rd=cr&ei=Pc2ZVafMH4KBUZDfh4AE
And Steam: http://store.steampowered.com/app/271590/

I will struggle but able to run it (using the GPU and not only the APU).
BTW, both processors have almost the same power. So the real difference is the GPU and the amount of RAM. And for the power those laptops have, you wont get to use 12GB RAM in a game, that amount maybe useful if you play with Blender or some video editor.
Is up to you. Pointing

 9 
 on: 2015-07-06 00:43:11 
Started by wessles - Last post by wessles
More levels / musics. Same feedback as before. Please specify the level for each score.

EDIT: almost forgot, you have to go into your home folder and delete a file called .[username]_rflexscore if you have already tested the game.

 10 
 on: 2015-07-06 00:39:20 
Started by Therobodavo - Last post by Jesse
Quote
Now regarding batching, I've never worked with this before and have no clue what to do with it. So I may just be missing what you're saying, but I don't know what to do exactly to move the coords for each "creature/texture". If batching is the way to do it, I still have no clue how to do it with VBO's xD.

To keep things simple, let's forget about batching for now. It's just an optimization, and one that you may not even need.

Quote
I guess the thing I'm still stuck on is.. so the vertex Vbo I have saves the data for the location. You're saying a static mesh doesn't change, but for a game the texture for each creature/item/entity can and most likely will move. Therefore the data will change, so I would need to do something to chanhe that data That's what I thought the SubData mathod was for, but I didn't understand how that was done.



I think I understand buffers... but I guess the way data (x,y) for each vertex is stored/changed is a little unclear for me cause Idk what to do to change it :/

Although I think I understand what you're getting at above, there are several things there that are inaccurate or incorrect as stated. There are probably some things that need to be cleared up conceptually here. Apologies if this seems too basic, but it might be worth clarifying some terminology.

A mesh, as you probably know, is a collection of data such as vertex positions, texture coordinates, and so on that can be used to render something. (The quads you're working with are meshes, just simple ones.) A texture is an image that's 'painted' onto mesh geometry. For a simple 2-d game, entities are often just quad meshes with a single texture (I think that's what you're doing).

A transform specifies how some set of geometry should be positioned, oriented, and otherwise shaped and placed in the world. Transforms can be pretty complex, but for a 2-d game all you usually need is translation (the position of the object), and maybe scale (its size) and orientation (what angle it's at). If your entities don't change size and never rotate, all you need is translation (position). In the OpenGL fixed-function pipeline, there's a family of functions (e.g. glTranslatef() and so on) that allow you to specify the transform for the next draw call.

An entity in your game will typically consist of a mesh, a texture, and a transform. I think some of your confusion is in thinking that the mesh and/or texture somehow have to 'move' if your entity moves. They don't. The mesh and texture can be entirely static and unchanging; you move the entity by changing the transform.

So:

mesh+texture+transform = entity

Mesh and texture are static, transform changes as needed.

Once again I'll stop there due to length, but maybe that will help clear things up a bit.

Pages: [1] 2 3 ... 10
 
deepthought (48 views)
2015-06-30 15:39:44

deepthought (54 views)
2015-06-30 15:39:09

deepthought (63 views)
2015-06-30 15:36:52

Za\'Anzabar (39 views)
2015-06-29 05:44:54

TritonDreyja (47 views)
2015-06-24 17:10:40

CopyableCougar4 (46 views)
2015-06-23 00:34:45

BurntPizza (52 views)
2015-06-21 20:36:46

cookiecompiler (93 views)
2015-06-11 15:42:53

cookiecompiler (55 views)
2015-06-11 15:41:14

NegativeZero (80 views)
2015-06-11 09:49:18
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

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14
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!