Java-Gaming.org Hi !
Featured games (88)
games approved by the League of Dukes
Games in Showcase (681)
Games in Android Showcase (196)
games submitted by our members
Games in WIP (744)
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 ... 13
1  Game Development / Newbie & Debugging Questions / Re: Movement interpolation - alpha ruins floating point and makes jerky moves on: 2016-06-20 21:49:24
Floating point imprecision is something you have to deal with. Instead of comparing directly with ==, use an epsilon value.

1  
if(Math.abs(b - a) < epsilon)


where epsilon is a small value like 0.000001.
2  Game Development / Newbie & Debugging Questions / Re: Bloom effect on: 2016-06-08 01:14:19
Off topic, but why the heck are you using my texture banking convention D: u_texture

You don't own anything like u_texture - that just means it's a uniform. It's a typical naming convention. Not everything you "make up" is yours.

Steve, from what you're saying the bloom isn't getting applied? Or is messing with the existing lighting? A screenshot would be useful here.
3  Games Center / WIP games, tools & toy projects / Re: SterriaLand on: 2016-05-25 22:25:33
Glad to see you took the suggestions and implemented it - it plays a lot better now! Pointing

I was working on a game that was a mix between Terraria and the Minecraft modpack Feed the Beast, which had all sorts of machinery in it, all in multiplayer. Unfortunately due to time constraints I couldn't work on it as often as I'd like so I had to abandon it. It has a TON of unused code such as an entire energy system with wires, and a lighting engine that allowed for day/night cycles. If you'd like I can get you the code for that for your own implementation, send me a PM if you're interested.
4  Games Center / WIP games, tools & toy projects / Re: SterriaLand on: 2016-05-24 22:54:48
I couldn't open the jar without running it through cmd prompt, but that might be a libgdx thing since I've experienced this too.

Placing blocks works, although I can place blocks inside of the character which should have a check to prevent that. Removing wood blocks doesn't work, but I can remove the terrain, only sometimes. The snow falling on the blocks is a nice touch, but it seems to screw up the textures by adding the grass to the side when it's already adjacent to another block. The destroy sound gets pretty annoying after a while - it sounds like someone is taking a ball-peen hammer and hitting concrete. It also plays even if I'm "destroying" air.

The UFOs are nice - I love how they drop off little cows and pigs and some monsters. But getting to them was really really slow. The walking speed was just too slow - maybe speed it up a bit.

I know this is a demo, and I'm not outright criticizing this game. I know you have some work to do so keep going.
5  Game Development / Newbie & Debugging Questions / Re: Random glitch in tiles on: 2016-05-22 22:38:12
This is called texture bleeding. Your texture region for each tile type has an area from your main texture. However, sampling of the texels can lead to "bleeding" from outside of that region.

There are some solutions to this problem. First, you can add padding to each region in your atlas, and extend the edge pixels outwards so when it samples, it will sample from the "same" texel.

If you don't feel like redoing your entire atlas, you can shrink the texture region area a tiny bit by a fraction of a pixel and it usually solves it. I have a utility class here you can freely use. Simply apply the debleeding method to each of your regions and it should be good to go. The default value is 0.25 of a pixel, and its effectiveness can vary from 0.01 to more than 0.25. Try what works for you.
6  Game Development / Newbie & Debugging Questions / Re: Adding delta value in character movements? on: 2016-05-21 22:03:51
The delta time is the time in seconds between frames. It ensures identical movement and speed regardless of how fast a computer can keep up. For example, if you'd want to move 5 units per second, you'd move 5 * deltaTime.

If X computer can run at 60 fps, then in the span of one second, it will execute 5 * 0.01667 60 times. If Y computer can run at only 10 fps, then it will execute 5 * 0.1 10 times. Both add up to 5 in the same time.
7  Games Center / WIP games, tools & toy projects / Re: SterriaLand on: 2016-05-21 15:30:28
The clouds look nicer with the rest of the game's art style now!

