Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
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 ... 36
1  Discussions / General Discussions / Re: Performance Test for the Voxel Thing on: 2014-08-28 15:42:33
Sorry, should have said, what specs are the machines? Smiley Doh!

Kev

I thought so, but you were very specific about only needing FPS Smiley

31-32 fps
Laptop
Core i7 3720, 4 cores @ 2.6Ghz w/ HT
Windows 7 64 bit
NVIDIA NVS 5200M

Mike

EDIT: Maybe I had something running in the background, getting a stable 60-61fps now Smiley
2  Discussions / General Discussions / Re: Performance Test for the Voxel Thing on: 2014-08-28 12:37:58
I indeed needed the 512MB switch or it crashed right away.

A stable 31-32 fps.
3  Discussions / General Discussions / Re: Camera with Roll Pitch and Yaw on: 2014-08-28 06:15:31
Here's my code for the oculus rift with Z up using GL11:
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  
            float yaw = MyOculusRift.getOR().getYawDegrees_LH();
            float pitch = MyOculusRift.getOR().getPitchDegrees_LH();
            float roll = MyOculusRift.getOR().getRollDegrees_LH();
            GL11.glRotatef(roll, 0, 0, 1);
            float originalX = POSITION.getX();
            float originalY = POSITION.getY();
            double length =
                FastMath.hypot(BufferedMathFunctions.cos(-yaw) * BufferedMathFunctions.sin(90 - pitch),
                    BufferedMathFunctions.sin(-yaw) * BufferedMathFunctions.sin(90 - pitch));
            if (leftEye) {
                POSITION.setX((float)(originalX - BufferedMathFunctions.cos(-yaw)
                    * BufferedMathFunctions.sin(90 - pitch)
                    / length
                    * MyOculusRift.getOR().getHMDInfo().InterpupillaryDistance
                    / 2));
                POSITION.setY((float)(originalY - BufferedMathFunctions.sin(-yaw)
                    * BufferedMathFunctions.sin(90 - pitch)
                    / length
                    * MyOculusRift.getOR().getHMDInfo().InterpupillaryDistance
                    / 2));
            } else {
                POSITION.setX((float)(originalX + BufferedMathFunctions.cos(-yaw)
                    * BufferedMathFunctions.sin(90 - pitch)
                    / length
                    * MyOculusRift.getOR().getHMDInfo().InterpupillaryDistance
                    / 4));
                POSITION.setY((float)(originalY + BufferedMathFunctions.sin(-yaw)
                    * BufferedMathFunctions.sin(90 - pitch)
                    / length
                    * MyOculusRift.getOR().getHMDInfo().InterpupillaryDistance
                    / 4));
            }
            GLU.gluLookAt(POSITION.getX(), POSITION.getY(), POSITION.getZ(), POSITION.getX()
                + BufferedMathFunctions.sin(-yaw)
                * BufferedMathFunctions.sin(90 - pitch), POSITION.getY()
                - BufferedMathFunctions.cos(-yaw)
                * BufferedMathFunctions.sin(90 - pitch), POSITION.getZ() - BufferedMathFunctions.cos(90 - pitch), 0, 0, 1);


Hope it helps!

Mike
4  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Kryo/Kryonet compression and buffer on: 2014-08-27 11:08:19
You can use DeflateSerializer to compress the data. Kryo doesn't do any compression by default.

If I change the register to (ContainerMessage is the message that contains all the short[], so I tried with and without that one just in case):
1  
2  
kryo.register(ContainerMessage.class, new DeflateSerializer(kryo.getDefaultSerializer(ContainerMessage.class)));
kryo.register(short[].class, new DeflateSerializer(kryo.getDefaultSerializer(short[].class)));


It doesn't differ a single byte on the resulting size.

Mike
5  Games Center / Featured Games / Re: State of Fortune on: 2014-08-26 19:06:18
Sounds promising. Looking forward for the update. Will you do a hard-reset or will we keep our accounts and gold? ^^

