Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
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 ... 42
1  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-12-20 09:47:31
I do padding in all the sides. Also, the texture size is limited to 512x512, I create texture pages to solve the issue.
2  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-12-20 09:14:27
I'm guessing I just need more padding?

Yes you need more padding, but do not fix any amount of padding. I'm using the maximum advance width of the font as the padding value.
3  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-12-20 03:57:45
Just tested Cursive, and Script fonts to test TrueTypeFont's rendering, overhanging glyphs are now completely supported!



Here's the link to the font I used: =10&l[]=1]http://www.dafont.com/freebooter-script.font?l[]=10&l[]=1
4  Games Center / WIP games, tools & toy projects / Re: SilenceEngine - A 2D/3D Game Engine on: 2014-12-19 12:57:45
This is just a small update, but a big one actually. SilenceEngine now supports overhanging glyphs in TrueTypeFont.



This update also fixed the issue of texture blending that occured due to the usage of depth testing in OrthoCam.
5  Discussions / Miscellaneous Topics / Re: Change My JGO Name on: 2014-12-19 12:30:23
Who cares for that? My channel URL is https://youtube.com/user/sriharshat2p but the name is Sri Harsha Chilakapati. Nobody has time to check your identity in the real world, they just really see the content.
6  Game Development / Newbie & Debugging Questions / Re: Rotation Problem! on: 2014-12-19 12:18:14
After drawing the things, you have to rotate it back I think. Try adding
g.rotate(-0.01);
after your done.
7  Discussions / Miscellaneous Topics / Re: Should i learn lwjgl instead of java2D on: 2014-12-18 17:00:06
Okay, there seems to be a various declarations here that are misleading, I'd like clear them up. First of all, OpenGL is a software interface for Graphics cards (GPUs), and is implemented in the driver level and hence it can't be ported. The same is with the case of OpenAL and OpenCL. These are C APIs and cannot be directly called from Java or other JVM languages.

This is where LWJGL comes into the scene, it generates bindings from Java to those C APIs using JNI, and provides you a way of using those APIs from Java. That is why it is called Light Weight, all it does is mostly in the low level. This is what LWJGL is.

Now, for the matter of which one to use, it depends on your background and what you are aiming to do. LWJGL, despite of having Game Library in it's name, doesn't provide the utilities for making games, it only wraps up the toolkits that you need for graphics, sounds etc., and leaves you to do whatever you want. But to do so in OpenGL, you must learn how to render, textures, how they work and so.. A lot of work if you just want to make a game.

LibGDX considers it as another framework that uses LWJGL as one of its backends on Desktop. It provides you with some utilities that handles some common game related tasks like managing the game loop, providing UI library (scene2d) and other things that helps you in your game. But even here, you are required to write your own logic, your AI, collision detection and other things.

A GameEngine, in my opinion, gives you more high level approach in making your game. Suppose, if you want to make a breakout game (assume), you will just say it that you want to bounce off when you hit a brick, and it will take care of the collision detection, and it will bounce the ball for you. It will properly calculate the direction you are moving, calculates the distance between the ball and the brick, and properly adjusts the velocities so that it will bounce. This is what I aim to make with SilenceEngine, hence I call it a GameEngine and not a library.

As a side-note, it is already possible to do that bouncing in SilenceEngine. For information on how to do that, see the
GridSceneColliderTest
. All you have to do is just call the bounce method in the Entity2D class and pass it another Entity2D to bounce upon. Easy right??
8  Games Center / WIP games, tools & toy projects / Re: SilenceEngine - A 2D/3D Game Engine on: 2014-12-17 17:15:31
Hello friends, here's the update for today, the
ResourceLoader
, the way of loading resources in SilenceEngine.



One of the main features of this
ResourceLoader
is that it does not multithread loading, it loads the resources in the same thread that the game is running. And it is really simple to use too. Here's the sample code from the
ResourceLoaderTest
to get you started.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
ResourceLoader loader = ResourceLoader.getInstance();

int fontID1 = loader.defineFont("Times New Roman", TrueTypeFont.STYLE_NORMAL, 24);
int fontID2 = loader.defineFont("Comic Sans MS", TrueTypeFont.STYLE_NORMAL, 24);
int textureID = loader.defineTexture("resources/texture2.png");

loader.startLoading();

