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 4
1  Game Development / Newbie & Debugging Questions / Re: LWJGL Windows-Linux compatibility on: 2014-02-13 21:10:18
Maybe a bug with your Linux graphics driver? Do you know which one you have?

Thanks for the reply, I am running Linux off of a VM, so would my graphics card be the same? If so, I have a NVIDIA Optimus.
2  Game Development / Newbie & Debugging Questions / LWJGL Windows-Linux compatibility on: 2014-02-13 19:09:56
I restarted my most recent project to get to the bottom of why it does not work in a Linux environment. I have narrowed it down to the mouse being the problem. When the mouse is grabbed, I contantly set the mouse position to half of the width and height, but Linux seems to completely ignore this statement.

1  
Mouse.setCursorPosition((int) orth.getWidth() / 2, (int) orth.getHeight() / 2);


If I grab the mouse in windows, move around, and un-grab the mouse, the cursor is at the center of the screen. But if I do this in Linux (Ubuntu) my cursor just moves about like I never called the setCursorPosition method. Is this a known bug?
3  Java Game APIs & Engines / Engines, Libraries and Tools / Re: LWJGL mouse hover and clickable text on: 2014-02-09 04:12:49
This can be done with the Rectangle library. You make two rectangles, one for the text (x, y, width, height) and the mouse (x, y, 1, 1).

You can check intersection by calling Rectangle.intersects(Rectangle rect)
4  Discussions / Miscellaneous Topics / Re: Sorry to those who suffered from me ;) on: 2014-02-07 04:07:15
Honestly, non native speakers underestimate the amount of errors that native speakers actually make. Unless you actively trying to be literate (as I am now), you WILL make a mistake, rather often, might I add.
5  Game Development / Newbie & Debugging Questions / Re: Server/Client on: 2014-02-05 04:51:22
No. Read it again. Ask help on specific things.

Ok, how can I predict the next movement if the amount of movements to select from is (for all intents and purposes) unlimited.
6  Game Development / Newbie & Debugging Questions / Re: Server/Client on: 2014-02-05 01:43:08
Are you doing any kind of client side prediction? Essentially, you don't want to wait for the server to confirm your movements.

Gabriel's series of articles is pretty helpful. This is probably exactly what you want http://gabrielgambetta.com/fpm_live.html


That looks like exactly what I need.

EDIT: I read through it, but I don't understand how I could effectivly predict the positions of a player, in they game (like most others) I can move up, down, left,right, forward, backward, and anywhere in between. There is no limit to where I can move, therefor making the game un-predictable
7  Game Development / Newbie & Debugging Questions / Re: Server/Client on: 2014-02-04 14:36:40
I don't see a call to repaint in your code.
There are a few things you could try.
Use DataInput/OutputStream and don't buffer the streams.
Call Socket.setTcpNoDelay(true); and Socket.setTrafficClass(0x10); before you connect the socket. i.e. between line 16 and 17 in your code.

Well, I guess it is worthy to mention that this is openGL, not swing. However, I will look at your other suggestions.

