Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (684)
Games in Android Showcase (196)
games submitted by our members
Games in WIP (752)
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 ... 45
1  Discussions / General Discussions / Re: Cross build apps for IOS in Android Studio on: 2016-07-27 20:17:23
Thanks for sharing, I will be checking this out.
2  Game Development / Newbie & Debugging Questions / Re: LibGDX + Ashley, Entity is stationary (Mostly) on: 2016-07-17 11:26:50
Check where your velocityX is modified. Also make sure that your deltaTime is correct.
3  Game Development / Newbie & Debugging Questions / Re: [LibGdx] Best way to store/get textures for rendering ? on: 2016-07-07 07:29:59
It depends on how many objects there will be in your level. If you will only have < 500 objects, I doubt that searching Hashmap would give you any kind of performance problems. The much more probably bottleneck will be OpenGL rendering.

You don't need to extend Object, all java classes automatically extend Object without you declaring it.
4  Game Development / Shared Code / Re: XM File Formats on: 2016-07-04 06:35:31
This is getting out of hand.. Seriously. At first I though OP was just doing practice, but it turns out he is serious about his 'file format'.

There is no need to replace PNG with uncompressed file format. The file size difference is huge. Your files will go up on average 4 times in size. The whole reason PNG is used is because it is the fastest lossless compression format with good compression ratio that also supports multiple pixel formats. Not to mention that since it has been a standard for many years now it is supported on many platforms and all the tools export / import PNG.

You haven't invented anything. In fact, you took a step backwards and now you are trying to prove that the correct way to make a wheel is to make it a square. If you are really concerned about PNG decode time, I have a much better proposal for you. Use regular PNG like everybody else. Then, during runtime, after you read your PNG, save it's uncompressed data in a 'cache' of uncompressed images. Next time when you need to load that image, look up the cache and see if there is uncompressed image there and use that. This method would work really well as you don't need to write importers/exporters anywhere, artists are happy and you are happy since you only need to decompressed each PNG file once.

Then there is the problem of where would you even want to use uncompressed data? PNG decompression on desktop computers is blazingly fast. The only place one would might want uncompressed image data is on mobile devices. The problem is that on those devices disk space is very sparse.

--EDIT
I wrote that compression ratio is 4 on average, but it actually depends on what kind of images you have. It was 4 for a game that I have. The compression ratio could be much smaller or much much bigger depending on the image that you have.
5  Games Center / WIP games, tools & toy projects / Re: Drift Team on: 2016-06-19 05:20:18
Awesome game. Some sounds would be nice though.
6  Java Game APIs & Engines / OpenGL Development / Re: Texture Loading on: 2016-06-13 11:32:13
I'm sorry, I still didn't get it. How does 2 byte header = 2 shorts? 1 short is 2 bytes.

If you split color channel in half (half byte) you will not get 128 colors. You will 16 colors.
1 byte = 8bits
1^8=256
1^4=16 (half byte)

EDIT-
You can compensate for reduced color channel by dithering images.
7  Java Game APIs & Engines / OpenGL Development / Re: Texture Loading on: 2016-06-13 07:01:53
So your image format is essentially just raw data without any compression? I assume you understand that 2 bytes header can give you only 256x256 max textures.
8  Discussions / Miscellaneous Topics / glDrawElements in mobile devices on: 2016-05-15 10:50:52
I'm currently testing terminated due to memory pressure on iOS and it seems simply having huge amount of textures loaded into memory doesn't cause memory termination. However, if you try to use all of those textures, then the app gets terminated. I guess this is OpenGL related question. I'm guessing that for some reason using glDrawElements spikes memory usage which causes my app to terminate. Does anybody have any experience with this?
9  Discussions / General Discussions / Re: XHON: eXtensible Human Object Notation on: 2016-05-14 20:24:59
The reason .json is so bad when editing it by hand is because it was not designed for that purpose. It was meant to be used to pass data around applications. The data in .json is supposed to be program generated, not hand written.

Are you going to have an example implementation with some code examples? It would be nice to have code examples of situations where certain aspects of the language are useful.
10  Games Center / WIP games, tools & toy projects / Re: FPS Engine on: 2016-05-04 19:04:53
Cool demo.

Though I have a few bitchy complaints. Being a CS player (1.5k hours) the sensitivity feels way to high and having no spray pattern feels awkward. The first time I started spraying, I started to correct for UMP spray pattern until I realized that there is no spray pattern. I guess that's a compliment to how good the gun model looks.
11  Game Development / Newbie & Debugging Questions / Re: Plant growth on: 2016-04-18 09:17:13
I never used Events class before, could you give an example that has for example 2-3 events implemented for different game objects? Would you use a single instance of Events, or would each object need to have a separate Events instance?

