Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
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 ... 38
1  Games Center / WIP games, tools & toy projects / Re: BlockBasher - My first game in Java 2D. on: 2014-07-12 07:13:09
Sure. I do see the splash with the title and directions. I still don't see the score, though.

If I make the paddle move before shooting the ball, it glitches out a little. I also seems that the paddle once again can go through the sides.
It looks like you implemented what I described, however it feels weird. It may just be a too high maximum velocity, or too much velocity given when pressing a button. Smiley
2  Games Center / Showcase / Re: Tess on: 2014-07-09 22:17:35
Really awesome job! What tools were used to create this? How do the scripts work? Roll Eyes They seem compiled.
3  Games Center / WIP games, tools & toy projects / Re: BlockBasher - My first game in Java 2D. on: 2014-07-09 21:18:16
Hi! Nice game. I played it for a bit, and now I have some feedback for you. Smiley

I could not see my score throughout the game, even though the picture you posted shows it in the corner. That bummed me out a bit.
It seems that the controls offer no aim, making the ball go in the same pattern throughout the entire game. I suggest finding the ball's new direction based on where it hit on the paddle. While on the subject of the ball's direction, I noticed in your code that the ball does not posses a velocity - only a position. I think you could simplify your code by introducing a velocity vector to the ball, instead of storing this information in temporary variables in the main class. This change would also make changing the balls direction much easier. Everyone wins. Cheesy

If you do the same thing to your paddle, you could make it control very differently. Right now it's very tight, and responds with immediate effect. A velocity vector could add a heavier feel to it, making the paddle more difficult to stop, or change direction. This would make the game a bit more challenging.

Your code looks really neat, although there are some things I do not quite understand. One of these things, is the need for x2 and y2 variables. They could easily be replaced by a getter, adding only an extra calculation. I think that is worth the saved complexity.

The black background is a little bit dull, and I think it would be a shame not to generate at least something. Even a gradient would make it no much prettier. Remember bubble struggle? That game only had some gradients for backgrounds and it worked perfectly, making each level memorable.

There are tons of ways to improve a game like yours, but I think you did a good job. Your code does what you meant it to do, and it does so in a clear fashion. Good job on the game.  Smiley
4  Discussions / General Discussions / Re: Copying files with java!? on: 2014-07-07 12:24:58
Instead of specifying the path using %appdata%, you should instead try doing the following:

This will get you to C:/Users/GNecro1 in the case of Windows. From here, you can go into the AppData folder.

EDIT: Awww. I was ninja'd. Sad
5  Discussions / General Discussions / Re: What kinds of experiences does everyone here have with 3d in Java? on: 2014-07-05 20:54:00
I have used both LWJGL and LibGDX. Both were similar experiences due to both havin bindings to underlying OpenGL, except LibGDX has more features like texture loading and so on.
I found it extremely difficult to do anything productive in 3D, due to problems like the gimbal lock. That problem lead to the realisation that math like complex numbers and quaternions were needed to do the things I wanted with 3D, thus making progress difficult. Generally, I am not very experienced in 3D math at all, so this transition was extremely hard for me.
Another thing to keep in mind is that you are probably going to learn OpenGL. Transitioning into OpenGL from the simplicity of Graphics#drawImage() is also not a very easy one to make. Consider viewports, frutrums, batching calls to the GPU, FBO's, VBO's, matrix transformations. Gah.