Have you considered having skylight penetrate blocks more than just one? It goes from grass to pitch black immediately. You would have to implement some sort of second layer of lighting reserved for skylight so it doesn't have to recalculate it often.

Pro-tip: adding width=X to the [img] tag like this: [img width=720] will force the image to be that width. This way we won't have to open the image in a new tab to fully see everything. A decent width is around 720 or less.
8  Games Center / WIP games, tools & toy projects / Re: SterriaLand on: 2016-05-18 22:38:20
Aesthetically, the game... could use some improvement on that. The blur is unnecessary and a lot of mobs like the pig are so tiny. Maybe consider making the camera viewport smaller so you can see things closer.
9  Game Development / Newbie & Debugging Questions / Re: tile map on: 2016-05-16 22:35:14
It might work because if you're rendering the clouds to the screen, and then overwriting the screen with some of your bloom stuff (you really shouldn't do this), then having the separate framebuffer will allow you to render each thing completed all at once.
10  Game Development / Newbie & Debugging Questions / Re: tile map on: 2016-05-16 14:38:58
clear screen
render background

start bloom shader
render world
end bloom shader


If that really doesn't work, you can render your clouds to another frame buffer and draw that frame buffer before the bloom stuff.
11  Game Development / Newbie & Debugging Questions / Re: [solved][libGDX] QuadTree Implementation Malfunction on: 2016-05-15 20:30:25
Funny coincidence: I'm doing a little open-world platformer-ish game right now, so AABB collision was required.

You can check out this package of my AABB stuff. The resolver will take a list of entities (from the quadtree, preferably) and spit out a collision result (you should pool these) of what happened. It doesn't have broad-phase checking as of right now, but I'll take the time right now to implement it.Just added broad-phase checking to the resolver - it makes use of the path bounds rectangle that PhysicsBody can provide.

It works quite well. I use the resolver even with blocks (I pool a bunch of PhysicsBodies for the blocks) and it works perfectly. Other moving bodies work pretty well with it and it's quite fast with the quadtree.

12  Game Development / Newbie & Debugging Questions / Re: [libGDX] QuadTree Implementation Malfunction on: 2016-05-15 20:01:09
Glad to see it works. I made a test for it anyway, which has the same colour coding as yours.



You can see that some entities are still called for checking when they're far away: that's because they don't fit directly in a node.

Since Bomberman is a grid-based game you can have a 2D grid of walls (boolean if you only need wall/not wall). However, if you don't want to really mess with having two separate collision detections (the entities and the walls) you can stick with what you've got. The quadtree definitely helps with collision due to the large number of walls, so keep using it.

Glad to help!
13  Game Development / Newbie & Debugging Questions / Re: [libGDX] QuadTree Implementation Malfunction on: 2016-05-15 19:41:02
What actually is the problem? Is it that the entities aren't being registered for detection by other entities? Maybe a different way to test it is to randomly place the entities for testing rather than have it be a grid.
14  Game Development / Newbie & Debugging Questions / Re: [libGDX] QuadTree Implementation Malfunction on: 2016-05-15 19:34:48
How are you inserting your entities into the tree? I'm doing it every logic update like this:

1  
2  
3  
4  
5  
6  
entityQuadtree.clear();
for (int i = 0; i < activeEntities.size; i++) {
   Entity e = activeEntities.get(i);

   entityQuadtree.insert(e);
}
15  Game Development / Newbie & Debugging Questions / Re: QuadTree Implementation Malfunction on: 2016-05-15 16:30:30
The top and bottom quadrant check differs if your world is Y-up or Y-down.

