Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (512)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
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]
1  Game Development / Networking & Multiplayer / Re: Class sending on: 2012-04-02 23:16:33
if you have to send many information in small time, it is better implement externalizable and implement your own algorithm.
for example instead of boolean (1 byte) you can use byte, that give you all 255 possible states, and the "sqeeze" many status in one byte.
Also it is a good idea to use java.nio, you loose the nice-looking Seirialize and Externalize, but you get SO asynchronism.
But this is a good option (because of implementation and testing time) only for real-time game
2  Game Development / Game Play & Game Design / Re: Battle Engine design. on: 2012-03-13 23:11:03
bad idea the knockback done this way. just apply a force on the body, that way you don't break physics and different mass can respond in different way
3  Game Development / Networking & Multiplayer / Re: socketChannel vs datagramsocket (UDP) on: 2012-03-07 00:15:08
i know there are a lot of lag out there, that's why i'm trying to cut it off at least where i can.

yes, client and server are on the same machine using loopback (127.0.0.1)
4  Game Development / Networking & Multiplayer / socketChannel vs datagramsocket (UDP) on: 2012-03-05 21:56:11
Hi
my friend have written a basic server and client using socket, an the again a server and a client using a socketchannel, using UDP
The client connect to server, send a packet containing the result of System.nanoTime(), the server echo this packet, then client receive the echo and find the delta between the packet time and the actual time (something like a PING)

The results are very strange: it has run on the same machine (linux system).
real ping say:
1  
2  
3  
ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_req=1 ttl=64 time=0.018 ms


Socket say it has taken 0.5ms (500000ns)
Socketchannel say it has taken 2ms (2000000ns)

how this is possible? Socketchannel should be faster, no? also 2ms are really too much lag!
UDP doesn't have Nagle's algorithm, what can cause this big delay?

thanks for response, i'll add the code tomorrow if i meet my friend, but writing it from scratch should not take more than 30 minute.
5  Game Development / Networking & Multiplayer / Re: Choosing a database software on: 2012-03-04 21:31:16
derby is written in java, Hibernate is in java and is not a relational database, but a object-relational mapping (ORM): you can store object!
http://en.wikipedia.org/wiki/Hibernate_%28Java%29
6  Game Development / Newbie & Debugging Questions / Re: lwjgl 2.8.3 and kwin (also compix) fullscreen on: 2012-02-07 23:10:31
also seems that sync() in compix give some problem, so my friend used sleep(), maybe is not so accurate, but it's good enough
7  Game Development / Shared Code / Re: Client side prediction and delayed interpolation on: 2012-02-05 20:24:45
1.
Quote
-The red is the most recent position as seen by another client
-The green is the interpolated position as seen by another client
seems like your interpolation is working backward?  Grin

What do you mean?

green dot is always the last in my simulation to move, and remain the last dot. If it is the interpolate position, it should start to move together with red dot, but should come before red dot (near to real position of the "action" client)

I've done something really similar to your sistem, but based on the concept that other's client will keep moving like the last action.
So if you keep press "down" key, after some ms you will see red dot moving, and green dot "jump" in the actual real position(black dot). Obviously when you release the key, you will see green dot still move for some ms, and then fall back to real position.
8  Game Development / Networking & Multiplayer / Re: Prediction? on: 2012-02-05 00:15:59
Using a 3th part host is not a good solution: is just like use client-server architecture. Yes you can use the server as 3th host.
This is what I meant. The clients just connect to the server so that your router starts forwarding packets on the random port generated for outgoing connections. You can then disconnect that connection and use it to accept new connections.

nice trick!
9  Game Development / Networking & Multiplayer / Re: Prediction? on: 2012-02-04 23:53:47
determinism help a lot, jbox2d's source can be modded to be deterministic, but this mod limit the power of float calculation, because it use an old standard.
also UPD+determinism is not a good idea, because if you lose an action or (in some case) apply action in wrong order you will break it. So you have to implement a sort of TCP over UDP... and it's hard to do.
so, if you want use determinism, you lose some CPU but you gain bandwidth (no need to sync all entity position sometime)