My complaint with your method is that using a decremented/incremented timestamp has a big drawback, which is that it must be advance each game tick. This might not be a problem for a small game, but if your game grows, you might start getting performance problems on certain platforms (mobile for example) if you update thousands of game objects each game tick, when you could only update the ones that are visible on screen. There is another drawback, which is that when you serialise the game object, it will be different each time, because it changes with each game tick.
12  Game Development / Newbie & Debugging Questions / Re: Plant growth on: 2016-04-18 09:04:53
I'd not use actual points in calendar/wallclock time (which could be tampered with when adjusting the local system clock), but instead use time intervals which you increment/decrement in delta steps with your game loop ticks.
So basically this means when the seed is planted you set some "timeToGrow" to 'D' where D is your interval in some time unit.
Then with every tick of your game loop you get the delta time interval elapsed since the last tick (via the monotonic clock System.nanoTime()) and decrement the timeToGrow by that amount (scaled to the appropriate time unit). Once timeToGrow is equal to or smaller than zero, you start to grow your plant.
This also survives savegames: When you want to store and restore the state of your game from some persistent storage without relying on the system's clock (for example when you submit your savegame to another person), you would just store and restore that 'timeToGrow' along with your other necessary state.

That is a bad idea. Don't ever use incremented/decremented timestamp if it will need to be saved/loaded later. The idea that the author had is much better than the one you suggested. My only suggestion would be to have 'gameTime' variable, which is basically like the current time of the device, but you can choose when to advance 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  
class Game
{
   public static float Time;

   public void update(float deltaTime) {
      if (!notPaused) {
         // this way its possible to control how the time flows
         // throughout the game. For example, if the game is currently
         // paused or something, you can choose not to advance the game.
         Time += deltaTime;
      }

      // .. update plant logic and stuff later
   }
}

class Plant
{
   private float endTime;
   public void update() {
      if (Game.Time >= endTime) {
         // plant is grown!
      }
   }

   public void startGrowing() {
      int growthTime = 100; // 100 seconds
      endTime = Game.time + growthTime;
   }
}
13  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java Library written IN Java on: 2016-03-22 20:36:17
Writing custom renderers just for fun is cool, you just need to realize that you only do it for fun and it will not be usable in any real world scenarios.

Actually, there is a good use for software rendering: Occlusion Culling by Software Depth Testing.

Draw a bunch of occlusion bounding boxes with a software renderer into a depthbuffer, then check with another pass if the bounding boxes of any object are hidden by the pixels in the software depthbuffer. Its one of the fastest ways to do occlusion culling; the company Umbra is selling a library that uses this technique.

Someone should write a software renderer for occlusion culling in java...

This is a very specific case. I meant that writing an entire API like OpenGL purely in Java has no real world applications.
14  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java Library written IN Java on: 2016-03-21 18:47:02
Writing custom renderers just for fun is cool, you just need to realize that you only do it for fun and it will not be usable in any real world scenarios.
15  Game Development / Newbie & Debugging Questions / Re: Nothing written to depth buffer on: 2016-03-06 09:31:20
FINALLY found the problem.

SpriteBatch.begin() call glDepthMask(false) which in turn disables writing to depth buffer.

If I call glDepthMask(true) after SpriteBatch.begin(), everything works fine!!

Yay!  Grin
16  Game Development / Newbie & Debugging Questions / Nothing written to depth buffer on: 2016-03-05 20:59:29
Trying to implement depth testing for 2d isometric game. I have this sample, and it doesn't seem that depth values are written to the depth buffer.

