Featured games (78)
games approved by the League of Dukes
Games in Showcase (426)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
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 ... 21
1  Game Development / Performance Tuning / Re: Taming Java GC to prevent stutter, an in-depth post on memory management on: 2014-04-23 14:19:23
I know the rule is "premature optimization is the root of all evil" but I think this post is actually quite nice and described a well-targeted (if possibly not that neccessary) optimization.

It would be nice, however, to measure improvement in terms of reduction in GC time spent, but that's pretty hard to do.
2  Game Development / Newbie & Debugging Questions / Re: Raw material in a game on: 2014-04-23 14:10:17
Cool, that seems like a nice solution as well. Good luck with it.
3  Game Development / Newbie & Debugging Questions / Re: [LibGdx] incorrect checksum for freed object on: 2014-04-23 14:09:16
That could be it, although it is a bit of a weird error for this use case.
4  Game Development / Newbie & Debugging Questions / Re: [LibGdx] incorrect checksum for freed object on: 2014-04-23 10:31:03
Some tips if you want to solve this:
- Do not dump such walls of error messages in multiple posts, it makes my mousewheel-finger hurt. You can use JGO's pastebin for that.
- Provide some code samples of what you are precisely doing

This sounds like a C or C++ error, so maybe something in the LWJGL of LibGDX natives.
5  Game Development / Newbie & Debugging Questions / Re: Raw material in a game on: 2014-04-23 09:22:20
Using some complex kind of inheritance for this is definitely not the way to go if you want to make it easily moddable.

Personally I would make a generic Material class and serialize it to/from a readable format like XML or JSON. The generic class contains all the properties that a material can have. The modder can then simply edit / create some JSON files to make new materials. E.g.