I actually made my own quadtree implementation after seeing this post yesterday.

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  
   /**
    * Returns index of where an element can be placed. Returns NODE_PARENT if it doesn't fit.
    * @param element
    * @return node ID (parent, NW, NE, SE, SW)
    */

   private int getIndex(E element) {
      int index = NODE_PARENT;

      final float xMidpoint = nodeBounds.x + nodeBounds.width * 0.5f;
      final float yMidpoint = nodeBounds.y + nodeBounds.height * 0.5f;

      boolean topHalf = element.getY() > yMidpoint;
      boolean bottomHalf = element.getY() + element.getHeight() < yMidpoint;
      boolean leftHalf = element.getX() + element.getWidth() < xMidpoint;
      boolean rightHalf = element.getX() > xMidpoint;

      if (leftHalf) {
         if (topHalf) {
            index = NODE_NW;
         } else if (bottomHalf) {
            index = NODE_SW;
         }
      } else if (rightHalf) {
         if (topHalf) {
            index = NODE_NE;
         } else if (bottomHalf) {
            index = NODE_SE;
         }
      }

      return index;
   }


However, that is for a Y-up system. The only change you need to make for a Y-down system would be to swap the top and bottom checks.

1  
2  
boolean topHalf = element.getY() + element.getHeight() < yMidpoint;
boolean bottomHalf = element.getY() > yMidpoint;


If you'd like to view the rest of my quadtree's code you can do it here.
16  Game Development / Newbie & Debugging Questions / Re: [SOLVED] QuadTree fails after updating each frame on: 2016-05-15 02:11:10
1  
boolean topQuadrant = r.getY() < horizontalMidpoint && r.getY() + r.getHeight() < horizontalMidpoint;

This will never yield true, unless r.getHeight() returns a negative number ofcourse.

I think this code (which was mainly copied from the tutorial) is designed for a Y-down system. The first clause isn't even needed because all you're really checking for is if the body is above the midpoint.
17  Game Development / Newbie & Debugging Questions / Re: tile map on: 2016-05-14 22:43:01
You're not passing any tiles to the shader because the shader is bound to the SpriteBatch. You would just set the batch's shader, render as normal, and unset it.

You are definitely not going to render 2000x2000 tiles at a time. If you're doing something to that extent, use a FrameBuffer.
18  Game Development / Newbie & Debugging Questions / Re: Framebuffer size on: 2016-05-13 14:42:23
When drawing to a framebuffer you have to remember that the camera is still thinking you're drawing to the actual screen - so a 96x96 buffer should have a camera with that viewport size bound to the projection matrix when drawing to that buffer.

As for transparency, you can just clear the buffer with alpha 0 (Gdx.gl.glClearColor(0, 0, 0, 0)) first and render your partially-transparent texture on the buffer.
19  Game Development / Newbie & Debugging Questions / Re: [Libgdx]How to automaticaly load assets? on: 2016-05-12 00:04:11
FileHandle's list method returns an array of FileHandles for the directory. It works on all platforms, but there is one exception: classpath type handles do not work with this as the files are treated a bit differently. You can view the last comment on this libgdx issue regarding what to do with the desktop implementation.
20  Discussions / Miscellaneous Topics / Re: Where I came from on: 2016-05-05 05:15:49
I started programming in 2009 with Roblox. I wouldn't really call it programming, but it was Lua and taught me how basic programming structure worked. I left it in around 2012 for Minecraft modding. This is where my Java adventure began. I stopped modding shortly after and started trying my own games using Slick. Eventually Slick became too slow for my needs so I moved onto LibGDX around 1.5 years ago. The first game I made was a platformer, and after that I did my biggest project: a fully multiplayer sandbox game. The development time of that was too long for my needs as it was mainly networking so I quit and tried my hand at many, many different ideas. One was a Papers, Please style game, another was an attempt at a story driven game, then a spy game, another story driven game, a vague attempt at 3D, a weak attempt at a revival of an old game, and a rhythm game. The only idea that actually came to life was the rhythm one, and it died pretty quickly as I didn't want to program in levels. Right now I'm working on a singleplayer-version of the multiplayer game and so far it's going pretty well. But I digress.

I'm currently in high school.

