Java-Gaming.org Hi !
 Featured games (83) games approved by the League of Dukes Games in Showcase (580) Games in Android Showcase (162) games submitted by our members Games in WIP (632) games currently in development
 News: Read the Java Gaming Resources, or peek at the official Java tutorials
 Show Posts Pages: [1]
1  Game Development / Networking & Multiplayer / Re: Need a bit of help with networked physics in 2d on: 2012-06-08 19:34:12
Alright, I spent a couple hours trying to figure out the physics, and this is what I came up with. A friend and I researched the concept of the coefficient of restitution (giving us another equation to use), and after much simplifying, we found out that for 2 objects of equal mass in an elastic collision, they just swap velocities.

I then came up with this algorithm to perform the collision response:

http://i45.tinypic.com/2ld7tzp.jpg (page 1)
http://i49.tinypic.com/1w9j4.jpg (page 2)

But, it only works for certain angles. For others, the 2 objects just stick together, collide for a couple of game ticks, and then stop. Here's a compilable example to show the problem:

 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  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90  91  92  93  94  95  96  97  98  99  100  101  102  103  104  105  106  107  108  109  110  111  112  113  114  115  116  117  118  119  120  121  122  123  124  125  126  127  128  129  130  131  132  133  134  135  136  137  138  139  140  141  142  143  144  145  146  147  148  149  150  151  152  153  154  155  156  157 `import java.awt.Color;import java.awt.Dimension;import java.awt.Graphics;import java.awt.Graphics2D;import java.awt.RenderingHints;import javax.swing.JFrame;import javax.swing.JPanel;public class CollisionTest extends JPanel implements Runnable {   private Ball b1 = new Ball(25, 25, 1, 1, 25);   private Ball b2 = new Ball(225, 0, -1, 1, 25);      public CollisionTest() {      setDoubleBuffered(true);      setPreferredSize(new Dimension(400, 400));   }      public void run() {      // normalise input??      //double v1 = Math.sqrt(b1.vx * b1.vx + b1.vy * b1.vy);      //double v2 = Math.sqrt(b2.vx * b2.vx + b2.vy * b2.vy);            //b1.vx /= v1;      //b1.vy /= v1;      //b2.vx /= v2;      //b2.vy /= v2;            try {         while(true) {            updatePhysics();            repaint();            Thread.sleep(10);         }      } catch(InterruptedException e) {         Thread.currentThread().interrupt();      }   }      public void updatePhysics() {      double b1x = b1.x + b1.vx; // new x pos of ball 1      double b1y = b1.y + b1.vy; // new y pos of ball 1      double b2x = b2.x + b2.vx; // etc.      double b2y = b2.y + b2.vy;            double r2 = b1.r + b2.r;            // distance between centers      double dist = (b2x - b1x) * (b2x - b1x) + (b2y - b1y) * (b2y - b1y);            // if distance between circles is less than sum of radii      if(dist < r2 * r2) {                  double v1 = Math.sqrt(b1.vx * b1.vx + b1.vy * b1.vy);         double v2 = Math.sqrt(b2.vx * b2.vx + b2.vy * b2.vy);                  System.out.println("initial velocity sum: " + (v1 + v2));                  double ratio = b1.r / (b1.r + b2.r);         System.out.println("r1/sum: " + ratio);                  // calculate collision point         double px = ratio * (b1x + b2x);         double py = ratio * (b1y + b2y);         System.out.println("point of collision: " + px + ", " + py);                  // slope of radius at collision point: (py - b1y) / (px - b1x)         // slope of tangent line is negative reciprocal of that         // mt = (b1x - px) / (py - b1y)         double angle = Math.atan2(b1x - px, py - b1y);         System.out.println("collision angle: " + Math.toDegrees(-angle));                  double b1xr = b1x * Math.cos(-angle); // transformed centers not used         double b1yr = b1y * Math.sin(-angle);         double b1vxr = b1.vx * Math.cos(-angle);         double b1vyr = b1.vy * Math.sin(-angle);                  double b2xr = b2x * Math.cos(-angle);         double b2yr = b2y * Math.sin(-angle);         double b2vxr = b2.vx * Math.cos(-angle);         double b2vyr = b2.vy * Math.sin(-angle);                  // swap velocities         System.out.println("ball 1 transformed position: " + b1xr + " " + b1yr);         System.out.println("ball 2 transformed position: " + b2xr + " " + b2yr);         System.out.println("ball 1 transformed velocity: " + b1vxr + ", " + b1vyr);         System.out.println("ball 2 transformed velocity: " + b2vxr + ", " + b2vyr);                  b1.vx = b2vxr;         b1.vy = b2vyr;                  b2.vx = b1vxr;         b2.vy = b1vyr;                  v1 = Math.sqrt(b1.vx * b1.vx + b1.vy * b1.vy);         v2 = Math.sqrt(b2.vx * b2.vx + b2.vy * b2.vy);                  System.out.println("final velocity sum: " + (v1 + v2));                  System.out.println();      } else {                  // set new positions         b1.x = b1x;         b1.y = b1y;                  b2.x = b2x;         b2.y = b2y;      }   }      public void paintComponent(Graphics _g) {      super.paintComponent(_g);            Graphics2D g = (Graphics2D) _g;      g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);      g.setColor(Color.black);      b1.draw(g);      b2.draw(g);   }      public static void main(String[] args) {      JFrame f = new JFrame();      CollisionTest ct = new CollisionTest();      f.setResizable(false);      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);      f.add(ct);      f.pack();      f.setLocationRelativeTo(null);      f.setVisible(true);            ct.run();   }      static class Ball {      public double x;      public double y;            public double vx;      public double vy;            public double r;            public Ball(double _x, double _y, double _vx, double _vy, double _r) {         x = _x;         y = _y;         vx = _vx;         vy = _vy;         r = _r;      }            public void draw(Graphics2D g) {         g.setColor(Color.black);         g.drawOval((int) (x - r), (int) (y - r), (int) (2 * r), (int) (2 * r));      }   }}`