EDIT: I have no time to test, but the documentation looks promising...
8  Discussions / Miscellaneous Topics / Re: i nid a simple games puzzle program using a java on: 2014-02-04 06:33:59
exception i thread main java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(Unknown soure)
at Puzzle.<init>(puzzle.java:41)
at Puzzle.main(puzzle.java:80

You are trying to add an ImageIcon that does not exist to a JFrame. This will not work.
9  Discussions / Miscellaneous Topics / Re: i nid a simple games puzzle program using a java on: 2014-02-04 06:20:13
if i try unknown source

What?
10  Discussions / Miscellaneous Topics / Re: i nid a simple games puzzle program using a java on: 2014-02-04 05:55:02
plss help me


Are you serious?
11  Game Development / Newbie & Debugging Questions / Server/Client on: 2014-02-04 04:45:22
So, pleased with me advancement in 3D, I took it upon myself to try some Server/Client communications. I have server/client experience (very little), so this was kind of expected. Basically, my client lags. I have not gotten to large scale test this yet, so right now, that is the only problem. I can show you a video (which I took from an Iphone because I cba to mix video from 2 computers). The silver computer is the computer with the server and the client running, and the black computer is just the client. The block dot is the player.

Video: http://s1375.photobucket.com/user/zFollette/media/IMG_1142_zps903e8b07.mp4.html

Here is some code:

Client class (in the game)
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  
public class Client {

    private Socket socket;
    private final String ip = "192.168.0.8";
    String local;
    private final int port = 43595;
    private BufferedReader br;
    private PrintWriter pw;
    public static final ArrayList<Player> players = new ArrayList<>();

    public Client() throws IOException {
        handleConnection();
    }

    private void handleConnection() throws IOException {
        socket = new Socket();
        socket.connect(new InetSocketAddress(ip, port));
        local = socket.getInetAddress().getHostAddress();
        br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        pw = new PrintWriter(socket.getOutputStream());
        Thread t = new Thread(new Connection());
        t.start();
    }

    public void sendMessage(String message) {
        pw.println(message);
        pw.flush();
    }

    private class Connection implements Runnable {

        @Override
        public void run() {
            String line;

            try {
                while ((line = br.readLine()) != null) {
                    String ip = line.split(": P")[0].trim();
                    if (line.contains("POSITION")) {
                        String[] values = line.replaceAll(ip, "").replaceAll(": POSITION:", "").trim().split(", ");

                        Player p = new Player(ip);
                        p.setX(Float.parseFloat(values[0]));
                        p.setY(Float.parseFloat(values[1]));
                        p.setZ(Float.parseFloat(values[2]));

                        if (!contains(players, ip) && !ip.equals(local)) {
                            players.add(p);
                        }

                        for (int i = 0; i < players.size(); i++) {
                            if (players.get(i).getIp().equals(ip)) {
                                players.set(i, p);
                                break;
                            }
                        }
                    }
                }
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

        private boolean contains(ArrayList<Player> s, String s1) {
            for (int i = 0; i < s.size(); i++) {
                if (s.get(i).getIp().equals(s1)) {
                    return true;
                }
            }
            return false;
        }
    }
}


Server class (seperate program)
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  
public final class Server {

    private ServerSocket server;
    private Socket socket;
    private final int port = 43595;
    private final String ip = "192.168.0.8";
    public static ArrayList<Player> players = new ArrayList<>();

    public Server() throws IOException {
        handleConnection();
    }
   
    private void handleConnection() throws IOException {
        server = new ServerSocket();
        server.bind(new InetSocketAddress(ip, port));

        while (true) {
            socket = server.accept();
            Player player = new Player(socket.getInetAddress().getHostAddress());
            player.setS(socket);
            players.add(player);
            Thread t = new Thread(new ConnectionHandler(socket, player));
            t.start();
        }
    }
}


ConnectionHandler class (part of server)
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  
public class ConnectionHandler implements Runnable {

    Socket s;
    int port = 43595;
    Player p;

    public ConnectionHandler(Socket s, Player p) {
        this.s = s;
        this.p = p;
    }

    @Override
    public void run() {
        try {
            System.out.println("Client: " + s.getInetAddress() + " has connected.");
            BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));
            PrintWriter pw;
            String line;

            while (true) {
                while ((line = br.readLine()) != null) {
                    if (line.startsWith("POSITION:")) {
                        String[] values = line.replaceAll("POSITION:", "").trim().split(", ");
                        p.setX(Float.parseFloat(values[0]));
                        p.setY(Float.parseFloat(values[1]));
                        p.setZ(Float.parseFloat(values[2]));
                       
                        ArrayList<Player> ps = Server.players;
                       
                        for (int i = 0; i < ps.size(); i++) {
                            Player p1 = ps.get(i);
                            for (int j = 0; j < ps.size(); j++) {
                                    pw = new PrintWriter(ps.get(j).getS().getOutputStream());
                                    pw.println(p1.getIp() + ": POSITION: " + p1.getX() + ", " + p1.getY() + ", " + p1.getZ());
                                    pw.flush();
                            }
                        }
                    }
                }
            }

        } catch (IOException ex) {
            System.out.println("Client: " + s.getInetAddress() + " has disconnected.");
        }
    }
}


So, I am going to assume my code is a terrible way of doing what I want, because it usually is, lol. But I also have another question. The computer that is lagging is slightly less powerful (intel i5, intel graphics 3000) than the one that is not lagging (intel i7, NVIDIA optimus). Could this be the problem? I ruled it out earlier because the rest of the game (cubes and what not) render fine. Its the the dot.

EDIT: Possible cause, I render the dot in immediate mode.
12  Games Center / Cube World Projects / Re: First ever 3D Game on: 2014-02-04 03:56:42
  • Being less of a hypocrite (as suggested my SwordsMiner)
Thanks for taking my advice  Wink [/troll] Its a very good start for a 3d game, and let alone your first. I cant do anything close to this Tongue

I studied counter trolling at Yale, but as for your statement:
13  Game Development / Newbie & Debugging Questions / Re: Framebuffer Object vs. Vertex Buffer Objects on: 2014-02-03 20:34:43
So basically, frame buffer objects are used to render things into things that can be rendered by vertex buffer objects?
14  Discussions / Miscellaneous Topics / Re: Optimal size of a blog post? on: 2014-02-03 18:36:48
We get enough of that crap here in America.

We get enough of all crap, here in America.
15  Game Development / Newbie & Debugging Questions / Re: Libgdx shaders not working. on: 2014-02-03 18:30:26
It doesn't work with either version Sad
If I remove the code which calculates the lights from uniforms, it works for some reason.. Doesn't seem to be the problem with sending data to shader.
I tried 110 and no version at all and it still doesn't work..

What code are you using to run the shader programs?
16  Game Development / Newbie & Debugging Questions / Re: Libgdx shaders not working. on: 2014-02-03 18:19:53
If the laptop you are testing on came out in and around 2006, it will not work, your GLSL shaders are marked with version 120, which is a pre-processor of openGL 2.1, which came out in 2006. See: http://en.wikipedia.org/wiki/OpenGL_Shading_Language
17  Game Development / Newbie & Debugging Questions / Framebuffer Object vs. Vertex Buffer Objects on: 2014-02-03 18:16:51
Ok, so when I was looking through tutorials on openGL, I was informed that VBO's were the most modern way of rendering things. Now I am hearing about FBO's, what are they?, and how do they compare to VBO's (performance wise)?
18  Games Center / Cube World Projects / Re: First ever 3D Game on: 2014-02-03 18:06:47
The first game that Ive played where you can create a world out of block elements and walk around them in 3D
was in the beginning of the 90s.
An Amiga game called "Tower of Babel".

The concept of a 3D "Block" world is quite old in itself.

Well, it was my first game. Let me just break out my 3D CAD artists and texture designers and make some call of duty style fps. No, but in all seriousness, I think a voxel engine was a good start.
19  Games Center / Cube World Projects / Re: First ever 3D Game on: 2014-02-02 23:00:07
How is this constructive at all? Maybe you think your game is more original - uh, wait, it's based off a tv show. And normally I would be fine with that, but now you're calling other people hypocrites...


This is great, for once, I am glad I got nonconstructive criticism.
20  Games Center / Cube World Projects / Re: First ever 3D Game on: 2014-02-02 21:29:29
I assume that all the plane equation/picking questions were related to this.  This is a prime example of the importance of asking questions about the problem you want to solve rather than how you think you want to solve it.

I don't really follow your question, but yes, my picking equation questions were for this. But I understand them now, and am able to solve them 9/10 times with pencil and paper. I for one like to understand what I am implementing.
21  Games Center / Cube World Projects / Re: First ever 3D Game on: 2014-02-02 05:31:52
It ends in craft. But its not a minecraft clone. I think so.

By any chance, do you work in the sword mining business? I think not.
22  Games Center / Cube World Projects / Re: First ever 3D Game on: 2014-02-02 03:44:33
That's called greedy meshing (if you didn't know!) and it's useful in some cases, but not all. Do you plan on doing lighting or having attributes for different blocks? Greedy meshing only works with blocks that are exactly the same, or else things become buggy. It's still worth it though!

