Java-Gaming.org Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (558)
Games in Android Showcase (150)
games submitted by our members
Games in WIP (602)
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 ... 46
1  Discussions / General Discussions / Re: The Khronos Group announces "Vulkan": the successor to OpenGL on: 2015-03-05 08:20:39
In case you didn't notice, Alexander Overvoorde, the author of Open.GL tutorials, has bought another website for the tutorial of Vulcan, here at vulkan-tutorial.com. That website is now incomplete, since there are no implemented drivers that are ready for the public.

Here is a demonstration video of Vulcan made by PowerVR graphics.

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

This video is cool, mainly around the fact that such shading is not really possible on android, at such good FPS. I'm excited to see more of Vulcan.
2  Game Development / Newbie & Debugging Questions / Re: (LWJGL) Can I use whole numbers in glClearcolor? on: 2015-03-04 03:05:19
Dividing the integer by 255f will make it into a float.
3  Game Development / Articles & tutorials / Re: On magnitude and precision of floating-point values (2) on: 2015-03-02 04:02:29
O Riven, please add an appreciate button to articles as well, I can't wait more to appreciate this article. Nice work Kai, I'm learning a lot from this.
4  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-02-28 08:20:00
Finally got smooth following camera in Blox:

Click to Play


(The graphical glitch is copyright of the GIF recorder, not of my program).
5  Discussions / General Discussions / Re: where can i get better at java? on: 2015-02-27 15:23:58
I solve CodingBat problems.

http://codingbat.com/
6  Game Development / Newbie & Debugging Questions / Re: Java 'this' syntax on: 2015-02-27 13:25:44
1  
SecondClass class = new SecondClass(MyClass.this);

and