UPNP it's a pain. many router doesn't support it, and many times support it in a buggy way (take a look at some UPNP project to get an idea of what i'm talking about). I support the idea of p2p, with the server action only as "controller", but I think you should have a fall-back system that relay on server-client

Using a 3th part host is not a good solution: is just like use client-server architecture. Yes you can use the server as 3th host.

Actually i'm writing a game witch use deterministic jbox2d and TCP(nio package), hope you will soon test out how it work  Smiley
10  Game Development / Networking & Multiplayer / Re: Prediction? on: 2012-02-04 20:42:56
All clients are still connected to each other, and the data does not pass through the server as that would essentially double the latency.

True for latency, but false the sentence. never had to open door on NAT to play TF2 or any other shooter game. MAYBE if your door are open the game will use it for doing p2p, but I think this is a secondary improvement, the real communication system relay on client/server architecture
11  Game Development / Shared Code / Re: Client side prediction and delayed interpolation on: 2012-02-04 20:29:01
i have some question:

1.
Quote
-The red is the most recent position as seen by another client
-The green is the interpolated position as seen by another client
seems like your interpolation is working backward?  Grin

2. you are calculating only the jitter only from server to others client. maybe you should use all the jitter, and also add the jitter from the "action" client to server. I say maybe because if i change something seems like the point 12 is breaking somethings
12  Game Development / Networking & Multiplayer / Re: Prediction? on: 2012-02-04 16:59:58

- Are you using a server-client model or a peer-to-peer model?
 - Are you using TCP or UDP?

Server/Client model. Currently using UDP, which I believe is the best choise for this project since I want to reduce latency as much as possible. But like I said, my experience is limited. If some thinks using TCP instead would be better, then I can change.



if you paln to base the thiongs on interpolation, then TCPO is better because you cannot lose action ar apply them in the wrong order

Quote
Insert Quote
Almost all action games use a peer-to-peer network model. This is to avoid the latency of having to communicate with a server which then broadcasts the changes. I believe this is your main problem...

that's a nice input, thx
13  Game Development / Networking & Multiplayer / Re: Prediction? on: 2012-02-04 16:57:56
The best solution is to reduce the amount of data you send to the server each frame. Depending on how interactive your game world is (physics, dynamic objects) it might be enough for each player to simply send their current position and velocity and you simply extrapolate from those values. That's only 4 floats -> 16 bytes per frame -> about a kilobyte of data per second. EDIT: Okay, you would also need the direction the player is facing at and possibly other values, but it's still way below what most Internet connections can handle...

 - Are you using a server-client model or a peer-to-peer model?
 - Are you using TCP or UDP?

you aren't counting the TCP or UPD(and alla the ISO/OSI below) header!!! that will be very much more than your data!
14  Game Development / Newbie & Debugging Questions / Re: lwjgl 2.8.3 and kwin (also compix) fullscreen on: 2012-02-01 19:23:01
not enought  Grin

edit: worked out not all resolution support fullscreen, you have to check
15  Game Development / Newbie & Debugging Questions / lwjgl 2.8.3 and kwin (also compix) fullscreen on: 2012-02-01 00:08:59
Hi
I can't understand why if i set Display.setFullscreen to true, it doesn't go fullscreen but it's like a big window (with button, border, title bar)

lwjgl say that this as been fixe3c since lwjgl 2.5.... maybe I have to use other class instead of Display?

here the initialization code of the Display:

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  
public void setDisplayMode(int width, int height, boolean fullscreen) {
      System.out.println("DisplayMode: " + Display.getDisplayMode());
      /*
       * // return if requested DisplayMode is already set if
       * ((Display.getDisplayMode().getWidth() == width) &&
       * (Display.getDisplayMode().getHeight() == height) &&
       * (Display.isFullscreen() == fullscreen)) { return; }
       */


      try {
         DisplayMode targetDisplayMode = null;

         if (fullscreen) {
            DisplayMode[] modes = Display.getAvailableDisplayModes();
            int freq = 0;

            for (int i = 0; i < modes.length; i++) {
               DisplayMode current = modes[i];

               if ((current.getWidth() == width)
                     && (current.getHeight() == height)) {
                  if ((targetDisplayMode == null)
                        || (current.getFrequency() >= freq)) {
                     if ((targetDisplayMode == null)
                           || (current.getBitsPerPixel() > targetDisplayMode
                                 .getBitsPerPixel())) {
                        targetDisplayMode = current;
                        freq = targetDisplayMode.getFrequency();
                     }
                  }

                  // if we've found a match for bpp and frequence against
                  // the
                  // original display mode then it's probably best to go
                  // for this one
                  // since it's most likely compatible with the monitor
                  if ((current.getBitsPerPixel() == Display
                        .getDesktopDisplayMode().getBitsPerPixel())
                        && (current.getFrequency() == Display
                              .getDesktopDisplayMode().getFrequency())) {
                     targetDisplayMode = current;
                     break;
                  }
               }
            }
         } else {
            targetDisplayMode = new DisplayMode(width, height);
         }

         if (targetDisplayMode == null) {
            System.out.println("Failed to find value mode: " + width + "x"
                  + height + " fs=" + fullscreen);
            return;
         }

         Display.setDisplayMode(targetDisplayMode);
         Display.setFullscreen(fullscreen);

      } catch (LWJGLException e) {
         System.out.println("Unable to setup mode " + width + "x" + height
               + " fullscreen=" + fullscreen + e);
      }
   }
16  Game Development / Newbie & Debugging Questions / Re: best way for a space background on: 2012-01-26 17:44:35
hi
i've seen your project (when there was webstart), what I want do is the same, but I started from the physic (only 2d) and network layer. I'm very interessed to your code, but i can't find any repo link

ah, for your native problem, here some code that will autoload your native (just change the relative path according your library location):

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
static {

        System.out.println(System.getProperty("java.library.path"));

        System.out.println("Loading native library from: " + new File(new File(System.getProperty("user.dir"), "lib" + File.separator + "lwjgl2.8.1" + File.separator + "native"), LWJGLUtil.getPlatformName()).getAbsolutePath());
        System.setProperty("org.lwjgl.librarypath", new File(new File(System.getProperty("user.dir"), "lib" + File.separator + "lwjgl2.8.1" + File.separator + "native"), LWJGLUtil.getPlatformName()).getAbsolutePath());
       
       
        String jinput = System.getProperty("user.dir").toString()+ File.separator+"lib" + File.separator + "dist";
        System.out.println("Loading jinput native library from: " + jinput);
        System.setProperty("net.java.games.input.librarypath", jinput);

    }


17  Game Development / Newbie & Debugging Questions / best way for a space background on: 2012-01-26 00:17:13
Hi,
I'm going to use Ardor3d to pull up some graphics, and i'm wondering what's the bast way to make a space-like backgroud?

I think about a skysphere, with some auto-generated glPoint as star.

But if is possible i like to create a dinamic backgroud, so with some algorithm the user will never see 2 same backgroud, and i can add something more than just star, like distant plane, galaxy fog, and somthing like this.

But i'm also new to this king of algorithm..

can you help me to find some tutorial or nice code about this?
18  Game Development / Game Mechanics / Re: Line of sight math on: 2011-11-27 18:18:14
you shoul cicle also for X, or aligned on y line will break your math
19  Discussions / General Discussions / Re: Benchmarks for 3D Java Engines on: 2011-11-25 00:28:09
very hard to do this evaluation: for example JME3 is sheader-based (probably better performance), but this cut off about 6% of market, all the card < opengl2.0 if i'm right...

to take a look at good statistic on market, steam make their statistic public: http://store.steampowered.com/hwsurvey
20  Game Development / Networking & Multiplayer / Re: Trouble with Server, Client! Please help! on: 2011-11-13 02:38:09
is a setting and the sistem is called NAT. sometimes you can autoset the port-forwarding on your router using UPNP
21  Game Development / Networking & Multiplayer / Re: TCP or UDP for my game? on: 2011-11-02 18:10:34
I'm building a test engine for determinism, with a fake network layer.
I'll write news on jbox2d page, but i think I'll use TCP with noDelay(Nagle turned off), and let you know when i'll make it work.
22  Game Development / Newbie & Debugging Questions / Re: Java game project organization on: 2011-10-29 13:42:51
at least a revision sistem, live SVN, GIT or like.
do many branch, and learn haw to use them.

I don't think you need something else, if you are alone or with just 2 or 3 friend.
23  Game Development / Networking & Multiplayer / Re: TCP or UDP for my game? on: 2011-10-29 11:26:54
Maybe you'd assemble the entire byte[] you were going to send and only issue a single write() though.
Reading the original post, I think the author isn't.

I'm serializing object on java NIO, and this object is a linked list of actions... so every write should be be a flush. I'm also truncating the array on the size of MTU-100, and putting exceeding action in another array, but maybe this should be done by NIO.

Quote
My physic is DETERMINISTIC

Independent of the networking aspect to your question, are you absolutely sure about this?

yes! and i'm really happy about this. Physic is just 2D (jbox2D), but with some trick is full deterministic on windows (32 and 64bit), linux (32 and 64 bit), also windows machine was intel, linux was AMD plus a 32bit linux intel(eeepc!). I have an old mac to test on, but actually never "played" with him (I've to reinstall OS and so on...) more info on: http://box2d.org/forum/viewtopic.php?f=9&t=7074&start=10


