Hi !
Featured games (87)
games approved by the League of Dukes
Games in Showcase (671)
Games in Android Showcase (194)
games submitted by our members
Games in WIP (727)
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  Java Game APIs & Engines / OpenGL Development / Re: Artifact/Tearing Problem with LibGDX on: 2013-05-11 22:33:59
Ya I was using the texture packer and it was doing that by default, but I didn't feel like splitting up all my tiles and animations into separate images. This other fix looks good enough I think.
2  Java Game APIs & Engines / OpenGL Development / Re: Artifact/Tearing Problem with LibGDX on: 2013-05-10 23:50:07
It was happening with any of my TextureRegions I found out, and yes it shimmered when the camera moved, as well as appeared in different locations. I ended up trying out this technique below and the bleeding is gone, though I tweaked the coordinates of the region.setRegion line a little bit (from .5f to .01f), and I don't understand whats happening exactly. It seems like it is just tightening up the region by a subpixel amount. Though when it was adding and subtracting .5f it was shaving of a whole pixel in most cases so my tiles had a line of transparent pixels in between each.
3  Java Game APIs & Engines / OpenGL Development / Re: Artifact/Tearing Problem with LibGDX on: 2013-05-10 06:21:52
Ya, from a cursory google search that's probably what it is, I didn't know the proper term. I'm using a 128x128 texture with 32x32 tiles, here it is:

I'm pretty sure LibGDX defaults to Filter.Nearest, but I made sure when I loaded the texture that is to be split into multiple TextureRegions, I set its filtering to Nearest. Though I'm unsure if that's the proper way to do it.
4  Java Game APIs & Engines / OpenGL Development / Artifact/Tearing Problem with LibGDX on: 2013-05-10 03:44:29

I'm currently working on a simple side-scrolling game for my software engineering class. I've been working on the graphics lately and being able to resize the screen while having the aspect ratio stay the same. Everything is working fine with the resizing, but once I begin resizing it, I get weird lines between my tiles. Here's a picture:

I checked out this thread below which seemed similar, but most of the proposed solutions did not seem to work for me.

I tried rounding the camera coordinates before sending it to the SpriteBatch but that didn't help. I'm loading the tiles from a single Texture and splitting them up into an array of TextureRegions, but the pink color of the line artifact is from a neighboring tile to the dark purple one seen here. If I change the pink tile to gray, sure enough the line artifact changes gray. I tried loading the texture with different filters but nothing worked. I feel like it must be something with the texture though because of the way its sampling the texture outside of its region.

Now that I think about it, I haven't really seen many games allow you to stretch the window to whatever size you want. Is this why perhaps? Maybe I should just have a couple different scales that are stable, to scale the resolution up by? Here is the resize method from my Game class (implementing ApplicationListener from gdx). The code is taken off a tutorial I found, I can try to find the link for it if anyone wants.

   public void resize(int width, int height) {
      float aspectRatio = (float) width / (float) height;
      float scale = 1f;
      Vector2 crop = new Vector2(0f, 0f);

      if (aspectRatio > Screen.ASPECT_RATIO) {
         scale = (float) height / (float) Screen.SCREEN_H;
         crop.x = (width - Screen.SCREEN_W * scale) / 2f;
      } else if (aspectRatio < Screen.ASPECT_RATIO) {
         scale = (float) width / (float) Screen.SCREEN_W;
         crop.y = (height - Screen.SCREEN_H * scale) / 2f;
      } else {
         scale = (float) width / (float) Screen.SCREEN_W;
      } crop.x, (int) crop.y, (int) (Screen.SCREEN_W * scale), (int) (Screen.SCREEN_H * scale));

Thanks for your help!
5  Game Development / Performance Tuning / Re: ArrayList, Hashtable, or ... for holding in-game-objects on: 2012-02-10 01:58:16
I may have just overcomplicated it a lot, but I hope you understand... xD

No, that was a beauteous metaphor.

Before all this, entities0 and entities1 referred to 2 different objects and, as theagentd explained, we simply switched the references and cleared one.

Thank you both theagentd and ra4king, I understand now!
6  Game Development / Performance Tuning / Re: ArrayList, Hashtable, or ... for holding in-game-objects on: 2012-02-09 09:27:27
The temp ArrayList is used so that you can switch the references of entities0 and entities1. Then you clear entities1 so you can re-add entities then next time the for loop is executed. It is true you could have just done "entities1 = new ArrayList<Entity>()" but why waste memory? Wink

why can't you just do this

entities0 = entities1;

wouldn't that accomplish the same thing? what am I missing here? WHY AM I SO DUMB  Huh Undecided Emo

Btw, welcome to JGO Smiley

7  Game Development / Performance Tuning / Re: ArrayList, Hashtable, or ... for holding in-game-objects on: 2012-02-09 06:50:59
May I ask someone to explain the purpose of the temp ArrayList in princec's code example? Setting entities1 = temp right before you .clear() it seems unnecessary, though I'm sure there is a reason for doing so. Is this done to help java's garbage collector?

Thank you,
Pages: [1]
IanParcs (43 views)
2016-04-18 14:18:53

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

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

theagentd (74 views)
2016-04-14 02:16:17

theagentd (88 views)
2016-04-14 02:15:43

IanParcs (102 views)
2016-04-12 03:51:16

IanParcs (45 views)
2016-04-12 03:50:03

IanParcs (42 views)
2016-04-12 03:49:54

IanParcs (37 views)
2016-04-12 03:49:52

IanParcs (47 views)
2016-04-12 03:49:52
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

Rendering resources
by Roquen
2015-11-13 14:37:59

Rendering resources
by Roquen
2015-11-13 14:36:58

Math: Resources
by Roquen
2015-10-22 07:46:10

Networking Resources
by Roquen
2015-10-16 07:12:30 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‑
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!