1  
SecondClass(MyInterface interface) {


You have got a typo in there, variables can't be named the same as a keyword 'class'. Here's the corrected code.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
class MyClass implements MyInterface {
    private Runnable runnable = new Runnable() {
        @Override
        public void run() {
            SecondClass klass = new SecondClass(MyClass.this);
        }
    };
}

class SecondClass {
    SecondClass(MyInterface i) {
    }
}
7  Discussions / Miscellaneous Topics / Re: Make the simplest code unreadable on: 2015-02-24 14:36:30
I had a Java book with a lighthearted example of a program written as such that was a valid C, C++, and Java program.

This?? I found this polyglot online.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
//\u000a/*
#include <iostream>

#define private
#define public
#define static
#define void int
struct {
  std::ostream &println(const char *c) {
    return std::cout << c < < std::endl;
  }
} out;
//*/
/*\u002a/
import static java.lang.System.out;
public class Polyglot {
//*/

  public static void main(/*\u002a/String[] args//*/
      ) {
    out.println("Hello from whatever language this is!");
  }
/*\u002a/
}
// */
8  Discussions / Miscellaneous Topics / Re: Make the simplest code unreadable on: 2015-02-24 13:47:52
Adding some unnecessary instructions to my previous one:

1  
public static void main(String[]a){String t="";for(int i=0;i<Integer.MAX_VALUE;i++){t+=t.length()==0?"h":t.length()==2?"j":i==3||i==4?(t.charAt(t.length()-1)==' '?"d":" "):i==5?"å":"e";if(i==6)break;if(i>6)break;System.out.println("A quick brown fox jumped over the lazy dog.")}System.out.println(t);}
9  Discussions / Miscellaneous Topics / Re: Make the simplest code unreadable on: 2015-02-24 13:28:47
The same in a one liner:

1  
public static void main(String[]args){String txt="";for(int i=0;i<6;i++){txt+=txt.length()==0?"h":txt.length()==2?"j":i==3||i==4?(txt.charAt(txt.length()-1)==' '?"d":" "):i==5?"å":"e";}System.out.println(txt);}
10  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-02-23 12:51:50
Tried to learn drawing again, but with pixel art this time. It was fairly easy, drew this in just 5 minutes.



But I personally don't like pixelated graphics, so I tried to trace it with InkScape, and here is the result.



This is fine enough for my small games, but I'll really try to improve my drawing skills.
11  Game Development / Newbie & Debugging Questions / Re: How can I make entities render once? on: 2015-02-23 12:26:06
In my opinion, you should keep the resources in a single place, and load them before you are starting your game. I tend to create a class called as
Resources
which contains all the resources as public static variables. So I can use them like, say

1  
Resources.STAR.draw(getX(), getY());

Whenever I need that to be rendered. That helps you when the resources you need to use starts increasing in number.
12  Discussions / Miscellaneous Topics / Re: Yay, free games! Zero's Game Giveaway on: 2015-02-23 05:23:13
It seems someone decided to steal them all Sad

Next time, don't post the keys directly on page, but give the link through PMs. Ask them to PM you, and get a key in reply. That should work around these thieves.
13  Game Development / Newbie & Debugging Questions / Re: Collision detection and prevent player movement on: 2015-02-23 05:08:04
Hahaha yeah When i wanna build some game faster i use gms otherwise java! Wink

Actually your reply doesn't help him anyways, he is not using GMS and not GML, he is using Java. What you need to actually reply is what the function is, and how you can implement that function in his game. That is what you should say when you want to help him.
14  Game Development / Newbie & Debugging Questions / Re: Collision detection and prevent player movement on: 2015-02-22 15:52:00
Check for collision before the movement.
For example if you wanna go to the right:

if(place_free(x+spd,y)) //I can move

This way you can use only one rectangle to check for collisions

Are you from the GameMaker world? I remember that as a GML function.
15  Game Development / Game Mechanics / Re: Where to correct position in collision detection (best practice) on: 2015-02-22 08:20:54
I think your approach is not right, you just don't check on X and Y axes, but the axes are formed by the perpendiculars of the edges in the polygon. These are all the axes that you must test whether it is a separating axis.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
Vector2 tmpNormal = Vector2.REUSABLE_STACK.pop();

for (int i = 0; i < a.vertexCount(); i++)
{
    Vector2 e1 = a.getVertex(i);
    Vector2 e2 = a.getVertex((i + 1) % a.vertexCount());

    Vector2 edge = tmpNormal.set(e2).subtractSelf(e1);
    Vector2 normal = edge.perpendicularSelf().normalizeSelf();

    if (isSeparatingAxis(a, b, normal, response))
    {
        Vector2.REUSABLE_STACK.push(tmpNormal);
        return false;
    }
}

In the same way, you test the polygons with the axes from polygon B too. Only thing is that keep in mind that these vertices doesn't contain the position of the polygon. The position is kept separate from the vertices, and is tested by the
isSeparatingAxis
method.

According to the statement of separating axis theorem, "an AXIS is said to be a separating axis, if that axis, when extended in both directions, does not pass through the polygons". To do this, we project the vertices on to that axis, and measure the projection, not the distance between the centers.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
private static Vector2 flattenPoints(List<Vector2> vertices, Vector2 normal, Vector2 projection)
{
    float min = Float.MAX_VALUE;
    float max = -min;

    for (Vector2 vertex : vertices)
    {
        float dot = vertex.dot(normal);

        if (dot < min) min = dot;
        if (dot > max) max = dot;
    }

    return projection.set(min, max);
}

The above method
flattenPoints
does exactly the same. It takes a list of vertices, a normal (that is, the axis), and another
Vector2
to store the resulting projection. Now we know on what axes we need to test, and we also know the projection. What we need to find is whether the axis is a separating axis, or whether it intersects.



Sorry if this image looked shit, I drew it in MSPaint. If you look at the projection, the
min
is the
x
component, and
max
is the
y
component of the projection vector. So we can clearly say if they are separated by checking the line intersection of the projections.

1  
2  
if (rangeA.x > rangeB.y || rangeB.x > rangeA.y)
    return true;

This still doesn't solve the issue of collision detection, it works fine if both polygons are positioned in the origin (top-left corner is the position, not the center). To solve this, we calculate an offset to the
rangeB
and we add that offset to it.

1  
2  
3  
4  
Vector2 offset = tmpOffset.set(b.getPosition()).subtractSelf(a.getPosition());
float projectedOffset = offset.dot(axis);

rangeB.addSelf(projectedOffset, projectedOffset);

Now the intersection test works fine, we still need to calculate the collision response. Before we do that, I will show my
Response
class to you, so that you understand what is what. It is actually somewhat large, so here is a link that points to this class in my SilenceEngine repository. Now, the idea is, we calculate the overlap distance, only if the axis is not a separating axis. The collision response calculation is rather long to explain here, so here is the code.

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  
float overlap;

if (rangeA.x < rangeB.x)
{
    response.aInB = false;

    if (rangeA.y < rangeB.y)
    {
        overlap = rangeA.y - rangeB.x;
        response.bInA = false;
    }
    else
    {
        float option1 = rangeA.y - rangeB.x;
        float option2 = rangeB.y - rangeA.x;
        overlap = option1 < option2 ? option1 : -option2;
    }
}
else
{
    response.bInA = false;

    if (rangeA.y > rangeB.y)
    {
        overlap = rangeA.y - rangeB.x;
        response.aInB = false;
    }
    else
    {
        float option1 = rangeA.y - rangeB.x;
        float option2 = rangeB.y - rangeA.x;
        overlap = option1 < option2 ? option1 : -option2;
    }
}

overlap = Math.abs(overlap);

if (overlap < response.overlap)
{
    response.overlap = overlap;
    response.overlapN.set(axis.normalizeSelf());

    if (overlap < 0)
        response.overlapN.negateSelf();
}

In this piece of code,
overlapN
is just the axis on which the overlap happened. To get the MTV, you need to scale the axis with the overlap, like
response.overlapV.set(response.overlapN).scaleSelf(response.overlap);
. This is the MTV value.

Hope this helps.
16  Java Game APIs & Engines / Java 2D / Re: 2D game engine. on: 2015-02-21 12:34:08
Suggesting noobies to use your own engine is as annoying and harmful than trying to convert people for your belief system.

What? Is that so? I'd say that the above statement is not true. It is always up to the OP to select what he really wants. I'm just pointing out that there is another alternative, and I'm the author of it. I don't see anything wrong in my statement.
17  Java Game APIs & Engines / Java 2D / Re: 2D game engine. on: 2015-02-21 05:17:45
Which game engine (or library) to use also depends on the type of game you are making. My small suggestion is, pick one that offers good collision detection for you, because often, collision detection can go very deep, and it is where many newbies keep doing forever. I mean, it is hard to get it right for your needs.

Since you said you have made some mods before, I think you are familiar with Java. If so, I highly suggest you to use Mercury. It has a graphics class that is similar to Java2D, and eases you a lot. Just keep in mind, that you however need to implement collisions on your own (Mercury does tell you whether two shapes intersect, but you have to implement your own broadphase).

Otherwise, as for the matter of self promotion, I'm writing SilenceEngine, and it does everything just like mercury, but also a little bit more. It handles collision detection, and also collision response, automatically, and also supports 3D if in future you want to upgrade to 3D graphics. As a demo game, you can browse the sources of ScorpionHunter, which is a 2D top-down shooter.
18  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-02-18 06:31:56
Started on my 3D platformer using SilenceEngine.



Got gravity, lighting, and also controller input using Generic/XBOX controllers done. Still need to load levels from file, and also add a nice story around it.
19  Java Game APIs & Engines / OpenGL Development / Re: [GLFW] Detect X-box controller or PS controller? on: 2015-02-17 12:23:38
I think I got it working, the same code using the name property and button count, is detecting my controller as GENERIC. My controller is now completely working, but I have to test on other controllers as well.

1  
2  
3  
4  
5  
6  
7  
8  
if (name.equalsIgnoreCase("Wireless Controller") && numButtons == 18)
    type = Type.PS4;
else if (name.equalsIgnoreCase("PLAYSTATION(R)3 Controller") && numButtons == 19)
    type = Type.PS3;
else if (name.equalsIgnoreCase("Controller") && numButtons == 15)
    type = Type.XBOX;
else
    type = Type.GENERIC;

Try this, and let's see what it returns for you, with your XBOX controller.
20  Discussions / Miscellaneous Topics / Re: What is your line/char count? on: 2015-02-16 17:23:31
Not hard when it's mostly comments.  Tongue

Yes it is, but it is still a large amount of data to type, and the question being line/char count, not code lines only not comments.
21  Discussions / General Discussions / Re: This definately cant do go wrong on: 2015-02-16 17:04:24
 Huh  Undecided  Stare  Undecided  Clueless  Huh

What's this thread about? Care to add some explanation?  Pointing
22  Discussions / Miscellaneous Topics / Re: What is your line/char count? on: 2015-02-16 16:57:54
I once wrote a 851 line object class. It is part of my first game engine (in Java2D of course).
23  Discussions / General Discussions / Re: What's your day job? on: 2015-02-16 02:14:09
I'm still a student currently in the second year of college studying computer science, waiting to hopefully get into a good firm (still has 3 years of study infront of me). In free time, I do make $100 - $150 a month from Google Adsense, by creating videos for youtube.
24  Java Game APIs & Engines / OpenGL Development / Re: [GLFW] Detect X-box controller or PS controller? on: 2015-02-15 13:38:01
This is the controller I'm having. This is a PS style gamepad, and it get's detected as Generic USB Joystick, and the driver name is indeed "Microsoft USB Game Controller"



The driver name will only be changed if the controller is original and having drivers. For example, the original PS controller gets detected as "PLAYSTATION(R)3 Controller". Found in screenshots on WikiHow. Never tested an XBOX controller, the wireless adapter is currently out of stock in the local store, but I will purchase it at some point in the future.
25  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-02-15 03:02:30
My first usage of them is in the
Display
class, creating callbacks for GLFW.

1  
2  
3  
4  
5  
6  
7  
8  
9  
glfwSetWindowPosCallback(window, winPosCallback = GLFWWindowPosCallback((win, xPos, yPos) ->
{
    Display.posX = xPos;
    Display.posY = yPos;
}));

glfwSetCursorPosCallback(window, winCurPosCallback = GLFWCursorPosCallback(Mouse::glfwCursorCallback));
glfwSetScrollCallback(window, winScrollCallback = GLFWScrollCallback(Mouse::glfwScrollCallback));
glfwSetMouseButtonCallback(window, winMouseButtonCallback = GLFWMouseButtonCallback(Mouse::glfwMouseButtonCallback));

This makes code simpler, and also easy to read, because I hate writing anonymous classes and overriding the methods. When the methods we have to override is only one, it makes sense to reduce the amount of code we type and use this lambdas and method references.

The next major usage of method references are in the usage of
GameTimer
class, but still, in the form of callbacks.

1  
2  
3  
GameTimer timer = new GameTimer(10, TimeUtils.Unit.SECONDS);
timer.setCallback(this::timerOut);
timer.start();

There are also the
Animation
, and the entity classes which makes use of lambdas. Whatever you think of this, but I'm lovin' it!!
26  Game Development / Performance Tuning / Re: FPS drop when screen recording a libGDX developed game on: 2015-02-14 08:42:38
I use ZDSoft recorder for game recordings, and Camtasia for program recordings.
27  Discussions / Miscellaneous Topics / Re: What is your line/char count? on: 2015-02-14 07:09:14
I use the Statistic plugin in IntelliJ IDEA. (Click on image to see full size)





Complete source code statistics, and it also categorizes files by extensions. Works fine for me.
28  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-02-14 02:49:42
Hey @cylab, I tried out your plugin and this is the result on my system.



The color of
uniform
is not well on the light theme. Is there any option that allows changing colors?

EDIT: I found out how to do that. You can change it in Editor -> Colors & Fonts -> GLSL
29  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-02-14 02:33:39
Fixed some stuff in the GLSL-plugin for Intellij Idea

Thanks!! Waiting for this since a long time ago..
30  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-02-13 17:30:17
Tried my luck at basic blocks world in 3D.

Click to Play


Warning: 4 MB Huge GIF.
Pages: [1] 2 3 ... 46
 
Pippogeek (16 views)
2015-03-05 14:36:23

Pippogeek (13 views)
2015-03-05 13:56:12

Pippogeek (11 views)
2015-03-05 13:55:41

Pippogeek (14 views)
2015-03-05 13:23:02

Pippogeek (14 views)
2015-03-05 13:15:28

Pippogeek (9 views)
2015-03-05 13:15:04

Pippogeek (17 views)
2015-03-05 13:13:24

Pippogeek (21 views)
2015-03-05 13:11:33

BurntPizza (46 views)
2015-02-27 06:09:35

BurntPizza (35 views)
2015-02-27 05:56:17
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

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27
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!