Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (108)
games submitted by our members
Games in WIP (536)
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
1  Game Development / Newbie & Debugging Questions / Re: [UNSOLVED] Collision Trouble on: 2014-03-30 23:48:48
I noticed what is probably a typo:
1  
2  
3  
4  
5  
6  
7  
8  
   protected boolean collidingWithWall() {
      if(!collidable)
         return false;
      return game.chunkManager.isBlockAtPixelCollidable(x-(width/2)+4,y-(height))  &&
        game.chunkManager.isBlockAtPixelCollidable(x-(width/*shouldn't there be a /2 here?*/)+4,y+(height/2)) ||
        game.chunkManager.isBlockAtPixelCollidable(x+(width/2)-4,y-(height/2))  &&
        game.chunkManager.isBlockAtPixelCollidable(x+(width/2)-4,y+(height/2)) ;
   }
2  Discussions / Miscellaneous Topics / Re: This game sums up a lot on: 2014-02-19 08:50:40
IMO as long as the publisher does not have any say over what goes in the game then it is independently *developed*. Correct me if I'm wrong but I think this is true of indie games on Steam.

Whereas if the publisher say the game needs e.g. cute critters that they can make toys out of then that is definitely not indie development.
3  Discussions / Miscellaneous Topics / Re: i nid a simple games puzzle program using a java on: 2014-02-04 07:09:43
You need an image named icesid.jpg (e.g. this one) in the project's folder.
4  Discussions / Miscellaneous Topics / Re: Optimal size of a blog post? on: 2014-02-04 00:23:30
I'd say that Jeff Atwood's blog posts are good examples (e.g. this one, but I find most of them interesting). Notice that he uses italics for emphasis within the text, but uses bold text to let you quickly see what a paragraph is talking about. A lot of people (me included) skim read and will only stop to read a paragraph properly if something interesting catches their eye.

Also remember that the first of everything is the most important, and needs to introduce the main idea: the first paragraph of the post, the first sentence of each paragraph, etc.
5  Games Center / 4K Game Competition - 2014 / Re: Caster2014k on: 2014-01-31 22:29:24
I like the lighting effects, well done for a 4k game!

One big improvement would be mouse look (you can still constrain the view to a plane, so only the x axis of mouse does anything). Maybe I'm just not used to it, but using the keys to turn feels really annoying to me.

I hope you manage to fit it all into 4k once you add more TD features Smiley
6  Game Development / Newbie & Debugging Questions / Re: Shooting from the angle of player on: 2014-01-27 21:52:13
The code I'm using:
1  
2  
3  
4  
5  
6  
7  
8  
         int bullet_rel_posX = 16;
         int bullet_rel_posY = 10;
         
         double shooting_dirX =  Math.sin(angle);
         double shooting_dirY =  Math.cos(angle);
         
         double bullet_posX = x + (bullet_rel_posX * shooting_dirY) - (bullet_rel_posY * shooting_dirX);
         double bullet_posY = y + (bullet_rel_posY * shooting_dirX) + (bullet_rel_posY * shooting_dirX);


Also, that last line doesn't look right, shouldn't it be:
1  
2  
         double bullet_posX = x + (bullet_rel_posX * shooting_dirY) - (bullet_rel_posY * shooting_dirX);
         double bullet_posY = y + (bullet_rel_posX * shooting_dirX) + (bullet_rel_posY * shooting_dirY);
7  Game Development / Newbie & Debugging Questions / Re: Shooting from the angle of player on: 2014-01-26 20:47:53
Say your character is pointing to the right and the end of the gun is 10 pixels to the right and 5 pixels up in that position. Then whatever rotation your character is at, the end of the gun's position is 10 pixels in the mouse's direction (say "angle") and 5 pixels in the direction orthogonal to the mouse (angle+90 degrees).