Any ideas?
2  Game Development / Networking & Multiplayer / Need a bit of help with networked physics in 2d on: 2012-06-08 05:19:48
I'm trying to revive a long-forgotten project.

Basically, each player in this game will control an object that can be represented as a circle in 2D. The players will be moving around a playing area and they can bounce off each other with (hopefully) some semblance of realism. Having studied physics in high school this past year (woo hoo!) I can pretty confidently say this is a case of an inelastic collision, since /some/ energy will be lost. But, for simplicity's sake, I'll probably simulate it as an elastic collision.

I've heard networked physics is really, really hard, but I'm sure there are some shortcuts I can take because it's circles in 2D?!

I guess my question is 2 parts:

1. Since kinetic energy and momentum are both conserved in an elastic collision, the sum of the momenta of the 2 objects involved in the collision will be the same before and after the collision. The equation we were given to solve elastic collisions is:

 1 ` m1v1i + m2v2i = m1v1f + m2v2f`

In my game, for now, I'm assuming all objects have a mass of 1. So,

 1 `v1i + v2i = v1f + v2f`

Solving for v1f and v2f,

 1  2 `v1f = v1i + v2i - v2fv2f = v1i + v2i - v1f`

(where v1 and v2 are <x, y> velocities, 'i' means initial, and 'f' means final)

Each solution depends on the other... I need more information? What other information? In all the types of problems we were given to solve in school, they always gave us one of the final velocities.

2. What is the best way to communicate player physics updates to all the rest of the clients?

The old implementation just fired off packets from the client to the server every 30 milliseconds with the player's new position, and the server would then spam everybody else with the new data. Needless to say, this didn't work too well.

How hard can a good implementation be?