public class Material {
   public String name;
   public String iconFileName;
   public float value;
   public boolean forBuilding;

If you want to define that a Building needs Materials to be constructed you can for example make a MaterialRequirement class, e.g.:

public class MaterialRequirement {
   public String materialName;
   public float amount;

Then a Building class would (among many other things) contain a list of MaterialRequirements:
public class Building {
   public List<MaterialRequirement> materialReqs = new ArrayList<>();
   // other things

A JSON material file that a modder can edit would then look like this:
   name:         "wood"
,   iconFileName:   "images/wood-icon.png"
,   value:         2.0
,   forBuilding:   true
6  Games Center / WIP games, tools & toy projects / Re: Light TD (Open Source) on: 2014-04-23 08:30:59
Very nice, the menu and game animations are well done, and the game is pretty playable. Although at wave 3 things go overboard, haha.
7  Game Development / Shared Code / Re: [LibGDX] Queue Sound Effects on: 2014-04-23 08:27:18
Okay, thanks for the explanation, sounds useful!
8  Game Development / Game Play & Game Design / Re: Overall design strategy. on: 2014-04-23 08:25:49
Only thing I can think of is to learn the concepts behind Object Oriented Programming well. If you understand and can apply MVC, entity systems and OOP you are already ahead of most (game) developers.
9  Java Game APIs & Engines / Tools Discussion / Re: New Project: A Procedural Music API for Games on: 2014-04-23 08:23:15
not being too resource heavy is one of my requirements already, but I still have to figure out a good, testable fit requirement for it.

Perhaps defining a max processor usage would work okay as a means to measure performance (e.g. max 25% CPU usage on my laptop during game play). Theres two sides to this: the amount of performance that is left over for the game (e.g. in this example 75% of CPU time), but more importantly, avoiding peaks or stuttering in processor usage.

Do you know how game loops work? One of my favourite articles on this subject is, but there's plenty of other articles out there. Understanding this may help you define what is needed performance-wise for the generator: if peaks in processor usage make the game update code run very slowly then the player will experience this as stuttering.

Anyways, sounds like a very cool project, good luck with it!
10  Game Development / Newbie & Debugging Questions / Re: How to draw to a gameloop on: 2014-04-22 14:46:03
Some tips:
- your code formatting makes my brain hurt. Use a consitent code formatting style so others can read your code.
Eclipse has an autoformat function (alt+shift+f I think) that can help with this.
- for a good game loop see this article to get a clear grasp.
11  Java Game APIs & Engines / Tools Discussion / Re: New Project: A Procedural Music API for Games on: 2014-04-22 14:40:21
Cool idea! Some thoughts:
- performance appears to be a big issue. For most games (except some turn-based ones) having a high and constant framerate is key to success. Any kind of stuttering or hiccups breaks the player's immersion and makes the game basically fail. So procedurally generated music for games must be either fast, or generated beforehand (which would take away the possibility to adapt music to gameplay).
- for procedural music to work it must fit the experience of the game at a specific point. Modern games sometimes have different tracks (e.g. a militaristic pumped-up themed one and a more relaxed one) and switch between the two for example based on whether combat is taking place. However, this is also a very hard problem to solve: how to determine whether the player is in a situation that suits a specific musical style? This requires some kind of categorisation or model of gameplay contexts (e.g. "battle", "building", "scary", "winning", "losing") and a similar categorisation of procedurally generated musical styles. Both must be extremely formalized to be able to actually code it.

I'm definitely interested in procedural music generation. However, before I would use such a library I would need:
- good and consistent performance
- a simple model to select musical styles and a way to smoothly switch between them
- of course nice and interesting music with settings that allow a great bit of variety
12  Game Development / Shared Code / Re: [LibGDX] Queue Sound Effects on: 2014-04-22 14:20:51
How does this Queuing work? As far as I can see no queuing takes place (as in one sound plays after the other). How do you determine when a sound has finished playing?
13  Games Center / WIP games, tools & toy projects / Re: Light TD (Open Source) on: 2014-04-22 14:16:38
Good work on making a working prototype!

Some tips:
- if you want others to play your game and give feedback, make a compiled downloadable package (e.g. a zip with a runnable jar). If I have to download the code and compile it myself I usually do not bother.
- maybe you could do just a little work on the graphics. My first impression of the screenshot was that the graphics were scrambled somehow due to some bug, especially the towers. Making the towers look just a bit more like actual towers or cannons may help.

Good luck!
14  Game Development / Game Play & Game Design / Re: Overall design strategy. on: 2014-04-22 14:03:34
There's no single good way to structure your game. It depends on the type of game you are making and your personal preferences. As other suggested, the best way to learn this is by doing it. Make a couple of small games (like tetris or breakout), read up a bit on game design and things will start to fall into place.

Some good approaches to structuring game code are the mentioned Model-View Controller approach, or the entity system approach, e.g. used by Artemis. However, you will most likely notice that while these approaches are helpful, they are nearly impossible to follow strictly.

Sites like or Gamasutra also have a lot of articles on this. Learn by doing and reading.
15  Discussions / General Discussions / Game mechanic explorer on: 2014-04-22 09:00:53
Hey everyone, I just saw this nice site on hacker news: the game mechanic explorer

It's a great little site to explore some game mechanics, such as running & jumping, flocking homing missiles, and other cool stuff. Its in Javascript but it should not be a problem to convert to Java.
16  Discussions / Miscellaneous Topics / Re: What are Anti-Virus Developers Protecting us From? on: 2014-04-18 17:21:56
Maybe you guys - as developers - should consider checking whether the software you spread around is infected though Wink
17  Games Center / WIP games, tools & toy projects / Re: [libGDX] Embersol Mercenaries - Online Shooter on: 2014-04-18 12:04:08
Ok, I tried it on a different computer and now the video and the login works fine. Perhaps it was just a firewall issue. Unfortunately I'm at a different location right now so I cant look into it further. However, I think it is a problem on my side. I can play it now!

And wow, that's one heck of a game! Very good work, it's an impressive game. The art is good looking and consistent, the menus are clear and accessible, I'm impressed by how smoothly you handle networking stuff, and the action is fun.

Some suggestions:

I found the control scheme somewhat awkward, as I'm more used to:
W = move forward (in the direction of the nose of the ship)
A/D = strafe left/right
S = move backward (or slow down)
However, that's a personal preference.

The (good looking) planets have somewhat jagged edges, so maybe some kind of antialiasing may make them look a bit nice (either in a shader or just by antialiasing the edges in the graphics).

I found the shields a bit weird looking, especially when they turn all-white. Their looks would be improved I think if they would never go fully opaque.

The actual shooting may need some tuning to make it more interesting. Currently there is relatively little to choose for the player, e.g. it seems that missiles are launched with the same button as the gun. I think I'd like it more when missiles are launched seperately, so that making the decision to "launch the missiles!" becomes a bit more meaningful.

But overall good work, keep it up!
18  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Scene2D, utter tedious on: 2014-04-18 11:47:48
Yeah well in the end, Scene2D is a good library, its used by many to good effect, made by volunteers who know what they are doing. Considering that, its just not so nice to use words like "utter tedious", "tedious as hell", "that was horrible", "god annoying", "tedious and ugly library". It would be sad if a post like this would put newbies off using a good library for no good reason.
19  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Scene2D, utter tedious on: 2014-04-18 10:02:24
I'm still trying to figure out how to end up getting fonts to upscale properly (or generate at a proper resolution so that it shows nicely on the screen).

Thats an issue with font rendering and has nothing to do with Scene2D. Just generate an upscaled version of your font.
20  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Scene2D, utter tedious on: 2014-04-18 10:00:33
Except you are missing the creation and setup of tgr stage, the table, sizing both.

Them setting up the skin so that it has a font and drawables.

Neither of which are present in your code example. I suppose your UI library doesnt magically render itself or create that "list" variable out of thin air?

I felt precisely the same about pretty much any UI library I used and baked my own UI code. But after some time you really need some extra functionality like additional types of widgets, or an easy way to restyle the whole thing. Some time later you end up with an unmanageable inconsistent and buggy mess which eats up half your game development time. Then compare the homebrew solution to something like the Scene2D UI and you get a sensible comparison.
21  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Scene2D, utter tedious on: 2014-04-17 16:07:28
If you want to make a complex GUI with sliders, editable text areas, checkboxes and other stuff then homebrewing stuff just does not cut it and becomes a big waste of time. In my experience Scene2D UI is quite elegant and requires few lines of code to get going.

Also, I cant really see the complexity in Scene2D ui, it's actually very simple and is just a couple of lines more than you are using. Yeah setting up a skin is some work, but actually a lot easier than in for example TWL IMHO.
22  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Mesh won`t render. on: 2014-04-17 15:55:49
As Rayvolution suggested: try consistently formatting your code. Otherwise people will get confused looking at it. Here, I did it for you this time:

package nl.basvs.launcher.utils;

public class ShapeTerrain {
    private Mesh mesh;
    private Texture texture;
    private ShaderProgram shader;
    PolygonShape poly;
    PolygonRegion po;
    TextureRegion texreg;
    static String vertexShader = "attribute vec4 a_position;    \n"
            + "attribute vec4 a_color;\n"
            + "attribute vec2 a_texCoord0;\n" + "uniform mat4 u_worldView;\n"
            + "varying vec4 v_color;"
            + "varying vec2 v_texCoords;"
            + "void main()                  \n"
            + "{                            \n"
            + "   v_color = vec4(1, 1, 1, 1); \n"
            + "   v_texCoords = a_texCoord0; \n"
            + "   gl_Position =  u_worldView * a_position;  \n"
            + "}                            \n";
    static String fragmentShader = "#ifdef GL_ES\n"
            + "precision mediump float;\n"
            + "#endif\n"
            + "varying vec4 v_color;\n"
            + "varying vec2 v_texCoords;\n"
            + "uniform sampler2D u_texture;\n"
            + "void main()                                  \n"
            + "{                                            \n"
            + "  gl_FragColor = v_color * texture2D(u_texture, v_texCoords);\n"
            + "}";

    protected static ShaderProgram createMeshShader() {
        ShaderProgram.pedantic = false;
        ShaderProgram shader = new ShaderProgram(vertexShader, fragmentShader);
        return shader;

    public ShapeTerrain() {
        mesh = new Mesh(true, 3, 3, new VertexAttribute(Usage.Position, 3, ShaderProgram.POSITION_ATTRIBUTE),
                new VertexAttribute(Usage.Color, 4, ShaderProgram.COLOR_ATTRIBUTE), new VertexAttribute(
                        Usage.TextureCoordinates, 2, ShaderProgram.TEXCOORD_ATTRIBUTE));

        mesh.setVertices(new float[] { -5f, -5f, 0, 0.2f, 0.3f, 0.4f, 1f, 0, 1, 5f, -5f, 0, 0.1f, 0.2f, 0.1f, 1f, 1, 1,
                0, 5f, 0, 0, 0.4f, 0.5f, 0.5f, 1f, 0 });

        mesh.setIndices(new short[] { 0, 1, 2 });

        texture = new Texture(Gdx.files.internal("data/badlogic.png"));

        shader = ImmediateModeRenderer20.createDefaultShader(true, true, 0);

    public void render(SpriteBatch batch, PolygonSpriteBatch poly) {
        mesh.render(shader, GL20.GL_TRIANGLES);

A second thing: it appears like low-level OpenGL may be a bit over your head. I would suggest starting with Java2D, or a framework that does much the work for you like LibGDX.

From your code we cant see whats going on. For that we need at least the camera / projection matrix code and other render code.

Edit: and finally, "Can render the mesh.I have used the tutorial." does not really make sense. Unless you are just poor in English, try to describe things more clearly or you will not get anywhere asking for help.

Good luck!  Grin
23  Games Center / WIP games, tools & toy projects / Re: Moon Pad v0.2 on: 2014-04-17 13:40:50
Nice experiment :-)

-Recognize java language (with colors)

The word you are looking for here is "syntax highlighting".

Maybe make the moonpad find your JDK / JRE automatically (if possible) using environment variables and add a "compile" button?
24  Game Development / Newbie & Debugging Questions / Re: LWJGL - Drawing to a file. on: 2014-04-17 13:37:57
I think that using OpenGL for this would make you run into threading issues when multipl users upload a level simultaneously.

One simple way could be to create a 2-dimensional array based on the level data, convert it to a BufferedImage and then save it to disk with ImageIO.write(...).

edit: maybe instead of a screenshot store a minimap-like-picture?
25  Games Center / WIP games, tools & toy projects / Re: [libGDX] Embersol Mercenaries - Online Shooter on: 2014-04-17 08:39:31
Looks good!

The movies on the website dont play for me (Win 7 laptop, tried FireFox 17 and IE 11). On FireFox the movie appears to play but stays black, on IE it doesnt start at all (no error, just stays at 0:00).

The game (applet) does load smoothly for me however, which is more important Grin Nice interface, pretty good looking. Unfortunately the server seems down, as I get "Disconnected: Server Disconnected".
26  Game Development / Newbie & Debugging Questions / Re: LibGDX and Getting Pixels From Sprite on: 2014-04-16 15:52:57
It's because he wants to do it like notch did it in minicraft. And notch didn't tint the textures in minicraft Wink

In case the OP wants to know how Notch did it, here's the code:

Its in Java2D, and its also 100% officially silly to try to do this in OpenGL and LibGDX. It is extremely slow, error-prone, terribly overcomplicated and pretty much worst practice (unless you enjoy making life difficult for yourself). Much better do someting like:
batch.draw(bodyTexture, ...
batch.draw(pantsTexture, ...

Easy peasy.
27  Game Development / Newbie & Debugging Questions / Re: [Level Editor] A few questions on concepts I'm not sure of. on: 2014-04-16 11:46:52
For point 4 I would probably use a BufferedImage to contain the white canvas, then draw the tiles (also BufferedImages) to that canvas (perhaps do continuously rendering loop or just whenever things change).

For your formula:
y * imageWidth + x = pixel located at (x, y)

Do you really need to use this formula? Sounds like you store things in a 1D-array or something. However, it seems ot me that using a BufferedImage or a 2D array would be much easier.
28  Game Development / Newbie & Debugging Questions / Re: LibGDX and Getting Pixels From Sprite on: 2014-04-16 11:36:47
He doesn't want tinting. He wants to replace certain gray colors with custom colors in code.

Where precisely do you read that he "does not want tinting"? I'm curious.

I dont see how my solution does not give him what he wants. You can flip and scale a tinted texture to your heart's content.
29  Game Development / Newbie & Debugging Questions / Re: Scene 2d - Camera resize Issue on: 2014-04-16 11:34:10
Some suggestions:

You should set the camera's projection matrix at the start of each update. Otherwise changes in the camera wont be reflected in the rendering.

I'm not sure that changing the viewport wirdth and height directly works well as I'm not sure that this will update the projection matrix correctly:
      GameStage.getCamera().viewportWidth =;
      GameStage.getCamera().viewportHeight =;

There's a method that actually updates the matrix:
GameStage.getCamera().setToOrtho(false, width, height);

30  Discussions / General Discussions / Re: What genre/artists do you listen to while coding? on: 2014-04-16 11:24:21

As in, real birds, outside.

Other than that I like silence.
Pages: [1] 2 3 ... 21

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

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (72 views)
2014-04-15 18:08:23

BurntPizza (68 views)
2014-04-15 03:46:01

UprightPath (79 views)
2014-04-14 17:39:50

UprightPath (65 views)
2014-04-14 17:35:47

Porlus (80 views)
2014-04-14 15:48:38

tom_mai78101 (104 views)
2014-04-10 04:04:31

BurntPizza (164 views)
2014-04-08 23:06:04

tom_mai78101 (260 views)
2014-04-05 13:34:39

trollwarrior1 (210 views)
2014-04-04 12:06:45

CJLetsGame (220 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22: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!