You'll keep your accounts, but I'll most likely reset the gold.

I gave up on digging for the foreseeable future as I need to limit the scope somewhat or I'd never be done with the update Smiley

Here's a screenshot of the "Very far" render distance (6km) with one of the new trees in the foreground, the new fog in the distance and the new water reflections (a screenshot doesn't do them justice though).


Mike
6  Game Development / Newbie & Debugging Questions / Re: How do I use Ashley entity framework alongside Kryonet? on: 2014-08-22 20:11:28
Awesome as always Riven, guess I was just lucky that it didn't break yet. I used to use a synchronize block but thought it wasn't needed as I wasn't looping through it. I'm now using a ArrayBlockingQueue instead.

Mike
7  Game Development / Newbie & Debugging Questions / Re: How do I use Ashley entity framework alongside Kryonet? on: 2014-08-22 12:26:56
Hi,

Sure, there is probably a much nicer way to do it though, but this works fine for me. As I'm not for-eaching the arraylist I didn't see any issues so far of not synchronizing it.

I'm sure there are a lot of people on the forum that knows a much neater way to do it though Smiley

Mike

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  
74  
75  
public class HandleMessageThread extends Thread {

    private boolean threadRunning = true; //Check if the thread should keep running

    private final static ArrayList<Message> receivedMessages = new ArrayList<Message>();