The effect I'm trying to achieve is when second.png is drawn on top of first.png, only red is displayed on screen.
But what I get is that second.png is drawn normally and green part is visible.

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  
   private SpriteBatch mBatch;

   private Texture mSprite1;
   private Texture mSprite2;

   @Override
   public void create() {

      mBatch = new SpriteBatch();
      mBatch.setShader(new ShaderProgram(Gdx.files.internal("test.vsh"), Gdx.files.internal("test.fsh")));

      mSprite1 = new Texture("first.png");
      mSprite2 = new Texture("second.png");

      Gdx.gl20.glEnable(GL20.GL_DEPTH_TEST);
      Gdx.gl20.glDepthFunc(GL20.GL_LESS);
      Gdx.gl20.glDepthMask(true);

   }

   float mx = 0.0f;
   float my = 0.0f;

   private void tick() {
      float speed = 100.0f * Gdx.graphics.getDeltaTime();

      if (Gdx.input.isKeyPressed(Keys.A))
         mx -= speed;
      if (Gdx.input.isKeyPressed(Keys.D))
         mx += speed;
      if (Gdx.input.isKeyPressed(Keys.W))
         my += speed;
      if (Gdx.input.isKeyPressed(Keys.S))
         my -= speed;
   }

   @Override
   public void render() {

      tick();

      Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

      mBatch.begin();

      float scale = 4.0f;

      float x = Gdx.graphics.getWidth() / 2;
      float y = Gdx.graphics.getHeight() / 2;

      mBatch.draw(mSprite1, x - mSprite1.getWidth() / 2 * scale, y - mSprite1.getHeight() / 2 * scale,
            mSprite1.getWidth() * scale, mSprite1.getHeight() * scale);

      mBatch.flush();

      mBatch.draw(mSprite2, mx + x - mSprite2.getWidth() / 2 * scale, my + y - mSprite2.getHeight() / 2 * scale,
            mSprite2.getWidth() * scale, mSprite2.getHeight() * scale);

      mBatch.end();

      int width = Gdx.graphics.getWidth();
      int height = Gdx.graphics.getHeight();
      FloatBuffer buffer = BufferUtils.newFloatBuffer(width * height);
      Gdx.gl20.glReadPixels(0, 0, width, height, GL20.GL_DEPTH_COMPONENT, GL20.GL_FLOAT,
            buffer);

      for (int i = 0; i < width * height; i++) {
         float pixel = buffer.get(i);
         if (pixel != 1.0f) {
            throw new IllegalStateException("OMG IT WORKS!!");
         }
      }
     
      if (Gdx.gl20.glGetError()!=0) {
         throw new Error("OPENGL ERROR: " + Gdx.gl20.glGetError());
      }
   }


vertex shader
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
#ifdef GL_ES
precision mediump float;
#endif

attribute vec3 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord0;

uniform mat4 u_projTrans;
varying vec4 v_color;
varying vec2 v_texCoord;

void main()
{
   gl_Position = u_projTrans * vec4(a_position, 1);
   v_color = a_color * 2.0;
   v_texCoord = a_texCoord0;
}


fragment shader
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  
#ifdef GL_ES
precision mediump float;
#endif

uniform sampler2D u_texture;

varying vec4 v_color;
varying vec2 v_texCoord;

void main()
{

   vec4 texel = v_color * texture2D(u_texture, v_texCoord);

   if (texel.r > 0)
   {
      gl_FragDepth = 0.0;
   }
   else
   {
      gl_FragDepth = 0.5;
   }


   gl_FragColor = texel;
}


first.png


second.png
17  Game Development / Shared Code / Re: Java assert? on: 2015-10-12 19:32:48
Though you need to specify some flags to VM for them to work, which I haven't figured out yet Cheesy
-ea
(enable assertions)

Yes, I saw that on stackoverflow, but where do I put that if I'm using Libgdx?
18  Game Development / Shared Code / Java assert? on: 2015-10-12 19:28:40
I just found out today that java has built in assertions.

1  
2  
3  
4  
   public void triggerAssert() {
      int number = 100;
      assert number != 100;
   }


Though you need to specify some flags to VM for them to work, which I haven't figured out yet Cheesy

Would be really cool if anyone knows how to make this work in Libgdx.
19  Game Development / Newbie & Debugging Questions / Re: Any libGDX text tutorials? on: 2015-09-14 06:21:03
There are so many questions already posted in various places, that you can just probably google what you want to learn how to do, and there will already be a thread that explains how to do it, or how other people have done it.
20  Game Development / Newbie & Debugging Questions / Re: Better way to store a massive amount of variables on: 2015-09-05 06:46:03
Few hundred lines of code of getters and setters is messy? At my work there is a C++ class, and the header is like 800 lines of code, while the implementation is like 5k or even more. It is pretty much a getter setter class, but I guess you would call it whole other level. I wouldn't call it hard to maintain, because all it is one huge file and nothing more. If you actually need to add / modify something, you are only probably going to look at functions that are no more than 50 lines of code.