I really recommend removing faces that don't touch air at least. Frustum culling is another huge performance boost, and have a view distance limiter where only chunks within a certain area are loaded, other wise keep the chunks on the disk.

There are a lot more optimizations, those are just some big ones I know of!

I may hold on the 'greedy meshing' for now, as it would screw with my Ray Picking. I have a view distance limiter. What is frustrum culling? And I will look into the air thing.
23  Games Center / Cube World Projects / Re: First ever 3D Game on: 2014-02-02 03:36:06
I guess that system could work, I haven't looked at your code though, so I couldn't say!

It works very well for what I need it to. I plan on doing as suggested an making all touching blocks into one mesh.
24  Games Center / Cube World Projects / Re: First ever 3D Game on: 2014-02-02 03:33:41
Statically create one instance of every block type and re-use that one. You're correct, a new instance for every block would be entirely way too wasteful.

Also, Swordsminer maybe you could be less offensive? Does it matter that much? Let the man make what kind of game he wants, he doesn't need that kind of useless criticism.

Ahh, every block type, I though he meant every block. I do create a static instance of every block type, maybe not in the way you'd think (a block object) I just make an array of floats indicating the x value of each texture (all 6 faces) and the y value of where the textures are located.

1  
2  
3  
4  
public static float[] grassBlock = {0.25f, 0.25f, 0.25f, 0.25f, 0f, 0.5f, 0f};
public static float[] woodBlock = {0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0f};
public static float[] leafBlock = {0f, 0f, 0f, 0f, 0f, 0f, 0.5f};
public static float[] stoneBlock = {0.25f, 0.25f, 0.25f, 0.25f, 0.25f, 0.25f, 0.5f};


