Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
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 ... 9
1  Java Game APIs & Engines / OpenGL Development / Attenuating light source via glLight methods? on: 2013-07-10 02:38:29
Is it possible to easily implement attenuating light (you have moving objects or light source, and as they get further from each other, the object becomes darker)?

The way I understand it is, if an object has a face that is facing the light source it will be fully lit no matter distance. Can I change this?
2  Discussions / General Discussions / Re: Whatever happened to Euclideon's Unlimited detail? look inside to see! on: 2013-07-08 00:21:50
Can this even be applied to games? Wouldn't storing billions of tiny dots take a lot of disk space, even if you can render it quickly (i.e. you need super small maps to be able to actually use this on an average PC)?
3  Java Game APIs & Engines / OpenGL Development / Re: 1 Large VBO or many small VBOs?? on: 2013-07-08 00:00:16
And suppose I have static (i.e. terrain) and moving (i.e. players) models. I would have 1 VBO for all static things (vertices, normals, colors, textures, including player colors and textures), and 1 VBO for player vertices and normals? So 2 VBOs total?
4  Java Game APIs & Engines / OpenGL Development / Re: 1 Large VBO or many small VBOs?? on: 2013-07-07 23:37:57
Nice tutorial, and are you saying they should be interleaved?
5  Java Game APIs & Engines / OpenGL Development / 1 Large VBO or many small VBOs?? on: 2013-07-07 22:55:24
I noticed this guy is using 4 VBOs per model. I thought to gain performance you try to minimize gl calls? Notice in the draw section (the second post) he has to loop through every single object to draw the VBOs for each object.

No one in the thread points out how many VBOs he is using, so is it ok to use many small VBOs (for each model) or should I use 1 large VBO??
6  Game Development / Articles & tutorials / Re: Gravity on: 2013-01-02 15:30:25
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  
//fields
private float x, y;
private float vx, vy;
private float elapsedTime = -1;
private final float g = -10;
private final float jumpingPower = 6;

private final int FPS = 60;
private final float DELTA = 1f/FPS;

public void update() {
    //crap here

    if(/*spacebar is pressed*/) {
        vy = jumpingPower; //you probably want a mechanism limiting the frequency of jumps
       elapsedTime = 0;
    }
   
    //gravity affects vy constantly
   if (elapsedTime != -1) {
        vy = elapsedTime * DELTA * jumpingPower + g / 2 * elapsedTime * elapsedTime * DELTA * DELTA; // alternatively, set initial value of vy as the stuff before the + sign, and increment by the stuff after the + sign
       y += vy;
        elapsedTime++; // alternatively, increment by 'DELTA' and get rid of 'DELTA' in equation for solving vy
   }
   
    //collision detection
   for(Blocks b : randomBlocks) {
        if(this.intersects(b)) {
            if (vy >= 0) { // We hit our head on something, start falling
               elapsedTime = -2f * jumpingPower / g; // The time when vy changes from positive to negative, i.e. you start falling. Completely inelastic collision.
           } else { // We landed on a platform, stop moving
               vy = 0;
                elapsedTime = -1;
            }
        }
    }
}


That's my approach, from memory. Might have mistakes?
7  Java Game APIs & Engines / OpenGL Development / Re: Newbie Polygon Texturing Question on: 2012-12-28 14:08:46
These tutorials are great; they're explained well..  Cheesy
8  Java Game APIs & Engines / OpenGL Development / Re: Newbie Polygon Texturing Question on: 2012-12-28 05:31:45
Yes I'll eventually learn about these things, thanks for the link.

One small step at a time!  Smiley
9  Java Game APIs & Engines / OpenGL Development / Re: Newbie Polygon Texturing Question on: 2012-12-28 05:22:52
So I have to reuse vertices, it can just be one fluid motion, going from vertex to vertex. i.e. in my original drawing, I have to texture the triangles:

1, 2, 4
1, 3, 4
3, 4, 6
3, 5, 6
5, 6, 8
5, 7, 8
7, 8, 10
7, 9, 10