Tips? Keep trying. Don't give up. Don't think you're ever going to complete and master a language because you're going to learn something new constantly. Your first games will be unimpressive, but the knowledge you gain from those prototypes is invaluable.

What's necessary to know to be a "programmer"? This one changes between people. Personally, knowledge of how your code will run logically is the most important part. Concurrency has never been an issue for me (I've never figured out what wait and all those methods do). Some code theory would be good such as methods, constructors, classes, etc. Design patterns aren't that important, but some like the singleton are really helpful.

Motivation? I feel that the next project I do will always be better than the last one because I'm constantly learning. This ties into the next one.

The right learning attitude? I've explained this above: keep trying. Try new things (although I'm being a bit hypocritical about this one as I've always put off 3D for "another day").

Am I learning right now? Probably, but I do feel that I'm just repeating the same project again in a way. I do have over a year's worth of knowledge with LibGDX now and that definitely helps (especially when I look back and see that I didn't use the API Camera class and "made" my own by manually translating coordinates). I just finished up a new AABB collision detection system that's a lot faster than the old one, and now I'm looking at how to implement the UI and saving and loading. Going off on a bit of a tangent: I love data structures. I love figuring out a way to store my world, and then reading it back. Something in my mind clicks when I do that and I get it easily. I might just be weird, but I don't know.

I enjoyed these questions. Thanks for the talk!
21  Game Development / Newbie & Debugging Questions / Re: [Libgdx][Box2D] Box2D not scaling correctly on: 2016-05-03 15:10:55
I personally don't use box2d but the libgdx doc says that PolygonShape.setAsBox() takes in half-size arguments. Could it be that you're setting the box to be 1x1, but the parameters assume that's half size and make it 2x2? Your body definition code isn't included so we can't tell.
22  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-05-02 03:01:17
I managed to see the first (commercial) A380 arrive at Vancouver International Airport today! They even got an escort truck to guide it to the water jets to celebrate. You'll see it on the runway and think "oh it's not that big" and then the escort truck comes and it's the size of the engine.

Planes are big.
23  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-04-30 06:41:26
I re-created an old lighting engine of mine, this time optimizing the recursion with a stack. It was so much faster that I accidentally had it running every frame without any noticeable performance decline. Of course, the real (human) performance decline was when I originally used a queue and wondered why there were so many objects waiting...

24  Game Development / Performance Tuning / Re: API design: assigning additional values to objects on: 2016-04-25 04:09:24
HashMaps actually usually have a complexity time of O(1) (absolute worst case scenario where all the hashcodes are the same is O(n)), so they shouldn't be that slow. Just because you benchmarked it at a percentage of CPU time doesn't mean it actually took a long time - the tick itself could've been really fast.

Try using the Maps again, and benchmark it with time, not CPU percentage. It should be negligible/really really small.

But for your actual question: do you really need to go full-on overboard just to store some more data in an object? You can simply make an object such as ImageWithId and store the Image and texture ID. Don't overcomplicate it.
25  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-04-24 00:55:01
Working on a little game with some world generation, decided to visualize it as it's processing. The process shown in the video is running around 340x slower than it normally processes at so more than 5 frames of processing is shown.

gifv here

The generator basically has steps and each step can write to a frame buffer. The first two steps don't because it's biome selection and rough heightmap generation (that's the light lines in the black/white heightmap step).
26  Game Development / Newbie & Debugging Questions / Re: Brain not working - enemy jump on collision on: 2016-04-20 14:45:35
If your enemies are moving in the direction they want to go, then all you need to do is make them jump on a left/right collision. Because they're still moving, they should jump over the obstacle.
27  Game Development / Newbie & Debugging Questions / Re: Adding multi-player on: 2016-04-16 01:38:08
Based on the state of your game, I'd say it's extremely similar to ProjectMP (you can see the Github repo here) which is a fully multiplayer terraria-clone prototype.

Let me just say this: networking is a pain, and constituted a massive chunk of my time. Probably out of the six months I spent developing ProjectMP, only around a month's worth was dedicated to the game itself, the rest was all networking. I don't really want to scare you away from multiplayer as the feeling you get when you accomplishment is like no other, but it is an extremely big undertaking and will be somewhat difficult to implement along a pre-existing game. My advice is to make your current game really great and fun in singleplayer, then work your way into making a multiplayer version. I learned the hard way that the fun-factor is so much more important than multiplayer.

But if you really, really want to undertake this, I have a bit of advice:

Singleplayer is just a local version of multiplayer. Everything you do must be multiplayer compatible, and thus it will be singleplayer compatible. You will need to handle packets (KryoNet is excellent as the others have said and will serialize packets for you) such as world data (blocks), entity data (creation and deletion of entities), entity move data (where an entity has moved to), and interpolate your positions locally so you don't get jitter between packets. If you've ever tried modding Minecraft you'll see how the packet hierarchy goes.

Again, multiplayer in a sandbox game is hard. I did it for the challenge and not the fun. If you have lots of free time and want to work with debugging network-related things - go for it. Otherwise, having a solid fun singleplayer game is better than a "meh" multiplayer game, in my eyes.
28  Game Development / Newbie & Debugging Questions / Re: [LibGdx] Animation not working on: 2016-04-12 04:09:16
Saying "it doesn't work" and then putting your code here doesn't help us figure out your problem. What exactly doesn't work? What error is it throwing?

It would also help to put your code in [ code][ /code] tags for readability.

I think with how TextureAtlas work is that images with a number appended to them (or underscore number) will be grouped under the original name and have a special index. Maybe try putting that number as the second parameter instead.
for (int i = 0; i < 10; i++) {
+   walkTextureRegion = atlas.findRegion("", i);
}


whoops formatting got messed up
29  Discussions / Miscellaneous Topics / Re: The "impressiveness" of games on: 2016-04-12 01:58:37
Thanks for your responses. I'm currently deciding if I should re-do Project MP but in singleplayer so I can add features much more easily and have more of a game, compared to doing something more advanced like multiplayer. I'm probably going to go with the former because what really matters to me is if I have fun making the project, and not poking away at it to make the networking work. Pointing
30  Discussions / Miscellaneous Topics / The "impressiveness" of games on: 2016-04-11 22:48:28
Here at JGO, we love every project we see: be it small and baby steps, or something large and advanced. Personally for me, I started working on the biggest project I'd ever undertaken which was ProjectMP - a fully multiplayer terraria-like clone. The challenge there for me was to make it completely multiplayer compatible. It lasted around six months but was fully multiplayer from the start. The only downside was that the game itself was something most of us could make in a much shorter time than I did: it really only had world generation, movement, and mining. It was more of a labour of love for me, but I felt that I couldn't present it because it was so bare and lacking for the amount of time I worked on it. Adding any real features involved once again fiddling with networking which was a long process.

On the other hand, I could make what I wanted that project to be, but entirely singleplayer. Sure, it's now all cool and stuff... "but where's the multiplayer"?

This is what I feel is the difference between "technically impressive" and "fun". ProjectMP is my biggest achievement, but I feel that no one would really see it because of how similar and plain it looks. On the flip side, anyone can do a Terraria-clone with enough time, but that's because singleplayer doesn't pose much of a challenge to me.

I don't really know where I was going with this, but I often have to decide "do I want to make a lacking, technically challenging game" or "a flashy but not technically impressive game". What do you think?
Pages: [1] 2 3 ... 13
 
CopyableCougar4 (30 views)
2016-06-25 16:56:52

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

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

SwampChicken (67 views)
2016-06-20 13:22:49

SwampChicken (63 views)
2016-06-20 13:22:26

Hydroque (106 views)
2016-06-15 08:22:50

Hydroque (99 views)
2016-06-13 06:40:55

DarkCart (223 views)
2016-05-29 02:30:33

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

Mac70 (178 views)
2016-05-24 21:16:33
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!