There is another class though which is also like 5k lines of code. That class is impossible to maintain if you happen to need to edit something that you shouldn't have. If after you edited something you start getting assserts (thank God at least the class has some of those), you can prepare to go on a long hours journey fixing code that was written assuming no one would ever again touch it. All the code is spaghetti and all the functions depend too much on each other, so in the end it seems like it is few very very big function, even though it has like 100 functions. It has all kinds of code - 2D point path to 3D point path generation, economy logic that is associated with that class and much much more that I'm not sure how to describe. Long story short is should have been long split up into many smaller classes.
21  Game Development / Newbie & Debugging Questions / Re: Grid-based entity collision issues on: 2015-09-03 06:56:20
For debug purposes, try adding a collision check after you have done all your movement code. If the unit doesn't collide before moving, but collides after moving, throw an exception or something and you will know that you made an invalid move.
22  Discussions / Miscellaneous Topics / Generating .java file before compilation during build time on: 2015-09-02 07:33:31
Right now I have 2 build targets: GooglePlay and Amazon. In the Java code, the code has some checks to see what it should do based on the build type. The problem is that each time you want to build for Amazon, you have to manually edit the source Java code to change the build type to Amazon. What would be the best way to generate a .java file during build time, before Java code is compiled? I guess I'm looking for something like Android, which generates R file, which you can access from code.
23  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-28 20:42:32
.. got surprised by how smooth the windows 7 build-in "backup and restore" feature works. \o/

Guess they had to make it work properly, because of how much everything breaks in Windows. Cheesy
24  Game Development / Newbie & Debugging Questions / Re: Game has a bunch of short pauses on: 2015-08-28 20:36:15
Maybe you could try recording these short pauses?

EDIT-
I wasn't implying that you have GC pauses, I just described what big GC pauses are caused by. Also, I'm not sure about this, but 200kb of garbage doesn't really mean anything. For all you know you might be allocating two 100kb arrays, or thousands of small objects which would be slower for GC to clean up than a couple of arrays.
25  Game Development / Newbie & Debugging Questions / Re: Game has a bunch of short pauses on: 2015-08-28 06:24:42
Big GC pauses are caused by having a huge heap and a lot of garbage objects being generated.
26  Game Development / Newbie & Debugging Questions / Re: Multiplayer game on Android on: 2015-08-27 09:17:08
I would wonder if it is OK to host a server on a mobile phone. I don't have much MP experience, but I don't think it would be a very good idea to host a server on a phone, unless it is a very small server.
27  Discussions / Jobs and Resumes / Re: [3dFoin] Zombie and August Sale - 50% off all items :D on: 2015-08-24 19:35:20
How is he able to lean backward and forward without having any ABS? Cheesy
28  Game Development / Newbie & Debugging Questions / Re: 2D-MMORPG physics engine on: 2015-08-04 16:57:41
It depends on what you need. I guess for 2D you can go and write your own physics engine, as long as it doesn't include rotations. It also depends on how you want the objects to interact. Though I doubt that you will run into performance problems on modern PCs with Box2D when only having few hundred objects. You should just try to setup a test and see how well it runs.
29  Game Development / Newbie & Debugging Questions / Re: My map load parser is taking ages on android on: 2015-07-29 10:22:34
If you are using Eclipse, there is a Trace View in DDMS Layout. Look at answer by Seppl
http://stackoverflow.com/questions/4850974/how-to-use-traceview-in-eclipse-for-android-development

It will show you how much time was spent executing parts of your code.
30  Discussions / Business and Project Management Discussions / Re: TheGreyLab Development Team Recuritment on: 2015-07-15 08:11:26
Would be nice if you could post a short demo video to show the state of the project.
Pages: [1] 2 3 ... 45
 
orrenravid (228 views)
2016-07-16 03:57:23

theagentd (298 views)
2016-07-11 14:28:54

Hydroque (384 views)
2016-07-06 05:56:57

Hydroque (537 views)
2016-07-03 08:52:54

GrandCastle (404 views)
2016-07-01 09:13:47

GrandCastle (399 views)
2016-07-01 09:09:45

CopyableCougar4 (451 views)
2016-06-25 16:56:52

Hydroque (422 views)
2016-06-22 02:17:53

SwampChicken (387 views)
2016-06-20 13:22:57

SwampChicken (306 views)
2016-06-20 13:22:49
Making a Dynamic Plugin System
by Hydroque
2016-06-25 00:13:25

Java Data structures
by BinaryMonkL
2016-06-13 21:22:09

Java Data structures
by BinaryMonkL
2016-06-13 21:20:42

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