texture = loader.getTexture(textureID);
font1   = loader.getFont(fontID1);
font2   = loader.getFont(fontID2);

It basically follows a very simple three step process that you can simply integrate into any existing game skeleton. You first define the texture and/or fonts which gives you an ID for that resource and call the
startLoading
method on the loader, which starts loading the files in the current thread, displaying a progress bar to show you the progress.

Once loading has been completed, you simply assign your variables to the loaded resources using the IDs that were generated when you defined them, and the game starts playing. Once you don't need those resources, you can simply call
ResourceLoader.getInstance().dispose()
to dispose all the resources that are loaded by the loader.

You can change your logo displayed there by calling the
ResourceLoader.getInstance().setLogo("resources/logo.png")
or whatever, but it is recommended to keep the SilenceEngine logo if you want to show some love!  Roll Eyes

By the way, you can use the
defineFont()
method in two ways, it can be used to load from a face name, or from a TTF file. If you passed it a resource name, it will load from the resource, or it will load from the family name.
9  Discussions / Miscellaneous Topics / Re: What is with version 3? on: 2014-12-17 12:54:55
Ask the same when Red Game 2D Engine reaches version 3  Tongue
10  Discussions / General Discussions / Re: Weird Math.max() behaviour. Math.max(0f, Float.MIN_VALUE) is Float.MIN_VALUE?? on: 2014-12-17 03:44:23
You might be looking for the most negative number imaginable, which is Float.NEGATIVE_INFINITY. Placeholder values like that have a bad code smell, imho, but that's outside the bounds of this question.

Thanks! Using INFINITY values got it working again!
11  Discussions / General Discussions / Weird Math.max() behaviour. Math.max(0f, Float.MIN_VALUE) is Float.MIN_VALUE?? on: 2014-12-16 17:55:43
I'm trying to detect the bounds of my Polygon class, and I found a very weird bug.
Math.max(0f, Float.MIN_VALUE)
is returning
Float.MIN_VALUE
?? I found this while debugging the code in IntelliJ IDE.



That's very very much weird for me. What I did was nothing, initially I set the values of min variables to Float.MAX_VALUE and the max variables to Float.MIN_VALUE. Comparing then with a vector is returning this weird behaviour. Any pointers?

(By the way, the same code worked fine until today, I wrote that one day ago)
12  Games Center / WIP games, tools & toy projects / Re: SilenceEngine - A 2D/3D Game Engine on: 2014-12-16 10:04:21
Hello everyone, this is time to introduce
SceneCollider2D
interface and the two colliders that implement this interface. Basically in SilenceEngine, a SceneCollider is an object that takes care of collisions between entities in a scene automatically for you.

SceneCollider2D
interface specifies how a collider should be implemented for 2D entities, that is, they only check between collisions for classes that extend
Entity2D
class. As specified in the name, these colliders need the scene to check collisions in. What you basically do is this.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
// Create the scene
scene = new Scene();

... // Add entities to the scene

// Create the collider
collider = new GridSceneCollider(width, height, cellWidth, cellHeight); // OR
collider = new QuadTreeSceneCollider(width, height);

// Set the scene to the collider
collider.setScene(scene);

This is how you create the colliders. The next thing you have to do is to specify for which entities the collisions should be detected. This is done with the
register
method of the colliders like this.

1  
2  
3  
4  
collider.register(Player.class, Floor.class);
collider.register(Player.class, Coin.class );
collider.register(Player.class, Enemy.class);
collider.register(Enemy.class,  Floor.class);

The class you pass to the register must be a Entity2D or extend from it. Only for these registered classes, the collisions will be checked, that too, in the same order that you register. In the above example, the collisions will be checked for every Player with every Floor, but they will only be notified to the
collision
method in the Player.

To check for the collisions and to update the scene, do the following.

1  
2  
scene.update(delta);
collider.checkCollisions();