If you want to use a unit vector for the direction, [dx,dy], then the orthogonal unit vector is simply [-dy,dx].
8  Discussions / Miscellaneous Topics / Re: I present to you: the BS-LC ratio! on: 2014-01-24 21:21:49
Something is funny with this topic :
  • I've only participate to few Java 4K contests, with only one sourcecode available,
  • so I've proved nothing to JGO community,
  • but I still give my opinion on some topics !?!
Finally, I'm perhaps just a BS ? Huh Grin

Your latest 4k game has graphics among the best I've seen in a 4k game. You're definitely an LC (Leet Coder  Cheesy)

Anyone can feel free to call themselves a coder, but whether other people will see you as that is just a matter of their personal opinion.
9  Discussions / General Discussions / Re: A Reminder To Everyone Here on: 2014-01-24 04:17:53
...some mod...

Are there actually any other mods than Riven?
10  Game Development / Game Mechanics / Re: Realistic 2D helicopter sidescroller movement tips on: 2014-01-22 07:08:46
Here's a basic little simulation I made: http://kramin42.github.io/helicopter.htm
Click inside the box to give it focus and the arrow keys control it.

Is this kind of what you want? The throttle (lower left) is modelled as a damped spring and the helicopter accelerates according to the throttle, with another damping factor.

The result might be a little unresponsive, but I'd say that's probably realistic (I don't really know because I've never flown a helicopter Tongue).