I ended up deciding that I was better off with 2D, until my education (I'm studying math and physics) would turn in the direction of 3D vectors and complex numbers. Luckily for me, this happens in September '14. I have tried using OpenGL multiple times though, and I feel that I got a bit farther each time. So as with any new hard skill, keep trying. Tongue
6  Game Development / Performance Tuning / Re: Efficient Fog of War on: 2014-07-03 21:58:09
Have you even tried this and timed it? 10 000 tiles is almost nothing.

I have not. I will come back though. Expect necro-threading in a year or two. Tongue

One easy optimization I can spot:

Do you need to calculate the circles every time?
If it is tile based and all the circles are the same size, couldn't you store the light in an array?
A 6x6 array as you keep saying Wink

I don't need to, no. This would remove quite a few calculations. Thanks!
7  Game Development / Performance Tuning / Re: Efficient Fog of War on: 2014-07-03 20:55:29
That's nothing. You're prematurely optimizing. Test it, time it and if it's slow fix it. The only thing you should optimize right now is possibly pooling your GridPoint2 instances so you don't generate as much garbage.

The pooling is easily fixable. Thanks for the suggestion, by the way. Smiley

I know I should not prematurely optimize, although I would like a solution that scales a little bit better than this does. I know my game is not going to be able to run the levels I would like it to, if I do not fix this.

I imagine the final product to have levels the size of 512^2, or even 1024^2. I seriously doubt a 256^2-size world would be any fun to explore. This is a building game, akin to Warcraft I. That's a lot of tiles. In this world there would be actors running around. Not one or two, but 50 or 80. Each with a lighting distance of 3, that is (80 * (3*2)^2) 2880 tiles to light up. The player would then have made around 10 buildings, each taking up 4 * 6 tiles. Each of the tiles also light up the world around them, in a circle with a radius of 3. That is another 240 checks through the getCirclePoints code, checking another 8640 tiles. I don't have time for 11520 checks, even if I limit it to once every movement cycle. This means the game is just not feasible.

Even if this is not possible, I want to get as close as I can. How can this be faster? 

8  Game Development / Performance Tuning / Re: Efficient Fog of War on: 2014-07-03 13:25:50
How large area are we talking about here? How many tiles per actor? How many actors?

For the map, 256 * 256. Each actor will light up a circle of radius 3 around it, meaning 6 * 6 tiles will be checked. There are many Actors, since each tile with a building also will light up tiles.
9  Game Development / Performance Tuning / Re: Efficient Fog of War on: 2014-07-03 08:11:07
I am actually having the same problem with my game:P

But consider this:

1: Is your light changing every frame? If not you could save some time by only calculating it when it changes.
2: Do you have a performance problem with the way you're doing it? Seriously I would like to know Tongue

Alright, only frames that has updates to the fog of war will recalculate it. If this calculation proves costly, this will result in lag-spikes every time the fog of war updates.
Currently, I have no problems. However, I have not tried a real scenario with many units moving on a large map. This means I actually don't know how well this scales. It does not seem like it would, though.

I am assuming it is 2D.

You are correct!

First of all, you shouldn't need to search through every tile, you should just check the tiles being rendered on the screen.

I actually do need to update more than is shown on the screen. The fog is not merely aesthetic - I plan to use the info in AI.

you can just recheck the fog of war when an actor moves.

That's true. Thank you.

you could only update the fog of war in locations where an actor moves, instead of checking every actor within view every time it updates, you could have only the tiles around the actor to update.

I don't see how this would work, seeing as the circle of vision might overlap with other nearby actors. I cannot simply fill the circle around a dead Actor with fog, because some other entity might have shared some of that vision. I hope this makes sense.

if your using shaders, you could just send an array of vectors, and create lights around the points, with the rest of the tiles being black / darkened.

I think this still poses the same problem. I don't use shaders, but I still need to know which tiles are visible in the model.

I fixed it.
10  Game Development / Performance Tuning / Efficient Fog of War on: 2014-07-02 12:31:42

I'm implementing fog of war into my tile based game. It's chunky, meaning that a tile either has the fog, or does not have the fog.
Every frame I set all tiles to "not visible". Then, I loop through all the entities, lighting up circles of tiles around them. For the circle, I use this algorithm:
public class CircleAlgorithm {
   private ArrayList<GridPoint2> pointList = new ArrayList<GridPoint2>();
   public List<GridPoint2> getCirclePoints(int x, int y, int radius) {
      for(int j = -radius; j <= radius; j++) {
         for(int i = -radius; i <= radius; i++) {
            if(i*i+j*j <= radius*radius + radius* 0.8f) {
               pointList.add(new GridPoint2(x+i, y+j));
      return pointList;

I know it look shady, but it produces really good looking circles for its low complexity. I fear this method of having, and maintaining fog of war is not the best. Here's an overview of the task, each frame:
  • Loop through entire map, setting "not visible" on each tile.
  • Loop through all Actors, light up circle (r=3) around the Actor
  • The "lighting up" procedure loops through 6*6 tiles, for a radius 3 circle.

I would very much like some input as to how this can be improved! I ruled out only updating the changing parts (as opposed to recalculating every point every frame), because a lot of the vision from actors close to eachother overlap. Because of this, I can not simply "turn off" the circle of vision around an actor.

Maybe I am missing something.
11  Game Development / Artificial Intelligence / Re: How to implement N-Opt in Genetic Algorithm To Solve the Travelesman Problem? on: 2014-06-22 19:27:20
You're just attempting to find a path through waypoints?  If so, forget genetic.  Heck even forget shortest path.

His problem is to find the shortest path through all waypoints and back. I believe that is the minimum criteria.
12  Game Development / Game Play & Game Design / Re: Creating good game UI on: 2014-06-14 22:02:48
Check what some the UI libraries do! Swing, scene2d.ui, TWL, nifty, you name it. They are open source Smiley For drag and drop functionality, check out scene2d.ui's DragAndDrop class, as well as Target.
13  Game Development / Newbie & Debugging Questions / Re: Should I use Java Observer? on: 2014-06-11 14:47:06
I am not sure how I would apply the Command pattern in a sense that I get the same result as the Observer.

That's not what I intented to communicate at all, so that is probably why it does not make any sense. I meant that while you are having fun applying design patterns to games, the command pattern might be a good pattern to get to know. Unrelated to the issue of the thread. Roll Eyes

As it stands I simply have my CollisionHandler hold observers, which are the classes that handle sound, animation and scoring. Then when a certain collision happens, notify everything it just happened.

Oh. I understood that you were going to notify a PhysicsHandler of some description, that would then take care of the physics part of your game. I would advise against using an Observer to handle any kind of physics.
14  Game Development / Newbie & Debugging Questions / Re: Should I use Java Observer? on: 2014-06-11 14:08:52
I see no problem with the Observer pattern in this instance. I use it my own games to notify the underlying systems such as sound, music and statistics logging.

I do not know if it is a good idea to let the physics depend on entities being Observable though, because in order for the entities to register the state change they have to perform some physics calculation. I fear that this might lead to having half of the physics code stuck inside an Observable, and the other half stuck inside an Observer, and I am not sure that is an ideal situation.

I suggest (for the physics only) that you update the model from outside the model. Still, make it Observable for the things not directly related to it, but for core functionality like the physics in a pong game, I really would not do it.

Side note: If you are having fun with design patterns consider the Command pattern for your simple games. I know it is a little bit of a hassle, but it allows for great replay-functionality as well as aids AI development.

Side note two: Have you seen this excellent free e-book?
15  Game Development / Shared Code / Re: Scene2D replacement for Window on: 2014-06-11 11:40:59
Window was one of the first widgets in scene2d.ui and was built in a simple way. scene2d.ui has evolved a lot since then and Window is probably overdue for a rewrite. It shouldn't be too hard to write your own, as you found. When building an app with scene2d.ui, don't hesitate to build widgets specifically for your application.

I would be extremely grateful for an "official" rewrite of the Window, as I did run into some design problems with the one I threw together. Especially since I could not make the vanilla Window work in a neat fashion to save my life. Sorry.  Sad
I would request pushing this to the git, only the quality of this code is not so good. I would have loved to override Table#add() and Table#row(), among a few other hacky odd things. Eh. Roll Eyes

Anyway, I shared this so that people have the option to save that development time should they be unhappy with the current Window. Suggestions as to how to improve this code is very welcome.
16  Discussions / Miscellaneous Topics / Re: [Girls] How to completely block them from our lives? on: 2014-06-10 20:31:44
You do not have to put up with people you do not like in your freetime. It is your time - do what you want to do.
That said, girls can be just as cool as guys. My girlfriend likes programming, and we play games together. They exist. Go find her.

Alternatively, if you like the company of yourself there is nothing wrong in wanting just that. I like being alone, and I am sure I am not the only one in this thread feeling this way.
17  Game Development / Shared Code / Scene2D replacement for Window on: 2014-06-10 20:05:50
I was very unhappy with how Window works in scene2d.ui. I think it was purposefully made without any dependency on the other Widgets, however that decision makes the window difficult to use and extend.

Here is the exact problem I had with Window, if you have not tried it.
The title and side-buttons easily end up behind the content in the Window, and the Window can be dragged even when clicking buttons inside the content area.

So I made a version of it where only the top of the window can be dragged, and the elements behave according to table-layout. The title is no longer an awkwardly rendered BitmapFontCache, but a Label.

Here's the code (Frame is the interesting one):
MovableTable on PasteBin
Frame on PasteBin

Here is a demo of the following code for the Window in scene2d.ui:
private void createAndShowGUI(Stage stage) {
      window = new Window("Jeg er et vindue",app.getSkin());
      ImageButton close = new ImageButton(app.getSkin(), "closeDialog");
      TextButton textButton;
      for (int i = 0; i < 25; i++) {
         textButton = new TextButton(Integer.toString(i), app.getSkin());
         if ((i + 1) % 5 == 0) {

Here is a demo of the Frame (the so-called improvement):
private void createAndShowGUI(Stage stage) {
      window = new Frame("Jeg er et vindue",app.getSkin());
      TextButton textButton;
      for (int i = 0; i < 25; i++) {
         textButton = new TextButton(Integer.toString(i), app.getSkin());
         if ((i + 1) % 5 == 0) {

Constructive criticism is VERY welcome!!

I am quite unhappy with the way dragging was limited to just the top of the Frame, but I was out of ideas. I am also quite unhappy with the fact that Window requires both ImageButtonStyle, and LabelStyle as well as MovableTableStyle.
18  Games Center / WIP games, tools & toy projects / Re: Zombie Nauts [0.1.0] on: 2014-06-04 21:50:22
One of the Vlambeer guys once said that if you're making a 2D shooter, you should make the bullets as big as your chest.

He said a a lot of good things about making action games.

<a href=";hl=en_US&amp;start=" target="_blank">;hl=en_US&amp;start=</a>
19  Game Development / Networking & Multiplayer / Re: Client threads in a thread-per-client online game on: 2014-06-02 09:30:39
Since I'm having trouble with Threads using blocking IO with Swing, I'm jumping to LibGDX with Kryonet. I have one question however.

Is a single thread enough for both the clients networking and it's UI updates? I know this is not possible with blocking IO, but is Kryonet sufficiently fast for my framerate not to drop dramatically?
20  Game Development / Networking & Multiplayer / Re: Client threads in a thread-per-client online game on: 2014-05-31 03:57:54
I don't have a real answer for you, but I will say that you will save yourself a lot of time and hair if you use a working third party solution like Kryonet.

Thanks for suggestion, but I already have used KryoNet once before. I would like to try using the low-level Sockets and get a feeling for what is going on under the hood.

21  Game Development / Networking & Multiplayer / Client threads in a thread-per-client online game on: 2014-05-31 03:48:15
I heard the old paradigm is the new thing, so I abandoned NIO for now.

That is the best practise for Threads on the client, when using standard java Sockets? One thread for UI, and one for networking? Should I just reference the networking Thread in the UI-instance?

How would they communicate? Adding packets to a thread-safe queue for sending to the server, and then looping checking if there is something to be read from the InputStream? Is it okay to have both input and output on the same thread?

How would this networking thread work? I can't just loop (apparently) because reading from the inputstream will block.

So how is this done? Examples and pseudocode are appriciated Smiley
22  Game Development / Newbie & Debugging Questions / Re: How do you guys name builds, betas, etc. on: 2014-03-01 10:44:19
If you simply count, it's really easy to auto-update the version number from inside your build-script. Tongue
23  Discussions / General Discussions / Re: GPU acceleration on: 2014-03-01 10:16:17
I don't get it. How is this different from what our bindings to OpenCL/OpenAL/OpenGL offers?
24  Discussions / General Discussions / Re: Considering Java for game development, looking for brains to pick on: 2014-01-21 09:21:16
Why do you want to use Java instead of PHP? If it's for server communications, I find that PHP and Java can easily talk to eachother.

I find that it's just easier and cheaper to find shared hosting with PHP, than Java.
25  Game Development / Game Mechanics / Re: Loading and storing card images on: 2014-01-21 08:16:24
Starting with the assumption that "the game will contain too many cards to load into ram at once" might be a bad idea.
How big is a single card texture, in terms of memory usage?

Are you storing entire cards, or just the artwork? For less ram usage, you can load in just the artwork and the text by itself, and render the assembled cards.
26  Games Center / Showcase / Re: Desktop Bob on: 2014-01-20 11:27:05
How does this.... work? I mean... java?
27  Game Development / Game Mechanics / Re: Rotate camera around origin problem on: 2014-01-20 07:16:06
Thanks for the help guys!

The next section is about upward/downward rotation only. The vector to rotate about changes, because I'm also rotating around the y-axis (poiting upwards).

Currently, I'm finding the vector to rotate about, by taking the taking the x/z coords of the camera position, switching them around and negating the new x-coord.
This is to find the perpendicular vector to the camera position, in 2D space (the y-axis points upwards).

I imagine the problem arises when trying to define this perpendicular vector, when both the x-coord and z-coord are both zero (the case where the camera is directly above or below the origin). I think thats the reason it doesn't help to use the vector "as" a quaternion, because the vector will still never be assembled correctly.

Now, I think my problem comes down to this: How can I find this vector in a reliable way? A way that doesn't break in specific cases. Tongue
28  Game Development / Game Mechanics / Re: Rotate camera around origin problem on: 2014-01-19 15:12:09
I don't know how to implement this, then. I'd still do it the way I showed you, and that doesn't really work when I run it. Googling did nothing, as it seems I'm currently doing it correctly. Or maybe I can't clearly see what they are doing differently.
I don't know how I would implement your modification either.

Can you post some pseudocode, or be more specific about how an arcball is different from what I'm currently doing, or what I am doing wrong? Smiley
29  Game Development / Game Mechanics / Re: Rotate camera around origin problem on: 2014-01-19 14:25:05
I'd say: arcball.  It's a nice start.  I like to modify it so that when you click-and-drag outside of the invisible sphere that camera rotates about the vector into the screen.  The combo makes it really easy to look at something in an arbitrary orientation.

I'm quite sure arcball is not what I am looking for. I find it very hard to control what I'm looking at, with that solution.

Is there anything wrong with the code I posted? Am I doing something wrong with the quaternions? It was a shot in the dark for me, using them, so I can't tell if I'm doing something horribly wrong.

EDIT: I just found out my implementation has the same annoying thing as arcball, where the whole scene is tilted and it's impossible to adjust this with the mouse. The gimbal lock also persists. I'm all ears about how to implement the camera without the silly gimbal lock.

30  Game Development / Game Mechanics / Re: Rotate camera around origin problem on: 2014-01-19 09:57:32
You can't get gimbal lock with quaternions...describe what camera control you're trying to implement.

There's an invisible sphere around the origin, on which the camera can move. The camera will always point to the center of the sphere (the origin). This creates the effect of rotating the actual world.

The reason I need this behavior, is that I need to be able to look at a model in the origin, from any angle.
Pages: [1] 2 3 ... 38

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

TehJavaDev (12 views)
2014-08-28 18:26:30

CopyableCougar4 (24 views)
2014-08-22 19:31:30

atombrot (37 views)
2014-08-19 09:29:53

Tekkerue (30 views)
2014-08-16 06:45:27

Tekkerue (29 views)
2014-08-16 06:22:17

Tekkerue (18 views)
2014-08-16 06:20:21

Tekkerue (27 views)
2014-08-16 06:12:11

Rayexar (65 views)
2014-08-11 02:49:23

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (33 views)
2014-08-08 02:01:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08 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!