It's that simple! And to be notified of collisions, the entity class should override the collision method provided by the Entity2D class. This is all for now guys, stay tuned for more!
13  Games Center / Showcase / Re: [Android] Salamander and the Cat - Use your tongue to survive on: 2014-12-16 05:46:31
I think gouessej is looking for a direct download .apk file without using Google Play. Nice game btw, very interesting to play.
14  Game Development / Newbie & Debugging Questions / Re: How to force OpenGL Version? on: 2014-12-16 05:42:54
Or, you can create your own shader and pass it to the SpriteBatch constructor. This is the fixed up version.

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  
static public ShaderProgram createDefaultShader () {
   String vertexShader = "#version 330 core\n"
      + "in vec4 " + ShaderProgram.POSITION_ATTRIBUTE + ";\n" //
      + "in vec4 " + ShaderProgram.COLOR_ATTRIBUTE + ";\n" //
      + "in vec2 " + ShaderProgram.TEXCOORD_ATTRIBUTE + "0;\n" //
      + "uniform mat4 u_projTrans;\n" //
      + "out vec4 v_color;\n" //
      + "out vec2 v_texCoords;\n" //
      + "\n" //
      + "void main()\n" //
      + "{\n" //
      + "   v_color = " + ShaderProgram.COLOR_ATTRIBUTE + ";\n" //
      + "   v_color.a = v_color.a * (255.0/254.0);\n" //
      + "   v_texCoords = " + ShaderProgram.TEXCOORD_ATTRIBUTE + "0;\n" //
      + "   gl_Position =  u_projTrans * " + ShaderProgram.POSITION_ATTRIBUTE + ";\n" //
      + "}\n";
   String fragmentShader = "#version 330 core\n"
      + "#ifdef GL_ES\n" //
      + "#define LOWP lowp\n" //
      + "precision mediump float;\n" //
      + "#else\n" //
      + "#define LOWP \n" //
      + "#endif\n" //
      + "in LOWP vec4 v_color;\n" //
      + "in vec2 v_texCoords;\n" //
      + "out vec4 fragColor;\n" //
      + "uniform sampler2D u_texture;\n" //
      + "void main()\n"//
      + "{\n" //
      + "  fragColor = v_color * texture(u_texture, v_texCoords);\n" //
      + "}";

   ShaderProgram shader = new ShaderProgram(vertexShader, fragmentShader);
   if (shader.isCompiled() == false) throw new IllegalArgumentException("Error compiling shader: " + shader.getLog());
   return shader;
}

Then create the SpriteBatch as in this line.

1  
SpriteBatch spriteBatch = new SpriteBatch(1000, createDefaultShader());

This is the workaround for now. I don't know how well this works, because I've never used LibGDX myself, but it should work.
15  Game Development / Newbie & Debugging Questions / Re: How to force OpenGL Version? on: 2014-12-16 05:36:41
I've quickly gandered into the LibGDX sources, and found the default shader code. Unfortunately, the shader code is using version 110 which doesn't work with GL3. Even we can't edit the shader files unfortunately, they are stored as strings in the SpriteBatch class.

Here's the code in Line 124 of SpriteBatch.java

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  
static public ShaderProgram createDefaultShader () {
   String vertexShader = "attribute vec4 " + ShaderProgram.POSITION_ATTRIBUTE + ";\n" //
      + "attribute vec4 " + ShaderProgram.COLOR_ATTRIBUTE + ";\n" //
      + "attribute vec2 " + ShaderProgram.TEXCOORD_ATTRIBUTE + "0;\n" //
      + "uniform mat4 u_projTrans;\n" //
      + "varying vec4 v_color;\n" //
      + "varying vec2 v_texCoords;\n" //
      + "\n" //
      + "void main()\n" //
      + "{\n" //
      + "   v_color = " + ShaderProgram.COLOR_ATTRIBUTE + ";\n" //
      + "   v_color.a = v_color.a * (255.0/254.0);\n" //
      + "   v_texCoords = " + ShaderProgram.TEXCOORD_ATTRIBUTE + "0;\n" //
      + "   gl_Position =  u_projTrans * " + ShaderProgram.POSITION_ATTRIBUTE + ";\n" //
      + "}\n";
   String fragmentShader = "#ifdef GL_ES\n" //
      + "#define LOWP lowp\n" //
      + "precision mediump float;\n" //
      + "#else\n" //
      + "#define LOWP \n" //
      + "#endif\n" //
      + "varying LOWP 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" //
      + "}";

   ShaderProgram shader = new ShaderProgram(vertexShader, fragmentShader);
   if (shader.isCompiled() == false) throw new IllegalArgumentException("Error compiling shader: " + shader.getLog());
   return shader;
}