The source code of the webpage has the code in it (it's made with processing.js) but it's rather illegible. I can explain it better if you want.
11  Discussions / General Discussions / Re: A Reminder To Everyone Here on: 2014-01-22 04:40:34
http://awesomegifs.com/wp-content/uploads/snail-abandons-thread.gif
12  Discussions / Miscellaneous Topics / Re: I present to you: the BS-LC ratio! on: 2014-01-21 03:33:34
These may or may not be relevant:

http://en.wikipedia.org/wiki/Straw_man
http://en.wikipedia.org/wiki/No_true_Scotsman
13  Game Development / Newbie & Debugging Questions / Re: Problem with mouse firing. (probably math related?) on: 2013-12-17 20:50:11
Why are you dividing the player position by 2 in mouseMoved? I assume you want the vector from the player to the mouse so it should just be "screenX - position.x". The reason the window height and width are divided in 2 in TheCherno's code is because he is taking the vector from the midpoint of the screen (width/2 , height/2) to the mouse.

The coordinate system should not matter as long as it is consistent between the mouse coords and the drawing coords.
14  Game Development / Newbie & Debugging Questions / Re: Moving something on an angle. on: 2013-12-12 21:12:27
I think the real problem is that you're not keeping a consistent definition of an angle. The usual definition is that the +x axis is 0 degrees and the +y axis is 90 degrees. Math.atan2(y,x) will give you an angle according to this definition, so you need to make sure all of your code is consistent with this.

You have the y input in atan2 negated, it should be:
1  
float radiansToMouse = (float) Math.atan2(mouseY - (Gdx.graphics.getHeight() / 2), mouseX -  (Gdx.graphics.getWidth() / 2));


I'm guessing the player sprite image is orientated upwards and you're using the axes for 2D where the top left corner is (0,0)? in this case if the sprite is drawn without rotation it will face in the -90 direction so there needs to be an offset of +90 added to the rotation when it is actually drawn.

I'm not sure exactly what setRotation and playerSprite.setRotation do, or why you are calling one inside the other, but try (with the above modification as well):
1  
playerSprite.setRotation(setRotation(degreesToMouse) + 90);

(as long as that setRotation only changes the actual sprite's rotation and not the rotation used for the bullet calculations, otherwise remove the +90 from here and move it to where the sprite is drawn)
15  Game Development / Newbie & Debugging Questions / Re: Moving something on an angle. on: 2013-12-12 09:47:21
What is in getRotation()?

getRotation() was replaced with 'radiansToMouse'

1  
 float radiansToMouse = (float) Math.atan2(mouseX -  (Gdx.graphics.getWidth() / 2) ,  (Gdx.graphics.getHeight() / 2)  - mouseY);


Math.atan2 is meant to have y as the first input and x as the second.
16  Game Development / Newbie & Debugging Questions / Re: Moving something on an angle. on: 2013-12-12 07:46:53
What is in getRotation()?
17  Game Development / Newbie & Debugging Questions / Re: Moving something on an angle. on: 2013-12-12 07:26:11
For Math.sin and Math.cos I'm fairly sure the angle needs to be in radians, not degrees. Using radians everywhere would make the code simpler, but if you really don't like radians I guess you can use degrees, just be careful.
18  Game Development / Newbie & Debugging Questions / Re: Moving something on an angle. on: 2013-12-12 05:22:31
Slope is very bad to use, partly because the slope of a vertical line is infinite. Use vectors:
vel_x = bullet_speed*cos(angle)
vel_y = bullet_speed*sin(angle)
(vel means velocity)

Then every frame just update position by the velocity (or if you're using delta times update position by velocity*delta):
pos_x += vel_x
pos_y += vel_y

This way the bullet travels at the same speed in any direction.

btw the vector [cos(angle),sin(angle)] is a unit vector (length of 1) in the direction of the angle, so it moves the bullet by 1 unit in that direction. Multiplying by bullet_speed makes the bullet move bullet_speed units in that direction, which is what you want. It's probably worth learning a bit of linear algebra for this stuff.
19  Game Development / Newbie & Debugging Questions / Re: Slope of a perpendicular line on: 2013-12-11 03:46:31
perpLineA.slope =  -1/lineA.slope
20  Game Development / Game Mechanics / Re: plane intersection on: 2013-12-09 22:22:50
@kramin42:  What's the location of your icon/avatar pic...whatever you want to call it.

I don't think I saved the location/zoom but you might be able to find it if you follow these steps:
1. zoom in on the 'v' between the main cardoid and the first circle of the Mandelbrot set
2. zoom in on one of the spirals on the edge of the cardoid
3. zoom in on one the sub-Mandelbrots in the spiral
4. repeat 1 for the sub-Mandelbrot and you should see a bunch of the shapes in my avatar

I think it might be called the valley of seahorses too so you can try searching for that.
21  Game Development / Game Mechanics / Re: plane intersection on: 2013-12-09 08:22:03
And using the algebraic definition of the dot product ( In three dimensions: A.B = A.x*B.x +  A.y*B.y + A.z*B.z) then:

(NA.PA + NB.PB + NC.PC).x = P.x *(NA + NB + NC).x
(NA.PA + NB.PB + NC.PC).y = P.y *(NA + NB + NC).y
(NA.PA + NB.PB + NC.PC).z = P.z *(NA + NB + NC).z

Sorry, but this is where your derivation goes wrong. You cannot take the components of a scalar like you are on the left side of these equations.

Quote
I have been told the first part (the bit to the negative 1) is calculated by: 

dotProduct [normal1,  crossProduct (normal2,  normal3 ) ]; does anyone know if this is correct?
Yes, that is the formula for |n_1 n_2 n_3| (you still need to do the ^-1 to get the coefficient in the equation). It's fairly easy to show that with the matrix determinant.
22  Game Development / Newbie & Debugging Questions / Re: Proper Way To Handle Gravity? on: 2013-12-06 04:26:02
His was actually spot on.
I checked using d = (1/2g)*(t^2)

I'm not sure exactly how you checked it but his method:

dv = g*t
v = (2*v+dv)/2

is equivalent to:

v = (2*v+g*t)/2 = v + (g/2)*t

i.e. in 1 unit of time the velocity is changing by g/2, not g.
23  Game Development / Newbie & Debugging Questions / Re: Proper Way To Handle Gravity? on: 2013-12-05 20:55:35
Also, the following formula is more correct for a constant acceleration like gravity:
1  
2  
val deltaVel = GRAVITY * timeDelta
entityVelocity = (2 * entityVelocity + deltaVel) / 2

All this does is halve the gravity? The velocity verlet works well:
1  
2  
3  
4  
// acc_i is the acceleration before the timestep, acc_f is the acceleration after. If they are the same (constant acceleration) then use acc = acc_i = acc_f and:
// vel += acc;
pos += vel*t + 0.5*acc_i*t*t;
vel += 0.5*(acc_i + acc_f)*t;


Edit: forgot a t in the velocity formula.
24  Game Development / Newbie & Debugging Questions / Re: How can one draw text? on: 2013-11-11 07:35:09
Add glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); somewhere before rendering the text. I thought it got set to that by default.
25  Game Development / Newbie & Debugging Questions / Re: How can one draw text? on: 2013-11-11 06:22:43
Oh yeah, you need to set the matrices back to what they were again afterwards. I think this should work:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
        glMatrixMode(GL_PROJECTION);
        glPushMatrix();
        glLoadIdentity();
        glOrtho(0, w, h, 0, 1, -1);// w is the screen width and h is the height
       glMatrixMode(GL_MODELVIEW);
        glPushMatrix();
        glLoadIdentity();
        glEnable(GL_BLEND);
        glDisable(GL_DEPTH_TEST);
        font.drawString(10, 10, "Text");//draws text 10 pixels down and to the right of the top left corner
       // do rest of text drawing here + any other overlay stuff
       glMatrixMode(GL_PROJECTION);
        glPopMatrix();
        glMatrixMode(GL_MODELVIEW);
        glPopMatrix();
        glEnable(GL_DEPTH_TEST);


Also make sure any overlay type stuff is rendered last because if depth test is disabled it draws in the order of the commands.
26  Game Development / Newbie & Debugging Questions / Re: How can one draw text? on: 2013-11-11 05:45:28
How are your matrices set up? e.g. I'm doing:
1  
2  
3  
4  
5  
6  
7  
8  
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glOrtho(0, w, h, 0, 1, -1);// w is the screen width and h is the height
       glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glEnable(GL_BLEND);
        glDisable(GL_DEPTH_TEST);
        font.drawString(10, 10, "Text");//draws text 10 pixels down and to the right of the top left corner

Maybe your text is getting drawn off-screen? I don't really know tbh.
27  Game Development / Newbie & Debugging Questions / Re: How can one draw text? on: 2013-11-11 05:06:37
From what this said it's probably an incompatability between you slick.jar and slick_util.jar versions. The latest slick download doesn't even include slick_util so try removing it, maybe the slick_util stuff was combined with slick in the latest version.
28  Game Development / Newbie & Debugging Questions / Re: How can one draw text? on: 2013-11-11 04:54:00
See my edit above and check your build path, what does it have in it? e.g. for one of my projects which uses font rendering I have lwjgl_util.jar, lwjgl.jar, and slick.jar.

You probably have the latest version.
29  Game Development / Newbie & Debugging Questions / Re: How can one draw text? on: 2013-11-11 04:42:20
This looks really weird: Huh
org.newdawn.slick.opengl.renderer.SGL.glTexSubImage2D(IIIIIIIILjava/nio/ByteBuffer;)V

Are you using the latest version of slick?

EDIT:
also: https://bitbucket.org/kevglass/slick/issue/29/unicodefontloadglyphs-throws
30  Game Development / Newbie & Debugging Questions / Re: How can one draw text? on: 2013-11-11 04:21:27
Try this:

1  
2  
3  
4  
5  
6  
7  
8  
Font awtFont = new Font("Default", Font.PLAIN, 14);
font = new UnicodeFont(awtFont);
font.getEffects().add(new ColorEffect(java.awt.Color.white));
font.addAsciiGlyphs();
try { font.loadGlyphs(); }
catch (SlickException e) {
    e.printStackTrace();
}


I'm guessing you don't have a "font.getEffects().add(...)".

Pages: [1] 2 3
 

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

The first screenshot will be displayed as a thumbnail.

CogWheelz (16 views)
2014-07-30 21:08:39

Riven (22 views)
2014-07-29 18:09:19

Riven (14 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

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

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

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

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

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

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

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