Sorry this post is pretty scatterbrained, it's late here.
 3 Java Game APIs & Engines / Android / Re: Tic Tac Twist: multiplayer 3D tic-tac-toe for Android on: 2012-03-19 22:57:30 Quote from: ReBirth on 2012-03-19 03:27:21Well IMHO we're just recreating old game with new style.In 3D TTT, I wonder how you input for the center cell (1, 1, 1) when all cells near it are filled.To move your piece, you rotate the board by dragging and then use the up/down/left/right arrows to put it in the right place. It's actually intuitive, although it doesn't really sound like it by the way I'm describing it.
 4 Java Game APIs & Engines / Android / Re: Tic Tac Twist: multiplayer 3D tic-tac-toe for Android on: 2012-03-18 23:26:52 Quote from: ReBirth on 2012-03-18 03:18:50OMG! tic-tac-toe in 3D?!  Yup.And, the free version's now on the Market.
 5 Game Development / Newbie & Debugging Questions / Re: Array of ArraList? on: 2012-03-17 20:56:23 Quote from: UprightPath on 2012-03-17 20:53:48Nah, they've been there for a while. They're just a very light grey.Heh, maybe I just now started noticing them because they're off.Now that I've sufficiently derailed the thread, you may continue discussing arrays of ArrayLists.../walks off in shame
 6 Game Development / Newbie & Debugging Questions / Re: Array of ArraList? on: 2012-03-17 20:52:07 I don't even remember seeing line numbers before; maybe they're a new feature and still not perfectly implemented?
 7 Java Game APIs & Engines / Android / Tic Tac Twist: multiplayer 3D tic-tac-toe for Android on: 2012-03-17 20:35:03 *I wasn't sure whether to post this in Showcase or Android--if it's in the wrong spot, please do move it.*After about two months of work, I've finished my latest project, Tic Tac Twist. It's a multiplayer 3D tic-tac-toe game that you can play with your friends over Wi-Fi or a cell connection. Kinda like Words with Friends, except tic-tac-toe.As for the technical aspects of the implementation, it's a native Android app using OpenGL for the rendering of the actual gameplay screen and the Android windowing stuff for everything else. The server side runs on PHP with a SQL backend for storing accounts/game state data. It returns JSON-encoded objects back to the client for processing.Paid version (\$0.99): https://play.google.com/store/apps/details?id=com.logiklabs.tictactwistFree version (no ads): https://play.google.com/store/apps/details?id=com.logiklabs.tictactwist.freeI do want to make a bit of money from it, but I'm also going to upload a free version sometime today/tomorrow because I realize my game isn't quite in-depth enough for people to shell out a dollar for it. And, nobody's bought it yet. Then again, I haven't advertised at all. I'd be interested to know what you guys think.Some screenshots: (apologies for JPG, android market Google Play converts them for some reason...)
 8 Java Game APIs & Engines / OpenGL Development / Re: Fontexturer - make .png images from TTF fonts for OpenGL textures on: 2012-03-09 23:30:42 Well, way to show me up. Everyone go use that one now!
9  Java Game APIs & Engines / OpenGL Development / Re: Fontexturer - make .png images from TTF fonts for OpenGL textures on: 2012-03-07 02:48:39
Is it for monospace (fixed width) fonts only?

It works with any font. But, it's hard to use it with proportional fonts because it doesn't save the dimension information for the characters.