One shouldn't disable Nagle if they want maximum throughput on streams, no, but unless you want built-in delay on every packet smaller than the MTU, you'll want it on.  Flush is a userspace operation, and does not actually guarantee the TCP layer will immediately deliver your packet. 

Obviously, don't take on faith what you can and should measure.  If you're close to saturating the link for example, disabling Nagle will only make things worse.
You won't be close to saturating the link with a game unless you're Doing Something Wrong. You should be able to stay well under 10kb/sec upload, and if that saturates your link... Well, I guess the delay that comes with such a connection doesn't make it fit for gaming in the first place. If you do some simple buffering yourself you should be able to get something in between Nagle's and nothing at all. I'd say that's the best compromise.

stream saturation can be easily archived in the host, if there are too many player.
24  Game Development / Networking & Multiplayer / TCP or UDP for my game? on: 2011-10-28 00:18:49
Hi

i've read almost all TCP vs UDP thread, but i still have some question.

my game will be very x-wing vs tie-fighter like, almost a clone.

I've had some version running, fine in LAN, but unplayable on the internet.

My physic is DETERMINISTIC: so I can just send the input of the player to host, and from the host "collect" the actions and send them back to all clients.

also on client side i use 2 world: one is sinc with host world, the other is ainc and only use the action from client's side, and generally is in the future respect sinc world of "ping/2" ms.