(I'm calling glVertex2f 24 times. When there are only 10 vertices)

You could use GL_TRIANGLE_STRIP which lets you reuse 2 vertices each time resulting in 10 glVertex2f() calls

Interesting. Sounds like what I was looking for

@davedes that's what the code I posted does, I just wasn't sure if I was taking the long way about doing it
10  Java Game APIs & Engines / OpenGL Development / Re: Newbie Polygon Texturing Question on: 2012-12-28 05:19:35
So I have to reuse vertices, it can't just be one fluid motion, going from vertex to vertex. i.e. in my original drawing, I have to texture the triangles:

1, 2, 4
1, 3, 4
3, 4, 6
3, 5, 6
5, 6, 8
5, 7, 8
7, 8, 10
7, 9, 10

(I'm calling glVertex2f 24 times. When there are only 10 vertices)
11  Java Game APIs & Engines / OpenGL Development / Re: Newbie Polygon Texturing Question on: 2012-12-28 05:02:26
It's OpenGL and the texture should be zig zagging.

I have the effect working, it's just not very efficient:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
            float difY = tile.top() - tile.bottom();
            int offZ = off % 360;
            float o_ = 0;
            for (int z = offZ; z <= 360 + offZ; ) {
               float x_ = (float) (Math.sin(z * DEG_2_RAD) * 2 * PIXEL_X);

               gl.glTexCoord2f(tile.left(), tile.bottom() + difY * (z - offZ) / 360);
               gl.glVertex2f(l + o_, b + h_interval * (z - offZ) / 360); // bottom-left
              gl.glTexCoord2f(tile.right(), tile.bottom() + difY * (z - offZ) / 360);
               gl.glVertex2f(r + o_, b + h_interval * (z - offZ) / 360); // bottom-right

               z += 30;
               o_ = x_;

               gl.glTexCoord2f(tile.right(), tile.bottom() + difY * (z - offZ) / 360);
               gl.glVertex2f(r + x_, b + h_interval * (z - offZ) / 360); // top-right
              gl.glTexCoord2f(tile.left(), tile.bottom() + difY * (z - offZ) / 360);
               gl.glVertex2f(l + x_, b + h_interval * (z - offZ) / 360); // top-left
           }


(h_interval is the height of a tile, l is the left x coordinate of a tile, r is the right x coordinate of a tile, b is the bottom y coordinate of a tile, offZ is just a number i'm incrementing after each render, to make the effect move)

I'm trying to get a 'mirage' effect (tiles waving back and forth using sine. also i'm sure there's a way better way of doing this, if you know of it point it out)

edit: how do I get the smallest number of triangles (not reuse vertices) is my question I guess, in response to your edit
12  Java Game APIs & Engines / OpenGL Development / Newbie Polygon Texturing Question on: 2012-12-28 04:44:16
When texturing a polygon, what order do I have to follow exactly? Say I have this polygon



And I have a rectangular texture (of the same height, so the only thing changing is the x component)

How do I achieve this? I have vertices 1-10, what order do I use them to texture the polygon?

At the moment I'm breaking it up into quads and texturing those quads (using only a part of the texture) using these groups of vertices in this order:

1, 2, 4, 3

3, 4, 6, 5

5, 6, 8, 7

etc

13  Discussions / Miscellaneous Topics / Re: Free "Source" Steam Game For you?! on: 2012-12-24 02:03:58
Can I get " ? ? ?"

Reason I want that one is it seems like an interesting game and has me curious.

I would like at least one present this year, which is why I want it I guess.
14  Discussions / General Discussions / Re: Revenge of the Patent Trolls! on: 2012-12-21 04:33:29
If you cannot patent anything mathematical, then all patents in all fields are disputable.



Computational or algebraic is a different story.

[quibble]Shouldn't physics and chemistry be swapped?[/quibble]

And this is gonna get thrown out (for now) because they called it "Mindcraft" lol
15  Java Game APIs & Engines / Java 2D / Re: quickest most effecient way to darken/lighten image on the fly? on: 2012-12-14 16:37:09
You could always draw a slightly transparent white (lighten) or black (darken) rectangle over a tile if the light is uniform
16  Discussions / Miscellaneous Topics / Re: What music do you listen to while you code? on: 2012-11-27 22:55:10
HIPSTER MUSIC~

http://www.youtube.com/watch?v=qDVW81bXo0s
17  Game Development / Newbie & Debugging Questions / Re: checking for variable type on: 2012-11-23 02:41:29
You can pass an Object as an argument and use the 'instanceof' keyword like:

1  
2  
 if (obj instanceof Window) {
...
18  Game Development / Performance Tuning / Re: Trapezoid! on: 2012-11-23 01:57:58
Ugh. Would it be possible to have a 3D background and a 2D foreground if I switch to OpenGL? Time to look up tutorials.

Thanks!
19  Game Development / Performance Tuning / Re: Trapezoid! on: 2012-11-22 22:51:51
It seems that JAI has to be installed, that's why I don't want to use it.. Is there a version that you can just bundle with a project (with native libs)?
20  Game Development / Performance Tuning / Trapezoid! on: 2012-11-20 00:48:11
I was wondering if there are any fast algorithms out there for taking an image and morphing it into the shape of a trapezoid (trapezium).

I found this method:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
   private final float A = W * 0.08f;
   private final float B = W * (1f - 0.08f);

   private final void createTrapezium(BufferedImage src, BufferedImage out) {
      int[] pix = ((DataBufferInt) src.getRaster().getDataBuffer()).getData();
      int[] pix2 = ((DataBufferInt) out.getRaster().getDataBuffer()).getData();
      Arrays.fill(pix2, 0);
      for (int y = 0; y < HEIGHT; y++) {
         int yw = y * W;
         float y_to_h = y / (float) HEIGHT;
         float C_A_offset = A * (1 - y_to_h);
         float trapeziumLine = -C_A_offset + B + (W - B) * y_to_h;
         float k = trapeziumLine / W;
         for (int x = 0; x < W; x++) {
            int destX = (int) (C_A_offset + x * k);
            pix2[yw + destX] = pix[yw + x];
         }
      }
   }


But it's pretty CPU intensive (using this in real-time for a changing background image at 30 FPS)... Is there an alternative to using JAI?
21  Discussions / General Discussions / Re: Transparent Windows on: 2012-09-15 18:13:20
I did this a while back http://www.java-gaming.org/topics/transparent-jframe-background/24635/msg/208284/view.html

Though granted, in my window I don't use the built in java components, but my own custom ones (using listeners, graphics and such)

(PS I also used an undecorated window so I added my own dragging, and it's not totally smooth but good enough)
22  Discussions / Miscellaneous Topics / Re: Who would you consider a programmer? on: 2012-08-06 10:42:03
Little? You're too nice Smiley

A programmer does not need to know how to make a compiler - a compiler developer needs to know that. A programmer needs to know how to USE a compiler.

A programmer doesn't need to know how to make a networked game either. A 'hacker' does not need to know how to program at all... Most people would tell you that 'coder' and 'programmer' are the same thing and use them interchangeably.. I think he just threw 'scripter' in there for fun, first time I've heard that. Since if you're writing in a scripting language, you are still programming...

He's a lot of off
23  Games Center / WIP games, tools & toy projects / Re: Metallum Miner (2D Mining game) on: 2012-08-03 21:35:47
You should give credit http://www.youtube.com/watch?v=7ReQMDRDe0s&feature=plcp
24  Game Development / Artificial Intelligence / Re: A* with different sized units on: 2012-07-08 13:41:48
Well here is a graphical demo - completely unoptimized (didn't even merge clearances with node class, and new nodes are generated each time a path is found instead of saving them), possibly not even working properly, I don't feel like thinking for a while.

http://www.java-gaming.org/?action=pastebin&id=143

By default the unit size is 2x3

Thanks again, feel free to point out any flaws, and you may tell me any suggestions for optimization (I already have a couple of ideas)
25  Game Development / Artificial Intelligence / Re: A* with different sized units on: 2012-07-08 12:31:53
Fy, rom what's been said, I think I understand the problem (Yay!), but I still haven't actually read the page yet (I'm just responding/talking through my little phone while I try to make a section of my house wheel chair accessible.)

Anyway, it seems that for an arbitary sized/shaped map (let's call it that, instead of infinite) that you have a few options.

1) Recompute the clearrance when more areas becoming visible.

2) Compute the clearance as soon as you can. However, this let's the path finder sort of "see beyond" the sight area of the creature when picking a route (the pathfinder gets the clearance values, which indicates open spaces, meaning it'll know where the creature can fit before it gets close enough to see.)

3) Attempt to disable the clearance path finding through unseen areas. Not sure how to accurately do this though.

4) Make a maximum limit on the clearance value of each tile (the smallest you can, and still fit your largest creature). Then, instead of recomputing each time you discover an area, you just mark a 'seen' flag, if it's seen, then you get it's actual clearnce values, if it's unseen you get it's unseen values (preferably either the maximum-- so that your path finder will assume that any sized creature can move through an unseen path-- or some arbitrary other value.) Still has the issue that the path finder can see a bit beyond the edges of the creature's vision (tiles on the edge of vision in certain directions with give information about what's further in that direction).


If you give us some idea about what you're trying to do: how you're genetrating your map, whwther vision matters (sort of assuming from what you said), etc. We might be able to give you an answer to better suit your needs.

Yes I just thought of #4 yesterday and all is going well. I'm just gonna finish making it work with rectangular units and all should be well.

Thanks for pointing me in the right direction guys
26  Game Development / Artificial Intelligence / Re: A* with different sized units on: 2012-07-07 15:14:47
problem is I have an 'infinite' map, is the only way to keep recalculating each time a new area has been discovered?

I didn't quite understand how to set a clearance value for each tile for starters, (1, 2, 3, 4, 5, etc) so I thought looking at a java implementation would help

@ReBirth not sure what you meant
Treat a big tile as some small 1x1 tiles.

You mean a 2x2 tile as 4 seperate 1x1 tiles? but how would that even work
27  Game Development / Artificial Intelligence / Re: A* with different sized units on: 2012-07-07 09:05:33
I didn't quite understand how to set a clearance value for each tile for starters, (1, 2, 3, 4, 5, etc) so I thought looking at a java implementation would help

@ReBirth not sure what you meant
28  Game Development / Artificial Intelligence / A* with different sized units on: 2012-07-06 09:12:33
http://aigamedev.com/open/tutorial/clearance-based-pathfinding/

Is there a java implementation of this, or any pathfinding that allows for different sized units instead of 1 per tile? A unit that takes up 4 tiles (2x2)? And the unit is not necessarily a square unit, they maybe rectangular for example taking up 2 tiles (1x2).

I've got A* down, but I need to figure this out (more explanations also help)
29  Game Development / Newbie & Debugging Questions / Re: Getting a direction based on coordinate differences on: 2012-03-19 06:18:27
not the only way (not that it makes a difference)

1  
2  
3  
4  
5  
6  
7  
private static final Direction[] directions = {
     EAST, SOUTH, WEST, NORTH
};

public static final Direction get(int dx, int dy) {
     return directions[dx & 2 | dy & 3];
}
30  Discussions / Business and Project Management Discussions / Re: runescape private servers - looking for developer on: 2012-03-15 05:53:46
Dude, PLEASE do not bring Runescape to these forums..
go to moparscape.org.
*Cough* Delta.
this is a java forum, private servers are written in java, I see no reason why I cant post this here.
I'm doing rsps for profit, theres servers that make alot of money, and i want to get a piece of the pie.
by the way, this is not delta.
and also, moparscape is getting shut down.


That's illegal
Pages: [1] 2 3 ... 9
 

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

The first screenshot will be displayed as a thumbnail.

E.R. Fleming (20 views)
2014-07-29 03:07:13

E.R. Fleming (8 views)
2014-07-29 03:06:25

pw (39 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (50 views)
2014-07-17 23:47:54

danieldean (42 views)
2014-07-17 23:41:23

MustardPeter (45 views)
2014-07-16 23:30:00
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!