The only thing you can do now is to wait for them to edit the shader code and make it work. Until then, you have to use older versions of LibGDX.
16  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-12-15 17:39:41
Just fixed up all the crap in
PerspCam
class of SilenceEngine. It now works both as a free-flying camera and also as a look at camera. Quaternions are more interesting the more I'm looking into them.
17  Game Development / Newbie & Debugging Questions / Re: Convert decrypted file string to int on: 2014-12-15 03:28:47
Print b out, if it returns -1. Then aaa.toString(); isn't a number. Else, it's a number.

What if the string is -1?
18  Game Development / Newbie & Debugging Questions / Re: [LibGDX] Updated LibGDX, crashes when creating SpriteBatch. on: 2014-12-15 03:24:30
Edit the shader source files and add the following line in the top.

1  
#version 330

I'm not sure whether the shader source is converted to GLSL 3.30 or not.
19  Games Center / WIP games, tools & toy projects / Re: SilenceEngine - A 2D/3D Game Engine on: 2014-12-14 13:27:39
This is just another update, I've implemented 2D geometry classes
Polygon
,
Rectangle
and
Circle
in SilenceEngine. They can be rotated at any time, and can be tested for intersections. The collision detection is based on the SAT (Separating Axis Theorem). Anyway, here's a crappy gif that I recorded.

Click to Play


Unlike the similar classes, I've kept the position and vertices seperately in them, so the vertices will only regenerate when they are rotated. Next up, I'm planning to implement Scene colliders to automatically test collisions between objects in the scene.
20  Game Development / Game Mechanics / Re: Should I make a physics engine? on: 2014-12-14 09:15:32
I'm not getting you wrong, I'm just saying my opinion on it. What do you mean by jBullet is jerky? Are you talking about the conversion to Java3D's VecMath classes? If not, then I didn't quite get what you are saying.
21  Game Development / Game Mechanics / Re: Should I make a physics engine? on: 2014-12-14 09:02:47
I don't think that making a new physics engine is a good idea. Even full fledged 3D engines like JME3 are using jBullet, and more-over, making a good physics engine is not a small task to achieve, there are a number of components in a physics engine, and it will be a lot of burden.

I don't want to discourage you, but it's a raw fact. If I were you (I'm in the same position as of you, really) I will look into continuing with jBullet. If you are looking for a simple 3D collision detection and not a full fledged physics engine (Which you shouldn't call a Physics engine IMO) then you may simply go and create some Box, or Sphere or other colliders that do the work for you.

(By the way, your hat looks cool  Roll Eyes)
22  Game Development / Newbie & Debugging Questions / Re: "Wrong Component Type or Count" GLSL shader error on: 2014-12-14 04:17:24
Setup breakpoints on every GL function you call in the IDE and step through them, you will know which function is generating that error. Without knowing the function that's generating the issue, we can't help.
23  Game Development / Newbie & Debugging Questions / Re: (LibGdx)Tile placement on: 2014-12-13 17:57:34
How did you divide your map? If you divided them into rows and columns based on tile width and tile height, you have to find the nearest tile. Here's some psuedocode to get you started.

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  
// First, get the current position of the tile (in pixels)
int pTileX, pTileY;

// Then calculate the possible tile coordinates and store them in a list
Point possible = [];

// Top left
Point tTopLeft = new Point((pTileX - tileWidth/2)/cols, pTileY/rows);
if (isPossible(tTopLeft))
    possible.push(tTopLeft);

// Similarly calculate other tiles and if they are valid,
// store them in possible list
...

// Now, calculate the minimum distance point
Point tileCoord = possible[0];
float distance = abs(tileCoord.subtract(new Point(pTileX/cols, pTileY/rows)));

for (Point tile : possible)
{
    float newDist = abs(tile.subtract(new Point(pTileX/cols, pTileY/rows)));
    if (newDist < distance)
    {
        tileCoord = tile;
        distance = newDist;
    }
}

// The correct tile coordinate is in tileCoord
currentTileCoord = tileCoord;

The above is just psuedocode, and it can be largely optimized too. Hope this helps.
24  Games Center / WIP games, tools & toy projects / Re: SilenceEngine - A 2D/3D Game Engine on: 2014-12-13 12:03:30
You're right, I didn't get that thought. I've made it non-static now. Thanks for saying that to me.
25  Games Center / WIP games, tools & toy projects / Re: SilenceEngine - A 2D/3D Game Engine on: 2014-12-13 09:44:21
Why is the Scene static?