Since textures are the only difference in my blocks.
25  Games Center / Cube World Projects / Re: First ever 3D Game on: 2014-02-02 03:22:37
Interesting, however there's no need to specify that you're not making a Minecraft clone. But do as you wish.

A tip: if you're not already doing this create the terrain as 1 big mesh eg, make all the block objects, iterate over all the blocks in the chunk or level and for each block face, if there are no adjacent blocks, add a quad to the mesh. Improves performance drastically.

Add in SSAO once you have the basics down, it just makes a voxel game look so much better.

Why would I make all of the blocks objects? That seems like a waste of new instances. Though, since my block adding method uses a a form of normal vectors to add blocks adjacent to the selected face, I can definitely do that, I just don't know how to add multiple textures to a face. But I think I can figure it out.
26  Games Center / Cube World Projects / Re: First ever 3D Game on: 2014-02-02 03:17:37

What is hypoctritical about it? It is not a mine craft clone, but It isolates the CREATION aspect of mine CRAFT. All I did was mix the names. Just because it has 'craft' in it, does not make it a mine craft clone.

EDIT: Dick.
27  Games Center / Cube World Projects / First ever 3D Game on: 2014-02-02 01:53:11
This is my first 3D game, and I must say, I though it was a stretch, but it wasn't too bad.

I call this creation craft, it is NOT a minecraft remake, but simply isolates the most popular feature of minecraft, creation.

Current Features:
  • Block Creation/Destruction
  • Player Position Saving and Loading
  • Map Saving and Loading
  • Grass, Leaf, Wood, and Stone blocks
  • Optional Fog
  • Delta time

