Java-Gaming.org Hi !
Featured games (88)
games approved by the League of Dukes
Games in Showcase (679)
Games in Android Showcase (194)
games submitted by our members
Games in WIP (734)
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 ... 5
1  Game Development / Newbie & Debugging Questions / Re: Best way to manage entities in a client-server model on: 2015-09-11 18:29:13
You declare each entity like:

public static final Entity PIG = new Entity(0);

then you store each entity in an array by using the ID as index:

entity[0] would contain PIG
entity[1] contains SHEEP

and so on...

Yeah, that seems like a bit better than my way, still has the issue of having to be done for each new entity however. Maybe that's just the way I'll have to do it
2  Game Development / Newbie & Debugging Questions / Re: Best way to manage entities in a client-server model on: 2015-09-11 18:04:08
Well... the easiest way would be to give each entity an ID. Then send
a packet like:

spawn:<entity id>:x,y,z

As an easy example. You could also use IDs for commands to save more bandwidth.

Yes, that's the method I am considering using at the moment, but the limitation of this would be I would need a massive selection statement in the client program like this :

1  
2  
3  
4  
5  
if (id == 0)
//Entity is a pig
if (id == 1)
//Entity is a sheep
//etc....


meaning I need to add to this every time I add new entities to the game. I was wondering if there were any cleaner solutions to this issue?
3  Games Center / WIP games, tools & toy projects / Re: StellarF(x): infinite space shooting game on: 2015-09-11 17:05:44
Awesome concept, great gameplay, I really enjoyed playing this one it's looking awesome! (especially love that replay feature at the end)

Just a little idea from a fellow maths nerd, maybe you could make ships shaped like the mandelbrot fractal or the julia fractals sticking with the theme of complex numbers.

Still awesome game, nice to see even game programmers innovating with pure mathematics!
4  Game Development / Newbie & Debugging Questions / Re: Best way to manage entities in a client-server model on: 2015-09-11 16:59:19
I didn't do something like that so far, but isn't the server supposed
to just do the logic and inform about updates? Normally the client
knows about every entity and what it can do, while the server orders
it to do something. If this couldn't help you can you tell more precisely
what exactly you want to do?  Or show your project?

If you want to send whole classes over maybe check out KryoNet.

Greetings

The issue is the world is dynamic and entities will be added and removed server-side. When the server say spawns a pig (for example) what's the best way of communicating to the client that it was a pig entity that was spawned and how can the client differentiate between a pig and a sheep (for example)
5  Game Development / Newbie & Debugging Questions / Best way to manage entities in a client-server model on: 2015-09-11 16:47:18
Hey JGO,

Just started porting my game to multiplayer (No, I don't know why I'm putting myself through this either), and I'm wondering how you guys think the best way to go about entity creation and removal management would be.

Obviously I can't just send the entire Entity class from the server to the client with all the render data attached, but my issue is what system must I then use to differentiate between types of entities.

Is the only way to send a byte or integer code unique to each entity and then have a massive selection statement client-side that instantiates a render-only instance of each entity?

Interested to hear how you guys have solved this problem if you've come across it!

Thanks!
6  Game Development / Newbie & Debugging Questions / Re: Patchwork style render on: 2015-09-07 11:11:06
Thanks for all your help and suggestions, I've decided to revert the idea and just use Perlin Noise instead! Thanks anyway!
7  Game Development / Newbie & Debugging Questions / Re: Patchwork style render on: 2015-09-06 19:05:54
So I tried out the Voronoise function, its working pretty well :



Just the issue is that I'm getting colour changes at the edges of each 'polygon'. It's workable, but I would prefer not to have them, any suggestions on how to fix this?
8  Game Development / Newbie & Debugging Questions / Re: Patchwork style render on: 2015-09-06 17:52:37
You should take a look at this: https://www.shadertoy.com/view/Xd23Dh
Non-so-efficient Java implementation (by me) here: https://gist.github.com/Longor1996/64ca31a25286470e3730

Yes! This seems to be exactly what I was looking for, I did some research into 'Voronoise' on google will try and implement that! Thanks a lot!
9  Game Development / Newbie & Debugging Questions / Re: Patchwork style render on: 2015-09-06 09:01:40
Why do you think you need to generate an infinite terrain? Just use your location as a random seed, that way your terrain will always be the same in the same location, but you don't have to keep an infinite terrain in memory... which is impossible.

Yes, I don't need it to be generated, mistake in the question

You can get some seam-like properties out of perlin/simplex noises with absolute value: http://www.java-gaming.org/index.php?topic=34560.0
You could then use a thresholding flood fill to color in the pieces.