I don't see any point in having two scenes at a moment. You can simply clear the previous scene and re-initialize it with new nodes. Basically, I use the scene as a level, containing a lot of objects. In this case, I don't think making it non-static can be of any other benefit, so I made it static.
26  Games Center / WIP games, tools & toy projects / Re: SilenceEngine - A 2D/3D Game Engine on: 2014-12-13 09:31:48
Hey friends, say hello to SilenceEngine's Scene Graph!!

Click to Play


The Scene Graph is a way of managing the relationship between objects in the form of a tree, i.e., a Parent-Child relation ship. In SilenceEngine, this SceneGraph is implemented in two classes
Scene
and
SceneNode
and are part of the
com.shc.silenceengine.scene
package. The Scene class is the root node, you just make an instance of it. The
SceneNode
is just a normal class, and every object you wish to place in the scene should extend from it.

The Scene's life style starts with calling
Scene.init()
function. This clears any existing children and resets the world transform. Then you add children. This is the code from the above test.

1  
2  
3  
4  
5  
6  
7  
8  
9  
Scene scene = new Scene();
SceneObject root = new SceneObject(new Vector2(0, 0), Color.RED);
{
    root.addChild(new SceneObject(new Vector2(-0.5f, 0.5f), Color.GREEN));
    root.addChild(new SceneObject(new Vector2(0.5f, 0.5f), Color.BLUE));
    root.addChild(new SceneObject(new Vector2(0, -0.5f), Color.SILVER));
}
scene.addChild(root);
scene.init();

Though I called the first object as root, the Scene is actually the root. I also added some more nodes to the node I just created, and added that to the Scene. The
SceneObject
class is just a small class that extends the
SceneNode
which takes some parameters such as position and a color.

Then you just update the whole scene and render it using the static functions of the Scene class. The advantage of this is that if you transform the parent, then the children will also get transformed. Regarding transformations, every
SceneNode
contains two transformations,
transform
and
localTransform
. The difference is that the transform also contains the transformations of the parent, it is the one you apply to the batcher when drawing. The localTransform will only contain the transformation of that node, and is what you use to transform the node.

1  
2  
3  
4  
5  
6  
// In update code
getLocalTransform().reset().rotate(Vector3.AXIS_Z, rotation)
                           .translate(new Vector3(position.getX(), position.getY(), z));

// In render code
batcher.applyTransform(getTransform());

This is what makes the Scene Graph. If you want to remove a child node, call the
destroy()
function on it, as calling the remove directly causes the next object to lost a frame. This, combined with some fun with trigonometry, generated the above SceneTest.

That's all for now, stay tuned for more!!
27  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-12-13 06:33:32
I'm currently working on my game engine (Red Game 2D Engine [the redo])...
I guess that makes us... Competitors! *deathstare*

Although... I'm not really that far yet... I just finished making the camera... I'm going to be working on the text renderer next...

Alright, let's have a healthy competition!  Pointing  Cool
28  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-12-13 04:49:57
Added pretty basic SceneGraph to SilenceEngine.

Click to Play
29  Discussions / General Discussions / Re: Books for Game Programming on: 2014-12-12 15:12:21

Just don't follow his advice to write a VM and implement custom bytecode. That's just a waste of time and performance in Java.
30  Discussions / Miscellaneous Topics / Re: School writing project on: 2014-12-12 15:03:01
A nice story, had a lot of feel. I'm sure that you'll get a good grade for this  Wink
Pages: [1] 2 3 ... 42
 

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

The first screenshot will be displayed as a thumbnail.

rwatson462 (33 views)
2014-12-15 09:26:44

Mr.CodeIt (23 views)
2014-12-14 19:50:38

BurntPizza (51 views)
2014-12-09 22:41:13

BurntPizza (84 views)
2014-12-08 04:46:31

JscottyBieshaar (45 views)
2014-12-05 12:39:02

SHC (59 views)
2014-12-03 16:27:13

CopyableCougar4 (58 views)
2014-11-29 21:32:03

toopeicgaming1999 (123 views)
2014-11-26 15:22:04

toopeicgaming1999 (114 views)
2014-11-26 15:20:36

toopeicgaming1999 (32 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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