Future Features:
  • More block types
  • Being less of a hypocrite (as suggested my SwordsMiner)
  • All touching terrain into one mesh
  • An option for noise map generation
  • Smiley I will take suggestions


Controls:
Right click: Place
Left click: Destroy
WASD to move
esc to un grab mouse
esc+left shift to exit
f to toggle fog
1, 2, 3, 4 to change block types
1=Grass
2=Leaf
3=Stone
4=Wood

Source Code: https://github.com/zFollette/Creation_Craft
Executable Jar https://dl.dropboxusercontent.com/u/59761129/Creation%20Craft.jar Supports Windows, and as far as I know, Unix systems too (Mac and linux)

I use a Ray Picking library that I created for convenience, source can be found at: https://github.com/zFollette/RayPicker
(If you want to use it, go ahead, but be aware that it is set up for 1x1x1 cubes.)

Have fun.
28  Game Development / Newbie & Debugging Questions / Re: Closest Plane in Ray Pick on: 2014-01-31 22:59:08
the dot product between to vectors is a number not a vector.

Some attributes of the dot product:
- Zero if the vectors are orthogonal to each other.
- Positive if facing in the same direction (angle lower than 90°),
negative otherwise.

If both vectors are normalized:
One if the same, -1 if direct opposite direction. => the dot product is the cosines of the angle between the two vectors.

I see, I did not read thoroughly enough. My bad.

Though, that method does not take into consideration the way I am facing. If I am facing towards the back (positive Z) I cannot click on anything. However:
1  
toI.x * rayDir.x > 0 && toI.y * rayDir.y > 0 && toI.z * rayDir.z > 0

Seems to work.
29  Game Development / Newbie & Debugging Questions / Re: Closest Plane in Ray Pick on: 2014-01-31 22:22:16
this code should work for you

[snip]

What is 'dot'? Like multiplication?
And also, you cant add and subtract Vector3fs like that.
Or multiply them like that... Or compare them to 0 like that. Vec3 is not a valid object in java, and 'dot' is not a valid function. So no, that code won't work for me, or anyone. Sorry mate.
You know that's pseudocode, right? Obviously you can't copy + paste that code in. It's a layout of what the actual code should end up doing.

Dot product is basically this:
Assume U and V are two vectors.
U.V = U.x * V.x + U.y * V.y

I know its pseudo code, I was just stressing the inaccuracy in the statement "This code should work for you". But thanks for explaining the dot product.
EDIT: In the snippet, danny is comparing a vector to 0, does that mean I should compare all of the coords in the vector to 0, or add the coords up and compare?

EDIT AGAIN: It appears to be working. I will test further.
30  Game Development / Newbie & Debugging Questions / Re: Closest Plane in Ray Pick on: 2014-01-31 21:53:36
this code should work for you

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
Ray ray = ...;
Vec3 intersection = ...;

Vec3 rayDir = ray.end() - ray.start();
Vec3 toIntersec = intersection - ray.start();

if(rayDir dot toIntersec > 0)
{
  //is infront of the camera
}


What is 'dot'? Like multiplication?
And also, you cant add and subtract Vector3fs like that.
Or multiply them like that... Or compare them to 0 like that. Vec3 is not a valid object in java, and 'dot' is not a valid function. So no, that code won't work for me, or anyone. Sorry mate.
Pages: [1] 2 3 4
 

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

The first screenshot will be displayed as a thumbnail.

Riven (4 views)
2014-07-29 18:53:52

Dwinin (7 views)
2014-07-29 16:59:34

E.R. Fleming (21 views)
2014-07-29 09:07:13

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

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

Riven (39 views)
2014-07-24 03:16:32

Riven (26 views)
2014-07-24 03:07:15

Riven (28 views)
2014-07-24 02:56:16

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

Zero Volt (51 views)
2014-07-18 05:47:54
HotSpot Options
by dleskov
2014-07-08 09:59:08

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

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

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

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

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

Escape Analysis
by Roquen
2014-04-30 04:16:43

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