Probably client will send very small packet every time an input is readed, while the server will elaborate this action "pool" at 30 or 40 FPS.

now imagine a 40FPS action update cycle (25ms).

A server collect all the action arrived during the current FPS, and execute them in the next FPS, then send them back to all client (well, sending them back can be done immediately, but then there will be too much overhead)

client A's ping with host is 100ms
client B's ping with host is 120ms

client A shot, the action arrive with 50ms of lag, worst case add 25ms for action to be executed, and send it back. because of asinc world, client A see it's shot after 50ms from send, and it will be corrected to 75ms after 125ms. I think that 50ms (or better half ping) from clicking a button and ship reaction are too much.
client B see the shot after 25+60ms, 85ms!  this is too much in a shooter game!

ok, maybe 100ms is not a good ping, but many game still playable. Ok thanks to asinc world the experienced lag is "ping/2+25ms"(worst case, with a "warp" of 25ms) on your ship, but you will still experience "your ping/2+25ms"(worst case) lag for other's ship.

As you can see I need guaranteed delivery(at least from server to client side), but I don't care about the order. client will send small packet very fast, and server "big" packet every 25ms.
25  Java Game APIs & Engines / JInput / Re: [HELP]jinput and platform indipendent native loader on: 2011-10-27 19:37:59
maybe your main class was extend (like mine) another class with global jinput's class. maye this is why static setting isn't working. Now I'm going to put the main in another class (with the static classpath set and everything). lets see if this does the trick.
BTW linux 32bit and oracle JVM 1.7

edit: haven't changed main but tested "System.setProperty("net.java.games.input.librarypath", jinput);" in static, and everything works now! thanks!
26  Java Game APIs & Engines / JInput / [HELP]jinput and platform indipendent native loader on: 2011-10-27 01:22:36
hi,
I can't understand why this doesn't work:
1  
2  
3  
String jinput = System.getProperty("java.library.path")+File.pathSeparator+ new File(System.getProperty("user.dir").toString()+ File.separator+"lib" + File.separator + "dist");
        System.out.println("Loading native library from: " + jinput);
        System.setProperty("java.library.path", jinput);


it has worked for lwjgl (but instead of "java.library.path" was "org.lwjgl.librarypath")

i've take a look in the forum, and many link directly the DLL file. I don't like this approach, as it isn't platform independent, so java loose it's greatest quality.

using the -Djava.library.path with the PATH created above everything works.

please tell me how solve this.

thank you
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

Longarmx (50 views)
2014-10-17 03:59:02

Norakomi (39 views)
2014-10-16 15:22:06

Norakomi (31 views)
2014-10-16 15:20:20

lcass (35 views)
2014-10-15 16:18:58

TehJavaDev (66 views)
2014-10-14 00:39:48

TehJavaDev (65 views)
2014-10-14 00:35:47

TehJavaDev (55 views)
2014-10-14 00:32:37

BurntPizza (72 views)
2014-10-11 23:24:42

BurntPizza (43 views)
2014-10-11 23:10:45

BurntPizza (84 views)
2014-10-11 22:30:10
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

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