If anyone's interested, here's a modified PreviewPanel::save method which writes another file called "metrics.ftx" containing the x/y/width/height of the bounding box for all the characters it puts in the .png image.

 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 void save(File file, String fmt) throws IOException {   BufferedImage buf = new BufferedImage(sideLength, sideLength, BufferedImage.TYPE_INT_ARGB);   Graphics2D g = (Graphics2D) buf.getGraphics();      drawCharacters(g, Color.white);   ImageIO.write(buf, fmt, file);      DataOutputStream dos = new DataOutputStream(new FileOutputStream(new File(file.getParent(), "metrics.ftx")));      for (char ch = MIN_CH; ch <= MAX_CH; ch++) {      TextLayout layout = new TextLayout(String.valueOf(ch), font,            g.getFontRenderContext());      Rectangle2D rect = layout.getBounds();            float cx = (float) rect.getX();      float cy = boxSize - g.getFontMetrics().getDescent();            dos.writeFloat(cx);      dos.writeFloat(cy);      dos.writeFloat((float) rect.getWidth());      dos.writeFloat((float) rect.getHeight());   }      dos.close();   g.dispose();}`
 10 Java Game APIs & Engines / OpenGL Development / Re: Fontexturer - make .png images from TTF fonts for OpenGL textures on: 2012-03-06 01:24:08 I kept the nonprintable characters in there so that I could directly look up the coordinates based on the char value without manipulating it (lazy, I know...) but here's the source so people can make any changes they'd like!Also notably absent is support for bold/italic fonts and there're probably still a few bugs lingering around.
 11 Java Game APIs & Engines / OpenGL Development / Fontexturer - make .png images from TTF fonts for OpenGL textures on: 2012-03-05 03:54:54 I whipped this up for my own use and decided to share it with java-gaming! It allows you to select an installed font on your system and generate a .png image of that font, so you can use it to draw text with OpenGL. There's probably already a tool like this out there. Oh well.Obligatory screenshot:Download here.I'll post the source code if someone requests it.
 12 Games Center / 4K Game Competition - 2012 / Re: Tide Frog 2.0! on: 2012-03-02 23:23:23 I really like this game. It's an original concept (or at least I haven't seen anything similar to it before) and the level editor is definitely a nice touch. My only criticism is that it doesn't appear to be double-buffered, at least on my machine.
13  Game Development / Newbie & Debugging Questions / Re: Move from point A to point B on: 2011-12-16 19:52:14
This moves between (x1, y1) and (x2, y2) in 50 steps using linear interpolation.

 1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16 `public class Test {   public static void main(String[] args) {      int x1 = 10, y1 = 60;      int x2 = 230, y2 = 400;            for(int t = 0; t <= 50; t++) {         double x = lerp(x1, x2, t / 50.0);         double y = lerp(y1, y2, t / 50.0);         System.out.println("t = " + t + ", " + x + ", " + y);      }   }      private static double lerp(int x1, int x2, double t) {      return x1 + (x2 - x1) * t;   }}`

sample output:
 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 `t = 0, 10.0, 60.0t = 1, 14.4, 66.8t = 2, 18.8, 73.6t = 3, 23.2, 80.4t = 4, 27.6, 87.2t = 5, 32.0, 94.0t = 6, 36.4, 100.8t = 7, 40.800000000000004, 107.6t = 8, 45.2, 114.4t = 9, 49.6, 121.19999999999999t = 10, 54.0, 128.0t = 11, 58.4, 134.8t = 12, 62.8, 141.6t = 13, 67.2, 148.4t = 14, 71.60000000000001, 155.2t = 15, 76.0, 162.0t = 16, 80.4, 168.8t = 17, 84.80000000000001, 175.60000000000002t = 18, 89.2, 182.39999999999998t = 19, 93.6, 189.2t = 20, 98.0, 196.0t = 21, 102.39999999999999, 202.79999999999998t = 22, 106.8, 209.6t = 23, 111.2, 216.4t = 24, 115.6, 223.2t = 25, 120.0, 230.0t = 26, 124.4, 236.8t = 27, 128.8, 243.60000000000002t = 28, 133.20000000000002, 250.4t = 29, 137.6, 257.2t = 30, 142.0, 264.0t = 31, 146.4, 270.8t = 32, 150.8, 277.6t = 33, 155.20000000000002, 284.4t = 34, 159.60000000000002, 291.20000000000005t = 35, 164.0, 298.0t = 36, 168.4, 304.79999999999995t = 37, 172.8, 311.6t = 38, 177.2, 318.4t = 39, 181.6, 325.2t = 40, 186.0, 332.0t = 41, 190.39999999999998, 338.8t = 42, 194.79999999999998, 345.59999999999997t = 43, 199.2, 352.4t = 44, 203.6, 359.2t = 45, 208.0, 366.0t = 46, 212.4, 372.8t = 47, 216.79999999999998, 379.59999999999997t = 48, 221.2, 386.4t = 49, 225.6, 393.2t = 50, 230.0, 400.0`

You can also do it using trigonometry to find the angle between the 2 points (with the atan2 function you mentioned) and then stepping towards the second point using cos() and sin():

 1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17 `public class Test {   private static final double SPEED = 0.25;      public static void main(String[] args) {      int x1 = 10, y1 = 60;      int x2 = 230, y2 = 400;            double angle = Math.atan2(y2 - y1, x2 - x1);      double x = x1, y = y1;            while(x < x2 && y < y2) {         x += SPEED * Math.cos(angle);         y += SPEED * Math.sin(angle);         System.out.println(x + ", " + y);      }   }}`

(note that this example won't work if x2 > x1 or y2 > y1, I just wrote it in like 2 minutes so it's not too complete)

Also, if you're getting this frustrated, maybe it's a sign that you need to go to sleep. Seriously, programming is so much easier when you're not so tired that you're falling out of your chair.

Second, I request you only give me code, if you intend to respond, do it with something that will advance my current situation.

Some people might take offense to being told how to respond, and other people like to explain concepts instead of providing code.
 14 Game Development / Shared Code / Re: Perspective correct texture-mapped triangle routine on: 2011-12-12 23:05:40 Quote from: theagentd on 2011-12-12 08:42:11Very interesting! Bookmarked in case I want to do something that isn't supported in hardware yet! Anything on the performance of it?Why are the texture coordinates and vertex coordinates ints? I want doubles, or at least floats! xDWell, the idea is that by this point you will have already projected your points in 3d to screen coordinates, which are assumed by this method to be whole number pixels. My routine doesn't do any fancy rounding stuff to make fractional pixels look nicer, so floats/doubles aren't really necessary. About performance: it's probably not too great but I haven't tested it extensively. I got 500fps with 2 triangles at 320x240, but that dropped down to 50 fps at 1600x900. And that's only 2 triangles. I guess I've got some optimization to do.
15  Game Development / Shared Code / Perspective correct texture-mapped triangle routine on: 2011-12-12 01:18:01
Here's a method I wrote to fill in textured triangles. (x1, y1, z1) to (x3, y3, z3) are the 3 points of the triangle, (u1, v1) to (u3, v3) are the UV texture coordinates, texture[] is the texture image, sidelen is the length of the sides of the texture (should be a power of 2), pixels[] is the buffer to draw the triangle into, and width/height are the buffer dimensions.

UV coordinates are specified in texture image pixels, not 0.0 to 1.0 like in OpenGL. I didn't see too much software rendering code posted so I thought I'd put something out there! There's probably a lot of room for improvement; I'm not sure if floats/doubles are still dismally slow but perhaps a fixed-point implementation would be better.

Here's a screenshot of the code in action:

Have fun with it.

 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  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90  91  92  93  94  95  96  97  98  99  100  101  102  103  104  105  106  107  108  109  110  111  112  113  114  115  116  117  118  119  120  121  122  123  124  125  126  127  128  129  130  131  132  133  134  135  136  137  138  139  140  141  142  143  144  145  146  147  148  149  150  151  152  153  154  155  156  157  158  159  160  161  162  163  164  165  166  167  168  169  170  171  172  173  174  175  176  177  178  179  180  181  182  183  184  185  186  187  188  189  190  191  192  193  194  195  196  197  198  199  200  201  202  203  204  205  206  207  208  209  210  211  212  213  214  215  216  217  218  219  220  221  222  223  224  225  226  227  228  229  230  231  232  233  234  235  236  237  238  239  240  241  242  243  244  245  246  247  248  249  250 `public void perspectiveTriangle(int x1, int y1, double z1, int x2, int y2,      double z2, int x3, int y3, double z3, int u1, int v1, int u2,      int v2, int u3, int v3, int[] texture, int sidelen, int[] pixels,       int width, int height) {      double startx, endx, startu, endu, startv, endv, startz, endz;   double slope21, slope31, slope32;   double u1i, v1i, z1r, u2i, v2i, z2r, u3i, v3i, z3r;   double du21, dv21, dz21, du31, dv31, dz31, du32, dv32, dz32, dx, dy, du, dv, dz, u, v, z;   double slopeleft, sloperight, duleft, duright, dvleft, dvright, dzleft, dzright, tempz;   int temp, off, start, end, uu, vv;      if(y2 < y1) {      temp = x2; x2 = x1; x1 = temp;      temp = y2; y2 = y1; y1 = temp;      temp = u2; u2 = u1; u1 = temp;      temp = v2; v2 = v1; v1 = temp;      tempz = z2; z2 = z1; z1 = tempz;   }   if(y3 < y1) {      temp = x3; x3 = x1; x1 = temp;      temp = y3; y3 = y1; y1 = temp;      temp = u3; u3 = u1; u1 = temp;      temp = v3; v3 = v1; v1 = temp;      tempz = z3; z3 = z1; z1 = tempz;   }   if(y3 < y2) {      temp = x3; x3 = x2; x2 = temp;      temp = y3; y3 = y2; y2 = temp;      temp = u3; u3 = u2; u2 = temp;      temp = v3; v3 = v2; v2 = temp;      tempz = z3; z3 = z2; z2 = tempz;   }      if(y1 == y3)      return;      u1i = u1 / z1; u2i = u2 / z2; u3i = u3 / z3;   v1i = v1 / z1; v2i = v2 / z2; v3i = v3 / z3;   z1r = 1.0d / z1; z2r = 1.0d / z2; z3r = 1.0d / z3;      dy      = 1.0d /  (y2 - y1);   slope21 = (double) (x2 - x1) * dy;   du21    = (double) (u2i - u1i) * dy;   dv21    = (double) (v2i - v1i) * dy;   dz21    = (double) (z2r - z1r) * dy;      dy      = 1.0d /  (y3 - y1);   slope31 = (double) (x3 - x1) * dy;   du31    = (double) (u3i - u1i) * dy;   dv31    = (double) (v3i - v1i) * dy;   dz31    = (double) (z3r - z1r) * dy;      dy      = 1.0d /  (y3 - y2);   slope32 = (double) (x3 - x2) * dy;   du32    = (double) (u3i - u2i) * dy;   dv32    = (double) (v3i - v2i) * dy;   dz32    = (double) (z3r - z2r) * dy;      startx = endx = x1;   startu = endu = u1i;   startv = endv = v1i;   startz = endz = z1r;      if(y1 != y2) {      if(slope21 > slope31) {         slopeleft = slope31;         sloperight = slope21;                  duleft = du31;         duright = du21;                  dvleft = dv31;         dvright = dv21;                  dzleft = dz31;         dzright = dz21;      } else {         slopeleft = slope21;         sloperight = slope31;                  duleft = du21;         duright = du31;                  dvleft = dv21;         dvright = dv31;                  dzleft = dz21;         dzright = dz31;      }            for(int y = y1; y != y2; y++) {         if(y > 0 && y < height) {            dx = endx - startx;            if(dx != 0) {               du = (endu - startu) / dx;                dv = (endv - startv) / dx;               dz = (endz - startz) / dx;            } else {               du = endu - startu;               dv = endv - startv;               dz = endz - startz;            }            u = startu;            v = startv;            z = startz;                        off = y * width;            start = off + (int) startx;            end = off + (int) endx;            if(start < off) {               dx = -startx;               u += dx * du;               v += dx * dv;               z += dx * dz;               start = off;            }            if(end > off + width - 1)               end = off + width - 1;                     while(start < end) {               uu = ((int) (u / z)) & (sidelen - 1);               vv = ((int) (v / z)) & (sidelen - 1);               pixels[start++] = texture[vv * sidelen + uu];               u += du;               v += dv;               z += dz;            }         }         startx += slopeleft;         endx += sloperight;                  startu += duleft;         endu += duright;                  startv += dvleft;         endv += dvright;                  startz += dzleft;         endz += dzright;      }   } else {      if (x1 > x2) {         startx = x2;         endx = x1;                  startu = u2i;         endu = u1i;                  startv = v2i;         endv = v1i;                  startz = z2r;         endz = z1r;      } else {         startx = x1;         endx = x2;                  startu = u1i;         endu = u2i;                  startv = v1i;         endv = v2i;                  startz = z1r;         endz = z2r;      }   }      if(y2 != y3) {      if(slope32 > slope31) {         slopeleft  = slope32;         sloperight = slope31;                  duleft = du32;         duright = du31;                  dvleft = dv32;         dvright = dv31;                  dzleft = dz32;         dzright = dz31;      } else {         slopeleft  = slope31;         sloperight = slope32;                  duleft = du31;         duright = du32;                  dvleft = dv31;         dvright = dv32;                  dzleft = dz31;         dzright = dz32;      }            for(int y = y2; y != y3; y++) {         if(y > 0 && y < height) {            dx = endx - startx;            if(dx != 0) {               du = (endu - startu) / dx;                dv = (endv - startv) / dx;               dz = (endz - startz) / dx;            } else {               du = endu - startu;               dv = endv - startv;               dz = endz - startz;            }            u = startu;            v = startv;            z = startz;            off = y * width;            start = off + (int) startx;            end = off + (int) endx;            if(start < off) {               dx = -startx;               u += dx * du;               v += dx * dv;               z += dx * dz;               start = off;            }            if(end > off + width - 1)               end = off + width - 1;                     while(start < end) {               uu = ((int) (u / z)) & (sidelen - 1);               vv = ((int) (v / z)) & (sidelen - 1);               pixels[start++] = texture[vv * sidelen + uu];               u += du;               v += dv;               z += dz;            }         }                  startx += slopeleft;         endx += sloperight;                  startu += duleft;         endu += duright;                  startv += dvleft;         endv += dvright;                  startz += dzleft;         endz += dzright;      }   }}`
 16 Discussions / General Discussions / Re: Hi, java-gamingers. on: 2011-12-10 16:52:45 Quote from: ReBirth on 2011-12-10 06:43:31Welcome to community I can say you already have big leap progress there. You wanna to four-kay? be my rival then Thanks! And, I guess the competition's on.  Quote from: ra4king on 2011-12-10 14:51:11Quote from: mlaux on 2011-12-09 23:02:19Quote from: ra4king on 2011-12-09 07:52:47Welcome to JGO!And I'm interested in that workaround to bypass screen-monitoring software (my current school does it), how would that work?Heh. I used Wireshark to figure out what the program did (it sent Base64-encoded jpgs of the screen encapsulated in XML over HTTP) and wrote something that emulated that, but sent whatever screenshot you wanted. I'd give you the source, but I was dumb and put the program on a website and the next thing I knew the company who made the monitoring software was all mad at me and asked me to take it down.Oops accidental medal...enjoy Anyway, ah I already tried to do that but of course, the computers are already locked down, can't install or accept UAC also how would you stop the monitoring program from sending the screenshot too?It was a Windows service, and I just disabled it.
 17 Discussions / General Discussions / Re: Hi, java-gamingers. on: 2011-12-09 23:02:19 Quote from: loom_weaver on 2011-12-09 04:13:06Good to hear you're liking Java and you've written an impressive amount of stuff in a short period of time.Welcome to JGO!Thanks!Quote from: ra4king on 2011-12-09 07:52:47Welcome to JGO!And I'm interested in that workaround to bypass screen-monitoring software (my current school does it), how would that work?Heh. I used Wireshark to figure out what the program did (it sent Base64-encoded jpgs of the screen encapsulated in XML over HTTP) and wrote something that emulated that, but sent whatever screenshot you wanted. I'd give you the source, but I was dumb and put the program on a website and the next thing I knew the company who made the monitoring software was all mad at me and asked me to take it down.
 18 Game Development / Newbie & Debugging Questions / Re: Applet's vs Applications on: 2011-12-09 04:13:46 It's pretty flexible to subclass Applet; as well as the usual applet behavior, you can always just throw it in a JFrame if you want to provide a windowed/downloadable version.
 19 Discussions / General Discussions / Hi, java-gamingers. on: 2011-12-09 04:02:32 First, I haven't really seen many introduction threads around here, so I don't know if they're allowed, but you people seem like a friendly bunch so here goes!I'm Matt, I'm 16, and I'm from Texas. My involvement with computers started at the age of 4 when my parents bought me the "Pajama Sam" and "Putt Putt" kids' point-and-click adventure games. My other hobby at that age was going to websites like dell.com and compaq.com and configuring the most awesome computers money could buy--of course, I never got to buy them. By 8, I had taught myself HTML, QBASIC and Visual Basic (I don't know how I got involved in them, really), by 11 I was messing around in C++ (I should post some of the horrible C++ code I wrote, it would make for a good laugh), and around 2 years ago I started poking around with Java. Projects since then have included an IRC client, a published Android app, a couple silly games, a bypass (er, workaround) for screen-monitoring software a (past) high school of mine installed on students' laptops, a cruddy software 3d renderer, and various other things. I'm planning to enter the Java4k game contest this year. My biggest weakness is overthinking/overdesigning things, and I'm hoping to curb that.So, yup. Here I am. I hope to contribute to this excellent community.
 Pages: [1]
 Waterwolf (20 views) 2015-05-20 15:01:45 chrislo27 (24 views) 2015-05-20 03:42:21 BurntPizza (58 views) 2015-05-10 15:53:18 FrozenShade (44 views) 2015-05-07 09:11:21 TheLopais (207 views) 2015-05-06 13:36:48 TheLopais (191 views) 2015-05-06 13:35:14 TheLopais (198 views) 2015-05-06 13:33:39 TheLopais (214 views) 2015-05-06 13:32:48 TheLopais (214 views) 2015-05-06 13:31:28 ClaasJG (236 views) 2015-04-30 20:33:25
 Spasi 31x BurntPizza 16x theagentd 14x DavidBVal 13x ra4king 12x EgonOlsen 11x KevinWorkman 9x Husk 9x princec 8x scanevaro 8x KaiHH 7x opiop65 6x revers 6x Riven 6x SauronWatchesYou 5x Drenius 5x
 List of Learning Resources2015-05-05 10:20:32How to: JGO Wikiby Mac702015-02-17 20:56:162D Dynamic Lighting2015-01-01 20:25:42How do I start Java Game Development?by gouessej2014-12-27 19:41:21Resources for WIP gamesby kpars2014-12-18 10:26:14Understanding relations between setOrigin, setScale and setPosition in libGdx2014-10-09 22:35:00Definite guide to supporting multiple device resolutions on Android (2014)2014-10-02 22:36:02List of Learning Resources2014-08-16 10:40:00
 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