Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
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 / Newbie & Debugging Questions / Re: Kryonet Size Of Packets on: 2014-07-25 15:09:43
The minimum packet size for TCP is larger than 6 bytes, so it's likely Kryonet's overhead. My guess is because Kryonet serializes the entire byte object (it's not just a primitive byte)
2  Game Development / Newbie & Debugging Questions / Re: Online Card Game Architecture Design on: 2014-05-05 20:39:55
https://github.com/EsotericSoftware/kryonet is pretty amazing.
3  Discussions / Miscellaneous Topics / Re: Windows 8 - Odd HDD behaviour on: 2014-04-23 14:17:33
Probably your page file

System Properties -> Advanced Tab -> Performance Settings -> Advanced Tab -> Change

Edit: I guess my path might be different for Windows 8
4  Game Development / Newbie & Debugging Questions / Re: Over the top Error handling? on: 2014-04-09 18:58:38
Perhaps another person is working on the same code base and prefers 24hr time? Not sure! Just seems like an unnecessary step. The less ways a user can mess it up, the better
5  Game Development / Newbie & Debugging Questions / Re: Over the top Error handling? on: 2014-04-09 14:56:11
Sorry for not answering the question...but why wouldn't I be able to set the hour of a 12 hour clock to 17:00:00 and have your program parse it accordingly? That seems like a big restriction for little to no benefit.
6  Game Development / Newbie & Debugging Questions / Re: [LibGDX] Getting smooth camera movement on: 2014-02-06 17:31:31
Glad to have at least taught you about the lerp function; it's very useful!
7  Game Development / Newbie & Debugging Questions / Re: [LibGDX] Getting smooth camera movement on: 2014-02-06 17:00:35
I am not sure if I understand your question correctly...but why don't you just lerp to the target position?

1  
2  
float smoothing = 0.5f; // lower the smoother 
super.position.lerp(position, smoothing);
8  Java Game APIs & Engines / Android / Re: Server for an Android [Java] Game. on: 2014-02-04 16:19:05
I didn't use any specific tutorials, I just simply googled what I didn't understand - sorry.

For me personally, if it's a synchronous game, I would just stick to using standard sockets and use the same language on both sides.

Check out https://github.com/EsotericSoftware/kryonet which is an amazing net library and fun to use too. Works with Android (TCP only) as well
9  Game Development / Newbie & Debugging Questions / Re: Server/Client on: 2014-02-04 13:59:18
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
10  Java Game APIs & Engines / Android / Re: Server for an Android [Java] Game. on: 2014-01-24 16:27:28
I am working on an asynchronous turn based android game myself and using python for the server that just serves http post requests. It's my first time using python and I must say, it's great for building a simple interface for database requests! Would recommend!
11  Discussions / General Discussions / Re: Nouns to classes on: 2014-01-14 23:19:10
We were taught something similar to this in my OO class in college actually.
12  Game Development / Game Play & Game Design / Re: Surivial Gameplay on: 2013-05-30 18:15:28
Playing survival games with friends or strangers is what makes them fun, for me at least. Maybe try toying with multi-player support?
13  Game Development / Newbie & Debugging Questions / Re: How to add knockback? :S on: 2013-05-27 16:07:23
Hey that's my weird knockback code!

When there are a lot of enemies, this solution makes them all shake and do funky stuff, but here it is anyway to get you going somewhere.

Add to update loop:
1  
2  
3  
4  
5  
if(entityRect.intersects(otherEntityRect)){
   
   Vector2f translatedDifference = Tools.calcMinTranslationDistance(entityRect, otherEntityRect);
   entity.addPosition(translatedDifference.x, translatedDifference.y);
}


I didn't write all this myself and I don't remember who exactly did (sorry). It basically just gives you the distance to stop two rectangles from overlapping:
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  
public static Vector2f calcMinTranslationDistance(Rectangle rect1, Rectangle rect2){
   
   float difference;
   float minTranslateDistance;
   short axis;
   short side;
   Vector2f translatedDifference = new Vector2f(0,0);
   
   // Left
   difference = (rect1.getX() + rect1.getWidth()) - (rect2.getX());
   minTranslateDistance = difference;
   axis = 0;
   side = -1;
   
   // Right
   difference = (rect2.getX() + rect2.getWidth()) - rect1.getX();
   if(difference < minTranslateDistance){
      minTranslateDistance = difference;
      axis = 0;
      side = 1;
   }
   
   // Down
   difference = (rect1.getY() + rect1.getHeight()) - rect2.getY();
   if(difference < minTranslateDistance){
      minTranslateDistance = difference;
      axis = 1;
      side = -1;
   }
   
   // Up
   difference = (rect2.getY() + rect2.getHeight()) - rect1.getY();
   if(difference < minTranslateDistance){
      minTranslateDistance = difference;
      axis = 1;
      side = 1;
   }
   
   // Y
   if(axis == 1)  
      translatedDifference.y = side * minTranslateDistance;
   // X
   else
      translatedDifference.x = side * minTranslateDistance;
   
   return translatedDifference;
}


14  Game Development / Game Mechanics / Re: Entity knockback on: 2013-04-20 19:34:53
It's probably a bad way of doing it, but this is my code for knockback to give you an idea

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
   public void knockback(float r, float force){
      r = r - 180;
     
      force *= knockbackResistance; // how heavy the entity is (so lesser knock back)
     
      knockbackTimer = force * 8;
      knockbackTo = new Vector2((force * (float) MathUtils.sin(r * MathUtils.degreesToRadians)),
                         (-force * (float) MathUtils.cos(r * MathUtils.degreesToRadians)))
                                       .add(position);
               
   }


Then I have this on the update loop for the entity

1  
2  
3  
4  
5  
6  
   public void update(){
      if(knockbackTimer > 0){
         position = Tools.lerp(position, knockbackTo, 0.2f);
         knockbackTimer -= Gdx.graphics.getDeltaTime() * 1000;
      }
        }
15  Game Development / Networking & Multiplayer / Re: Kryonet packet sending on connection issue! on: 2013-01-29 18:48:50
You call a method in the connected event that sends something no?

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
            for (int i = 0; i < 200; i++) {
               if (!(cuboids[i][0] == 0 && cuboids[i][1] == 0
                     && cuboids[i][2] == 0 && cuboids[i][3] == 0
                     && cuboids[i][4] == 0 && cuboids[i][5] == 0)) {
                 
                  // this guy
                  sendCuboid(connection, cuboids[i][0], cuboids[i][1],
                        cuboids[i][2], cuboids[i][3], cuboids[i][4],
                        cuboids[i][5]);

               }
            }


Do you know for sure that this sendCuboid is actually being called?
16  Game Development / Networking & Multiplayer / Re: Kryonet packet sending on connection issue! on: 2013-01-29 02:12:46
Are you certain that you are actually sending anything on your connected event?

1  
System.out.println("Sent all cuboids present");
is outside your if statement.


Also, you shouldn't send each "cuboid" individually; batch them up into one server.sendToTCP call.
17  Game Development / Networking & Multiplayer / Re: Starting point for multiplayer development needed! on: 2012-02-29 16:51:51
If you have never touched sockets before, I suggest you try implementing a chat server, before you undertake a multiplayer game.

http://pirate.shu.edu/~wachsmut/Teaching/CSAS2214/Virtual/Lectures/chat-client-server.html

Also +1 for the KryoNet library

18  Game Development / Networking & Multiplayer / Re: [Kryonet] SerializationException on: 2011-10-01 19:48:39
Make sure you are registering your network classes in the same order, on both client and server side.
19  Game Development / Newbie & Debugging Questions / Re: NPC Collision on: 2011-08-11 12:50:31
Are you literally checking each NPC one by one?

Sorry if I completly miss it, but I think what you are looking for is a loop.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
for(int i = 0; i < NPCRect.length; i++){

   // ignore null NPCs in the list
   if(NPCRect[i] == null) continue;

   // make sure there is no collisions on any of the NPCs
   if(PlayerRect.intersect(NPCRect[i]) == false){
      // your logic??
   }
}


20  Game Development / Newbie & Debugging Questions / Re: Boomerang logic? on: 2011-08-10 17:07:56
The x and y are the boomerang coordinates and the targetX and targetY would be your character's coordinates.

Try to get this working, it's simpler:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
// when the boomerang is ahead of the character, move it backwards and move it
// forwards when it is behind the character.
if(boomerangX > characterX){
   boomerangX-=boomerangSpeed;
}
else{
   boomerangX+=boomerangSpeed;
}

// when the boomerang is below of the character, move it upwards and move it
// downwards when it is above the character.
if(boomerangY > characterY){
   boomerangY-=boomerangSpeed;
}
else{
   boomerangY+=boomerangSpeed;
}


21  Game Development / Newbie & Debugging Questions / Re: Boomerang logic? on: 2011-08-10 15:25:53
so to track back it would have remembered the route it took and just backtrack that after it's max time out?


No, pathfinding is too expensive an operation for projectiles (especially if you have lots).

To backtrack to the source, you simply get position of source and the projectile and then move projectile closer towards source (at desired speed). You repeat this every frame until projectile reaches the source. To get a more smoother curvey move back just slowly subtract new direction from projectiles current direction.

Kappa is correct. You can google examples of follow missiles or homing missiles as they are the exact same logic you want.

Formula I found from google to go towards a target:
1  
2  
3  
4  
5  
6  
        int dy = targetY - y;
        int dx = targetX - x;
        double speed, sep;

        sep = Math.sqrt(dx * dx + dy * dy);
        speed = scale/sep;


There is a cheaper way than doing square roots but at this point, you shouldn't be worrying about optimization as small as that.
22  Game Development / Newbie & Debugging Questions / Re: Boomerang logic? on: 2011-08-10 13:10:41
I think it would be even easier to just forget about pathing the boomerang. Just shoot it out like a bullet and have a timer that will expire (or when it collides with a wall/enemy) and tell the boomerang to a "go back to player" state. In this state, it will stop moving forward and instead, track back towards the player (just like a follow missile).
23  Game Development / Networking & Multiplayer / Re: KryoNet - Suppress multiple connections from same user? on: 2011-08-03 17:37:07
if they play the game from work, school, open wifi, etc.
every house / apartment with more than one human living in it, have a lan and use a router, wifi or not makes no difference.

I agree. I was just giving some simple examples; open wifi being like a cafe or a downtown hot spot.

But I also want to prevent the same person playing with more than one account on the same server (at least on the same machine).

It's possible to grab the MAC (unique to the machine) of the network card being used by the client and have that client send that MAC to the server to store and compare to other clients.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
import java.net.InetAddress;
import java.net.NetworkInterface;

public class Main {
  public static void main(String[] args) throws Exception {
    InetAddress addr = InetAddress.getLocalHost();

    NetworkInterface ni = NetworkInterface.getByInetAddress(addr);
    byte[] maca = ni.getHardwareAddress();

    for (int k = 0; k < maca.length; k++) {
      System.out.format("%02X%s", maca[k], (k < maca.length - 1) ? "-" : "");
    }
  }
}


Source: http://forums.techarena.in/software-development/1295054.htm
24  Game Development / Networking & Multiplayer / Re: KryoNet - Suppress multiple connections from same user? on: 2011-08-03 16:57:37
If they come from the same LAN, they will have the same IP address. Unfortunately, this can not be helped and will cause problems, if they play the game from work, school, open wifi, etc.

Here's what you can have in your server listener:

1  
2  
3  
4  
5  
6  
7  
8  
         public void connected(Connection c){
            Connection[] connections = server.getConnections();

            for(int i = 0; i < connections.length; i++)
               if(c.getRemoteAddressTCP().equals(connections[i].getRemoteAddressTCP()))
                  c.close();
           
         }


I haven't tested it, but you can see the general idea here. Also, now that I think of it, it should be in the received method so that you may send back a error message to why the player was disconnected from the server.
25  Game Development / Networking & Multiplayer / Re: KryoNet - Suppress multiple connections from same user? on: 2011-08-03 16:37:02
I don't have access to my code on this computer but...

You should be able to grab the host information from the connection and do a match to the other connections to make sure there are no equals.
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 (41 views)
2014-10-17 03:59:02

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

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

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

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

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

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

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

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

BurntPizza (80 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!