    @Override
    public void run() {
        while (isAlive() && threadRunning) {
            try {
                while (receivedMessages.size() > 0) {
                    Message message = null;
                    try {
                        message = receivedMessages.get(0);
                        recievedMessage(message.getConnection(), message.getMessage());
                        receivedMessages.remove(0);
                    } catch (final Throwable t) {
                        if (message != null) {
                            Main.getKryoClient().submitError("Error processing message " + message.getMessage().toString(), t);
                        } else {
                            Main.getKryoClient().submitError("Error processing message", t);
                        }
                        receivedMessages.remove(0);
                    }
                }
            } catch (final Throwable e) {
                Main.getKryoClient().submitError("Executing message", e);
            }
            try {
                Thread.sleep(10);
            } catch (final InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    private void recievedMessage(Connection c, Object p) {
        if (p instanceof SessionReturnMessage) {
            SessionReturn.process((SessionReturnMessage)p);
        } else if (p instanceof PingMessage) {
            [...]
        } else {
            Main.getKryoClient().submitError("Cannot find method: " + p.toString());
        }
    }

    public void stopThread() {
        threadRunning = false;
    }

    public void received(Connection c, Object p) {
        receivedMessages.add(new Message(c, p));
    }
}

public class Message {

    private final Connection connection;

    private final Object message;

    public Message(Connection c, Object p) {
        connection = c;
        message = p;
    }

    public Connection getConnection() {
        return connection;
    }

    public Object getMessage() {
        return message;
    }

}
8  Game Development / Newbie & Debugging Questions / Re: How do I use Ashley entity framework alongside Kryonet? on: 2014-08-22 06:46:19
Hi,

I read a recommendation from Nate a couple of days ago that explained that due to the listener also does the (de)serializing of the objects he recommended to pass it off to another thread on busy network applications. I changed my code around to use another thread and it resolved a couple of queuing issues as well, so I'd say go for it! Smiley

Mike
9  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Kryo/Kryonet compression and buffer on: 2014-08-22 05:58:59
Every number separately? That's... interesting Smiley

Nate, any nice idea?
10  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Kryo/Kryonet compression and buffer on: 2014-08-20 20:32:58
I'm still wondering about 3, anyone with any ideas?

As for 1 and 2: It became a whole lot better when I added a logic thread and didn't send all those messages from the same thread that handles the (de)serialization. Smiley

Mike
11  Java Game APIs & Engines / OpenGL Development / Re: Drawing big Objects far away on: 2014-08-20 20:24:38
After a lot of testing I'll answer my own question Smiley

The documents explain two ways to solve the issue, using the glDepthRangedNV function (which also works on new AMD drivers), OR using the shaders, there is no point in mixing the two.

As glDepthRangedNV was a lot easier to implement and the huge drawing distance is more for newer graphics cards anyway I went for that. The results are great, I'm getting 0.1mm resolution on a distance of 100.000 meters. No more flickering evah!

Note:
Set NVDepthBufferFloat.glDepthRangedNV(-1, 1) after the binding of the FBO, not after Display.create()
The internal depth buffer format of the FBO needs to be a 24 or 32 bit float or it won't work
You need to change two values of the projection matrix, something like this if you are handling the matrices old style:
GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projection);
projection.put(10, nearPlane / (nearPlane - farPlane));
projection.put(14, farPlane * nearPlane / (nearPlane - farPlane));
GL11.glLoadMatrix(projection);

Mike
12  Java Game APIs & Engines / OpenGL Development / Re: Drawing big Objects far away on: 2014-08-19 07:47:24
I was testing some large drawing distances (perspective from 0.1 to 12.000) and while it looks awesome to see mountains kilometers away, the depth buffer started getting really inaccurate, causing some horrible artifacts.

Looking at "the Outerra way" I added the following, but it doesn't seem to make any difference at all. Did anyone successfully implement it or understand it good enough to give me a bump in the right direction?

I added in the initialization of OpenGL (right after Display.create):
NVDepthBufferFloat.glDepthRangedNV(-1, 1);

I changed the internal format for the depth buffer component of all FBOs to:
ARBDepthBufferFloat.GL_DEPTH_COMPONENT32F

I added the following at the end of all of my vertex shaders:
float Fcoef = 2.0 / log2(12000.0 + 1.0); //Fixed far plane of 12000 for testing
gl_Position.z = log2(max(1e-6, 1.0 + gl_Position.w)) * Fcoef - 1.0;

Any idea?

Kind regards,
Mike
13  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Kryo/Kryonet compression and buffer on: 2014-08-18 09:27:56
Because I highly doubt that you have 4294967294 different kinds of tiles. As it is a value that will be stored/sent a lot you should keep it to the smallest primitive type that you can.

Mike
14  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Kryo/Kryonet compression and buffer on: 2014-08-18 09:14:36
I'm sending shorts to save space, one short per tile height (sending ints for types sounds horrible by the way Smiley).

Does anyone have any idea about the above queries?
15  Java Game APIs & Engines / Engines, Libraries and Tools / Kryo/Kryonet compression and buffer on: 2014-08-15 14:10:33
Hi there,

I've changed around my whole network code to use Kryonet instead of gzipped strings. Unfortunately I ran into three connected issues, and I was wondering if there is a way to solve them.

1. Whenever a player connects to the server the area around him is sent from the server, at the moment I'm sending an area of 2000x2000 tiles to give the player a view distance of 1.000m. While this never was a problem before the Kryonet TCP send bytebuffer gets filled up very quickly and the whole server crashes, never recovering. I can catch the error and restart the server, but I was wondering if there was a better way to handle it.

2. The only way I managed to "solve" it was to start the server up with new Server(25 * 1024 * 1024, 1024 * 1024); Is allocating 25mb of buffer per connection really the way to solve such a problem? What about when people have created huge structures, do I have to go in and increase the number just in case the player loads that part of the map at startup?
I could lower the amount of data sent somewhat or throttle the sending of the land, but I'd prefer to have it work without having to rewrite a lot of code and decrease the experience of the players.

3. Back when I used gzipped CSV's an empty container (an array of 4356 shorts) took about 500-700 bytes, and now they take 8kb. Is there a way to compress the data or does it have to take as much as each individual value? I was looking at the Deflate serializer, but I didn't get it to work on a short[].

Kind regards,
Mike
16  Discussions / Java Gaming Wiki / Re: Pseudo random number generators on: 2014-07-30 19:29:04
Just in case data0 was changed by another thread? Tongue Sometimes people write funny code Smiley

Mike
17  Games Center / WIP games, tools & toy projects / Re: CMEngine - a from scratch, modern GL 3d engine on: 2014-07-29 20:02:15
Any kind of screenshot would help a whole lot with providing feedback, either of how it would look inside a game, or the tools available to create a game Smiley

Mike
18  Games Center / Featured Games / Re: State of Fortune on: 2014-07-29 19:18:01
(You edited your post, mean-o! Smiley) Dynamically selecting the LOD on distant chunks would work indeed, but it would be negative for the FPS. I wonder how much though.

That's what I do now already (each chunk being 66 by 66 tiles).

However, at the moment the landscape is rolling, so the LOD changes are quite smooth. Once people can start digging it'd not be rolling as there can also be a big peak on half of the chunk and a big hole on the other half of the chunk. My formula at the moment would then draw the land straight, but once you get to the higher LOD levels it'll change a whole lot. On top of that the texture of the dug out land might be different than the texture on the peak, making the jump in LOD even higher.

The more I think about it the more I realise that it's possible but extremely difficult to get right without ruining the FPS.

Mike
19  Games Center / Featured Games / Re: State of Fortune on: 2014-07-29 19:06:40
I was thinking the same at first, but thought it would look really, really lazy Smiley

Do you have an as easy solution for B? Smiley

Mike
20  Games Center / Featured Games / Re: State of Fortune on: 2014-07-29 18:45:43
Sorry for the long post, but I just dropped it all in here, so take it with a grain of salt!

It's mostly me trying things out behind the scenes that will have a big impact now or down the line. Here is a list of things that I'm currently trying out. It might not all make it though so don't get your hopes up on all the points Smiley

1. Use a big island (about 400km2) instead of the infinite land. Down the line it'd be great to go by boat to other islands, but that won't make this update for sure. I've added some examples of how the island generation looks like (it is pure noise, I don't do any precomputed calculations over the whole map). The mountain ranges look weird, but it's a thin line between a great looking map and great looking views in game (already completed)








2. Change the client<->server communication to Kryonet. I'm tired of breaking things because I forget to pass all parameters in my string communication as well as NIO being a whole lot better for scalability Smiley

3. Change the mountain texture to look better from a distance and the sand texture to look better from up close (already completed).

4. Add random patches of sand/stone instead of having a uniform texture on the ground (already completed).

5. Change the trees so shadows can be cast on them, as well as them looking a lot better (partly completed).

6. Implement forests instead of just placing random trees (already completed).

7. Look into digging. There are a couple of challenges though which might make me drop this.
  • A. The water is currently a flat quad to make it impossible for grievers to, for example, flood the land of someone. If I were to add digging I'd have to split up the water into a whole lot of quads, possibly decreasing the FPS.
  • B. The big challenge is the LOD of the land. I can now draw huge drawing distances as I can easily lower the LOD of the land. Once people can start digging in the land that becomes a whole lot harder and will cause quite big movements between the different LOD levels. Does anyone have experience with anything like this? There is a reason why Minecraft doesn't do LOD Smiley

8. Shift all blocks 0.5 units, making it easier to implement digging as the four corners of a land tile will correspond with the 4 corners of a block.

9. Allow you to buy land wherever you want instead of on pre-determined plots. With the new map generation there will be some interesting places, and I won't limit you from building a cute cottage on that island that you need to swim to for half an hour the first time you go there Smiley

10. A real map so you can see where on the island you currently are (also used for buying land).

11. Add random stones and bushes to make the landscape less repetitive.

12. Add a setting for huge draw distance (10km) instead of the current limitation of 1km for the super computers out there. Should be quite easy as I already need that data for the map.

13. Instead of the blurring of distance objects, make them fade to the sky color (already completed).

14. Fix some of the known issues.

I'll post some screenshots once I can start the game up again and some more of the changes are implemented.

I'd also like to finish the Oculus Rift support (got my DK2 today!) but that'll have to be after Alpha 2.0.

Mike
21  Game Development / Networking & Multiplayer / Re: Moving from a String based approach? on: 2014-07-29 14:07:50
I'm busy with doing exactly this, and I find Kryonet awesome so far. I recommend it without a doubt Smiley

Mike
22  Games Center / Featured Games / Re: State of Fortune on: 2014-07-29 10:57:08
Indeed, sorry about that, life came inbetween. I am grabbing some time here and there at the moment to work on Alpha 2.0.

Kind regards,
Mike
23  Games Center / Featured Games / Re: State of Fortune on: 2014-07-26 14:17:06
Hi,

I have all of those things on my list as well Smiley

I'd like to do all intrusive changes at once though so I don't have to reset the world for a very long time.

The new map generation is done. I've made the world into a huge island instead of the "infinite" world. The island looks a lot more interesting and if it ever runs out of space I can always add a harbor to explore other islands.

I'm currently testing out kryonet instead of using my horrible blocking network implementation of gzipped strings.

Kind regards,
Mike
24  Games Center / Featured Games / Re: State of Fortune on: 2014-07-25 18:47:05
Hi there,

Thanks for the kind words!

I'm busy with another, non game related, project at the moment, but I'm trying to squeeze in some time for State of Fortune inbetween. As it will be a long time between updates anyway I'm busy with looking into some world breaking changes that will make the game look more interesting and play better.

I'll see what I end up putting into the game, but I'm at least investigating things like digging, a new land generation formula, the ability to place plots wherever you want instead of only on selected spots and a few other things.

Mike
25  Game Development / Networking & Multiplayer / Re: Game server and database interactions on: 2014-06-27 11:50:36
If you are worried about server crashes then you can also update the database once every x minutes/hours or whenever nothing changed in the inventory for a minute or so.
26  Discussions / General Discussions / Re: Programmer jokes on: 2014-06-27 11:48:23

Thank God for Java! Smiley

Mike
27  Games Center / Featured Games / Re: State of Fortune on: 2014-06-08 19:10:49
Thanks!

I see that there still are 4-7 people online every day, which is very nice considering I didn't do anything for a couple of months.

If all goes well the coming couple of months I'll never ever have to worry about money again, in which case I'll have more time to program for fun Smiley

Mike
28  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Oculus Development on: 2014-06-08 18:44:38
It works fine in lwjgl, there are a couple of java projects out there created to use the Rift SDK. I ordered a DK2 a few minutes after it released, I hope it'll come in a month Smiley
Screenie:
http://www.java-gaming.org/topics/terrain-something/28474/msg/277290/view.html#msg277290

Mike
29  Games Center / WIP games, tools & toy projects / Re: 3D Randomly Generated World on: 2014-05-23 06:27:56
Outerra has awesome looking grass that sways in the wind if you want some inspiration:
http://outerra.blogspot.cz/2012/05/procedural-grass-rendering.html
30  Games Center / Featured Games / Re: State of Fortune on: 2014-05-02 12:30:31
Hi,

It's currently in the freezer, due to personal reasons I don't have any time at all in the evenings to spend on it.

I just tried to log in and it worked for me? There was a problem yesterday though (power outage).

I'll drop a message once things at home calm down again.

Kind regards,
Mike
Pages: [1] 2 3 ... 36
 

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

The first screenshot will be displayed as a thumbnail.

TehJavaDev (16 views)
2014-08-28 18:26:30

CopyableCougar4 (25 views)
2014-08-22 19:31:30

atombrot (38 views)
2014-08-19 09:29:53

Tekkerue (34 views)
2014-08-16 06:45:27

Tekkerue (32 views)
2014-08-16 06:22:17

Tekkerue (20 views)
2014-08-16 06:20:21

Tekkerue (31 views)
2014-08-16 06:12:11

Rayexar (66 views)
2014-08-11 02:49:23

BurntPizza (44 views)
2014-08-09 21:09:32

BurntPizza (34 views)
2014-08-08 02:01:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!