The only issue with this method, is it leaves gaps in between each one, I want seamless transitions like a Voroni diagram
10  Game Development / Newbie & Debugging Questions / Patchwork style render on: 2015-09-05 20:28:03
Hey JGO (long time no see!),

I'm trying to figure out how i can generate some kind of 'patchwork' style pattern image that will be infinite.

Kind of like this picture except each field would be a totally different colour


I've looked into Voroni diagrams but an infinite implementation, although seemingly possible, strike me as inefficient and not very mathmatical.
Perlin Noise doesn't really do the job either, as this would make it more likely for certain colours to be connected which I don't want, I want complete randomness.

Any ideas on the best way to go around this?

11  Game Development / Newbie & Debugging Questions / Re: 2D Perlin Noise Algorithm not working correctly on: 2015-01-07 13:13:32
This solution fixed the obvious issue thanks!

However now I'm, not so much an issue, but something weird where the values don't seem to cover the entire range between -1 and 1. Occasionally 1 in every about 36 attempts i will get one value bigger than 0.7 but other than that they are mostly between -0.5 and 0.5. This can be worked around it doesn't cause any major issue, but all other tutorials and images I've seen have values ranging all the way from -1 to 1!
12  Game Development / Newbie & Debugging Questions / Re: A little problem..... (Rendering) on: 2015-01-06 21:58:40
Ed's implementation would be much faster using a comparator to sort the list of entities before rendering instead like so (snipet from my game code):

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
      entities.sort(Entity.ySorter);
      for (Entity e : entities) {
         AABB b = e.getBoundsForRendering();
         if (b != null) {
            if (b.intersects(cam.getViewportBounds()))
               e.render();
         } else {
            e.render();
         }
      }


Entity.ySorter is as follows:

1  
2  
3  
4  
5  
6  
7  
   public static SortByY ySorter = new SortByY();
   
   public static class SortByY implements Comparator<Entity> {
      public int compare(Entity o1, Entity o2) {
         return (o1.getY() > o2.getY()) ? -1 : (o1.getY() < o2.getY()) ? 1 : 0;
      }
   }
13  Game Development / Newbie & Debugging Questions / 2D Perlin Noise Algorithm not working correctly on: 2015-01-06 21:55:48
So I'm trying to write my own perlin noise algorithm at the moment but I've been stuck with this one problem for a long time

Here is my result:



And here's my code (sorry it's a bit messy, I'm not using a proper vector class at the moment):

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  
private float dot(float x0, float y0, float x1, float y1) {
   return (x0 * x1) + (y0 * y1);
}

public float sample(float x, float y) {
   int gx0 = (int) Math.floor(x);
   int gy0 = (int) Math.floor(y);
   int gx1 = gx0 + 1;
   int gy1 = gy0 + 1;
   
   float dx0 = x - gx0;
   float dy0 = y - gy0;
   
   float dx1 = x - gx1;
   float dy1 = y - gy1;
   
   float w0 = dot(dx0, dy0, getVX(gx0, gy0), getVY(gx0, gy0));
   float w1 = dot(dx0, dy1, getVX(gx0, gy1), getVY(gx0, gy1));
   float w2 = dot(dx1, dy1, getVX(gx1, gy1), getVY(gx1, gy1));
   float w3 = dot(dx1, dy0, getVX(gx1, gy0), getVY(gx1, gy0));
   
   float sx = weigh(dx0);
   float sy = weigh(dy0);
   
   float a = lerp(sy, w0, w1);
   float b = lerp(sy, w2, w3);
   float h = lerp(sx, a, b);
   
   return h;
}

private float weigh(float x) {
   return 3 * (x * x) - 2 * (x * x * x);
}

private float lerp(float w, float a, float b) {
      return a + w * (b - a);
}


The functions getVX and getVY get the respective x and y components of the vectors at the grid points. I'm pretty sure this isn't an issue with random generation of the gradients on the grid points but I can post this code if it will help!

Thanks in advanced  Cheesy!
14  Game Development / Newbie & Debugging Questions / Re: OpenGL Color Blending on: 2014-12-30 09:22:04
I'm still failing to see how this makes a difference, as the color gets applied directly as a color offset to the texture as if it were written like this:

1  
2  
GL11.glColor4f(r, g, b, 1.0f);
GL11.glVertex2f(x, y);


The article you linked discusses the ordering of physical geometry in the scene whereas the light itself is just an applied color offset
15  Game Development / Newbie & Debugging Questions / Re: OpenGL Color Blending on: 2014-12-29 10:25:41
Quote
Is it a problem with one channel being not represented even slightly so it doesn't get shown? Instead of straight blue do something like vec3(0.02, 0.02, 1.0) and see what you get.

It seems that the closer the other channels get to 0, the less visible the lighting effect is on non-grey textures. I found when making light colour: (0.3f, 0.3f, 1.0f) in RGB, the light showed up somewhat, but the blue didn't seem to be blending with the green.

Quote
What order do you draw your objects on to the screen? I suspect you have an issue here

Depending on the order you draw things in the source and destination colors will be different

I render all of the tiles on the map, then the entities. But I don't see why this should make a difference.

Quote
Looks correct. Are you sure your glow/light texture isn't being hidden by the depth test?

There is no texture for a light, it is simply represented as a color offset to the original texture of the tile.
16  Game Development / Newbie & Debugging Questions / Re: OpenGL Color Blending on: 2014-12-28 18:31:20
1  
2  
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);


Is this the wrong one?
17  Game Development / Newbie & Debugging Questions / OpenGL Color Blending on: 2014-12-28 16:56:47
So I've almost finished my tile based colored lighting system for my game, but I'm having an issue when using the color blending.

To set the RGB levels for each tile, I use the following code which is based off my own 'Buffer Object' class:

('bo' is an instance of the buffer object class)

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
bo.bindImage(i);
bo.setDepth(Tile.yPosToDepth(y) - 1.0f); //This line is not important to this issue (At least I don't think it is!)
bo.setRGB(r0, g0, b0);
bo.setUV(txmax, tymin);
bo.addVertex(x + tileSize, y + tileSize);
bo.setRGB(r1, g1, b1);
bo.setUV(txmin, tymin);
bo.addVertex(x, y + tileSize);
bo.setRGB(r3, g3, b3);
bo.setUV(txmin, tymax);
bo.addVertex(x, y);
bo.setRGB(r2, g2, b2);
bo.setUV(txmax, tymax);
bo.addVertex(x + tileSize, y);


This gets compiled exactly as you'd expect it to into a VBO. However the colour blending is not working properly when I use textures as shown in this image:



As you can see, the blue only shows up on the grey texture, not on the green.
However when I replace all my tiles with white textures I get the following result:



So the colour blending is working correctly!??!

Please note that green and blue lights are working completely fine, it just seems to be an issue with the blue channel.

Here are my texture loading parameters if it is of any help:

1  
2  
3  
4  
5  
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER,GL11.GL_NEAREST);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER,GL11.GL_NEAREST);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, b);


Also note, that GL_BLEND is enabled, in the images, the player's shirt is green but that is still blending correctly and the random squares are rain, so just ignore them!

Thanks in advance!  Cheesy
18  Games Center / Showcase / [LD29] Cave Runner - A multi monitor game on: 2014-04-29 18:56:44
I created this game in 72 hours with a friend for the Ludum Dare game jam!



So, the idea to use more than one monitor was ambitious and has severe bugs on some multi monitor machines!
As far as I'm aware, the game works fine on all single monitor setups however.

If you have issues with the game and you really are desperate to play (which you shouldn't be as the level design was VERY poor  Grin) you can unplug or disable one of your monitors to just play on one.

Ultimately the game was buggy, unfinished, unpolished and game play wise underwhelming, but I am pleased with our attempt to innovate and try something new!

I'd love to hear what you think of this concept!

Ludum Dare Page
19  Game Development / Newbie & Debugging Questions / Bitmasking with multiple tiles on: 2014-04-16 14:31:47
Just took a look at this really great article post from angryfishstudios: http://www.angryfishstudios.com/2011/04/adventures-in-bitmasking/

My question is, what is the best away to achieve this effect if I had more than 2 types of tiles that all needed to connect into eachother. Would I have to draw out every single possible combination of tiles?

Thanks!
20  Game Development / Newbie & Debugging Questions / Re: New book : Fundamental 2D Game Programming With Java on: 2014-04-15 16:38:00
Would be interested to take a look in this one. Look a bit on the expensive side for me at the moment though :S

By the looks of the preview it uses the default Java2D library but all it boasts in its description is :

Quote
application programming, full-screen games, input handling, matrix transformations, basic physics, intersection testing, collision detection, and much more

Unless the 'much more' really is much more, this doesn't really seem all that worth it. These are the kind of relatively basic things you can find and probably learn more about from internet tutorials and forums
21  Games Center / WIP games, tools & toy projects / Re: Square World on: 2014-02-21 21:06:07
No it is not his code. I just learn how to create a game like that and i create my own. The texture of character is from his tutorial but in version 0.2.0 i will change it

Sounds a bit suspicious if you ask me, you should really just make your own art assets, I mean, these aren't exactly that hard to make o0
22  Game Development / Newbie & Debugging Questions / Re: Random Sprites Showing on: 2014-02-19 12:06:49
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public class User {

    private Code code;

    public static Code getCode() {
        return code;
    }

    public static void main(String[] args) {
        User gibbo3771 = new User();
        System.out.println(gibbo3771.getCode().toString())
    }
}

I get a nullpointerexception.  Emo

Ontop of what trollwarrior suggested, you never actually instantiate the code variable, it should look more like this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public class User {

    private Code code = new Code();

    public static Code getCode() {
        return code;
    }

    public static void main(String[] args) {
        User gibbo3771 = new User();
        System.out.println(gibbo3771.getCode().toString())
    }
}
23  Game Development / Newbie & Debugging Questions / Re: Trying to set up a class hierarchy on: 2014-02-18 11:44:21
Maybe try using an init() method to instantiate those variables instead of the constructor like this :

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
public class Player extends Entity {
   Texture texture;
   FixtureDef fixtureDef;
   BodyDef bodyDef;
   CircleShape shape;

   public Player(SpriteBatch spriteBatch, World world, float WORLD_TO_BOX, float BOX_TO_WORLD) {
      super();
      //Planned to define texture, fixtureDef, bodyDef and shape and set their attributes here
      super.init(texture, spriteBatch, world, fixtureDef, bodyDef, shape, WORLD_TO_BOX,
            BOX_TO_WORLD);
      // TODO Auto-generated constructor stub
   }

}
24  Game Development / Newbie & Debugging Questions / Re: 2D layering in OpenGL on: 2014-02-13 21:23:45
I suppose you're right, 100 fps is more than enough to run a game on. I'm just concerned about adding more entities to the screen and that slowing down the game even further
25  Game Development / Newbie & Debugging Questions / Re: 2D layering in OpenGL on: 2014-02-13 21:05:34
Realistically speaking, 50 - 30 fps is not really anywhere near good enough for a 2d game  Undecided
26  Game Development / Newbie & Debugging Questions / Re: 2D layering in OpenGL on: 2014-02-13 19:58:17
I think however, although 100 fps is manageable at the moment, in future, the efficiency of that rendering won't be good enough
27  Game Development / Newbie & Debugging Questions / Re: [Math/Geometry/Mesh-Generation] Planetary Surface on: 2014-02-13 18:46:32
So you're struggling to map the points on your noise graph to a 3D mesh?
28  Game Development / Newbie & Debugging Questions / Re: [LIBGDX] skinning a cube with multiple textures on: 2014-02-13 18:43:32
Could we get a full view of your code?
29  Game Development / Newbie & Debugging Questions / Re: 2D layering in OpenGL on: 2014-02-13 18:35:31
I appreciate creating 10 layers would be easy but...

As I mentioned, I need to render each individual body part of each entity on the correct layer which means with a large amounts of entities i need a more dynamic range of layers so instead of having layers 1, 2, 3, 4 etc. I have an each individual z value for each object
30  Game Development / Newbie & Debugging Questions / Re: [Math/Geometry/Mesh-Generation] Planetary Surface on: 2014-02-13 18:33:02
I don't quite understand what you're saying here. Why do you need to generate points in between the 4 edge points in the first place?
Pages: [1] 2 3 ... 5
 
DarkCart (19 views)
2016-05-29 02:30:33

Hydroque (36 views)
2016-05-26 14:45:46

Mac70 (47 views)
2016-05-24 21:16:33

theagentd (52 views)
2016-05-14 18:38:35

theagentd (85 views)
2016-05-10 22:37:41

theagentd (91 views)
2016-05-10 22:33:46

IanParcs (119 views)
2016-04-18 14:18:53

KaiHH (115 views)
2016-04-18 08:35:41

KaiHH (135 views)
2016-04-15 12:43:58

theagentd (141 views)
2016-04-14 02:16:17
FPS Camera Tutorial
by Hydroque
2016-05-22 05:40:58

Website offering 3D Models specifically for games for free
by vusman
2016-05-18 17:23:09

Website offering 3D Models specifically for games for free
by vusman
2016-05-09 08:50:56

Website offering 3D Models specifically for games for free
by vusman
2016-05-06 11:10:21

Website offering 3D Models specifically for games for free
by vusman
2016-04-29 12:56:17

List of Learning Resources
by SilverTiger
2016-02-05 09:39:47

List of Learning Resources
by SilverTiger
2016-02-05 09:38:38

List of Learning Resources
by SilverTiger
2016-02-05 09:35:50
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!