Java-Gaming.org Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (574)
Games in Android Showcase (154)
games submitted by our members
Games in WIP (620)
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 ... 48
1  Java Game APIs & Engines / OpenGL Development / Re: [lwjgl] Multi-layer (3+) blending in 2-d (separate VBOs) on: 2015-04-20 13:39:10
Maybe you have depth testing enabled. Try disabling it, that's not necessary for 2D games.

1  
glDisable(GL_DEPTH_TEST);
2  Games Center / Showcase / RoboFight - LD32 Compo entry on: 2015-04-20 03:07:38




RoboFight


A simple one-one 2d fighting combat game, where you fight by throwing needles or stinky socks. The other robot (the dark one) is the enemy, and is controlled by the computer.

The controls are simple, use A/D to move, SPACE to jump, ESC to pause. Use RIGHT/UP arrows to shoot and the DOWN arrow to turn on the shield. You can use the F1 key to switch between Windowed and Fullscreen modes. There is a tutorial in the game which will teach you the controls.

Thanks to LD, this is my second completed game. My first one is also in LD too. Thanks a lot LD!!

This game is written using Java 8 and requires a GPU capable of OpenGL 3.3 or higher. Any decent card released after 2008 will work. There is an issue for mac users, they have to run this jar using the terminal with
java -jar RoboFight.jar -XstartOnFirstThread
without which LWJGL3 will not start.

3  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-04-19 14:32:01
Sketched a jungle background for LD:



Finally after touching it in Inkscape:



Woohya! Art is done. Polishing next.
4  Game Development / Newbie & Debugging Questions / Re: [Newbie]Need feedback on achieving smooth animation on: 2015-04-12 15:43:19
From the next time, please surround your code in [code] tags. That will help the viewers read the code because then the code will be highlighted. Coming to your question, the answer is to stop using the
Thread.sleep(long)
method in the game loop. This is because it is not guaranteed that it will sleep exactly for the requested amount of time.

Before going on further on game loops, it is better if you use Active Rendering, by using BufferStrategy, which you can create from a JFrame. This is some sample code for creating a JFrame with a BufferStrategy.

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  
// Create and show the JFrame
JFrame frame = new JFrame("My Game Window");
frame.setSize(800, 600);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);

// Create the BufferStrategy now with two back buffers
frame.createBufferStrategy(2);
BufferStrategy strategy = frame.getBufferStrategy();

// Now start the game loop
while (running)
{
    // Update the game and check for collisions
    gameUpdate();
    checkCollisions();

    // Now draw a frame
    do
    {
        do
        {
            Graphics2D g2d = (Graphics2D) strategy.getDrawGraphics();
            renderGame(g2d);
            g2d.dispose();
        }
        while (strategy.contentsRestored());
    }
    while(strategy.contentsLost());
}

The above loop is very horrible, it has no timing mechanism. There are three types of game loops, fixed-timestep, variable-timestep and hybrid ones. I prefer the first kind, fixed-timestep. Here are some articles that I prefer (read them in the same order).


The last link shows how Unity3D does it's game loop, it's very complex, so read that only once you are comfortable with your game loop.

Hope this helps.
5  Discussions / General Discussions / Re: Embed YouTube video into libGDX project on: 2015-04-12 08:32:57
You want to play a video in the game? In that case, you may want to try out the gdx-video extension. https://github.com/libgdx/gdx-video

Dunno how it works out though, I never used LibGDX myself.
6  Game Development / Newbie & Debugging Questions / Re: Camera "Tweening" on: 2015-04-10 05:33:39
What that tutorial says is called as interpolation. For this, let's assume that your camera position is a vector, and you have two cameras. The first camera is directly adjusted in the code, it doesn't tween. The second camera, is what you render your game with.

At every frame, after moving the first camera, you interpolate the second camera with the delta towards the first camera, which is the target. The interpolation formula is this:

1  
2  
3  
4  
5  
6  
7  
8  
public Vector3 lerpSelf(Vector3 target, float alpha)
{
    Vector3 temp = Vector3.REUSABLE_STACK.pop();
    scaleSelf(1f - alpha).addSelf(temp.set(target).scaleSelf(alpha));
    Vector3.REUSABLE_STACK.push(temp);

    return this;
}

The same formula is also used with the rotation. This is my lerp method on my camera. All I do is interpolate my position and the rotation.

1  
2  
3  
4  
5  
6  
7  
public PerspCam lerp(PerspCam p, float alpha)
{
    position.lerpSelf(p.position, alpha);
    rotation.lerpSelf(p.rotation, alpha);

    return this;
}

The effect is demonstrated in this GIF (5 MB).

Click to Play


Hope this helps.
7  Discussions / General Discussions / Re: Does Internet cost matter to you? on: 2015-04-08 12:48:16
Tell us once you achieved what you said. It's hard to believe what you are saying.
8  Discussions / General Discussions / Re: Which Smartphone should I choose??? on: 2015-04-08 09:55:16
The only reason I don't go with Samsung is it's TouchWiz interface. Nothing related to it's design though, it's just that it has too many features of which 99% are often I don't use at all. The second reason, is, the bloatware that Samsung phones comes pre-installed with.

I usually prefer to get a phone with stock android look, not the customized ones. With TouchWiz, it will take Samsung a longer time to switch to a newer android versions, the latest only at 4.4 KitKat. However my 1st generation Moto G is now running Android Lollipop 5.0.2

Nice to meet another Indian on JGO.
9  Discussions / General Discussions / Re: Which Smartphone should I choose??? on: 2015-04-08 09:46:34
You're from India? Which state? I'm from Andhra Pradesh.

And coming to the question, I would prefer anything but not Samsung. I don't like it's TouchWiz.
10  Game Development / Newbie & Debugging Questions / Re: [libGDX] How to draw an outline around sprite when behind another image on: 2015-04-08 08:41:06
Yeah I forgot that he only needs the occluded part of the outline to be rendered. You are right Riven.
11  Game Development / Newbie & Debugging Questions / Re: [libGDX] How to draw an outline around sprite when behind another image on: 2015-04-07 17:06:31
First create a texture with just has the same outline as the sprite. Then define a boolean variable in the class and call it background. Every frame when you are updating the entity, set that variable to false. Then in the collision detection, set it to true if it collides with any other entity. Finally when rendering, draw the sprite normally, and if the variable is true, render the outline.

There is a small caveat here, that still the outline will be in the background. To prevent that, keep the entity position and the flag in the game, and render the outline texture once you have rendered all the entities, making the outline texture be drawn after everything is rendered.
12  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-04-03 17:00:18
@Dev Crucio

Are you referring to the cone on the platform? I use cones to change the direction of the camera. This is intentional.
13  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-04-02 16:17:21
Added an earth texture in the background to Blox.



Also solved z-fighting and lighting issues now.
14  Games Center / Archived Projects / Re: SilenceEngine - A 2D/3D Game Engine on: 2015-04-01 16:18:09
Great work on this! Can't wait to see more updates.  Wink

You should be following my GitHub profile, I'm posting very less here due to the new change in the rules. Coming to the point, there have been a lot of changes since my last post. All I can say right now here, is that I'm going to release version 0.0.3a very soon, maybe by the end of this month.
15  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-28 17:00:54
My MiniLD #58 entry SurvivorPong is now complete. It is my attempt at remaking Pong by adding a bit of challenge. The idea is you have to stop a deer from running into leopards which are hiding under leaves, and the score is how much time you can survive.



The game needs a GPU which supports OpenGL 3.3 or higher, and Java 8 runtime. By the way, this is just my second real game, so please give me constructive criticism if I have done anything in a wrong way.

LudumDare Post
LudumDare MiniLD entry
Executable JAR download (4.67 MB, needs Java 8 to run)

Please play once and tell me your opinions on how should I improve. I want to learn from any mistakes that I would have made. Also I'll be participating in the main LD event too this time.
16  Game Development / Newbie & Debugging Questions / Re: Best Practise - Quad Trees on: 2015-03-28 12:17:46
This is a complete tutorial that helped me implement a QuadTree.

http://gamedevelopment.tutsplus.com/tutorials/quick-tip-use-quadtrees-to-detect-likely-collisions-in-2d-space--gamedev-374

Hope this helps.
17  Game Development / Newbie & Debugging Questions / Re: Collision Advice on: 2015-03-28 08:48:41
Is this the link that you have followed? https://www.youtube.com/playlist?list=PLXa65xzz2vplye7cn1HH4GyE6_FjnDSug

If that is the playlist, he is @opiop65 in this forum. Along with that, you need to give us some more details on what your problem actually is. In my opinion you have to separate the collision system from your chunks. Start by creating a AABB class and attaching an AABB for each chunk.
18  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-25 04:23:48
My MiniLD #58 entry is nearing completion.



The idea is to prevent the deer from running into the leopards, and thus helping it survive.
19  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-24 06:50:26
The leopard should look like it is waiting to sprang on a deer. Thanks a lot, I think moving the legs to a new layer and move them under the body (not fully removing them) should make it look like it is waiting for it's prey.

Can you say how is it now?

20  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-24 02:38:30
Trying to make a leopard sprite, and this is the result after one hour.

Click to Play


It's still half done though, and have to complete it in another hour. I'm still thinking on how to do the head, as I never seen a leopard in a top-down view.

Edit: - after 70 more minutes. I have finally completed it.

21  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-22 15:59:21
Got this idea today, just before 5 minutes, so I took this picture. Introducing the new Citizen YOGA!



I just did this for fun, how is this guys?
22  Java Game APIs & Engines / OpenGL Development / Re: A good Game Loop on: 2015-03-22 08:05:01
You're right, the inner loop is the logic loop. It plays catch up by skipping some frames if the lag is increased. But at the same time, there is a maximum frameskip to ensure that a frame is rendered at least after ten logic cycles. This ensures that the game runs consistent on both high end systems as well as the low end ones.
23  Discussions / Miscellaneous Topics / Re: What Anti-Virus are you using? on: 2015-03-22 02:15:15
The same as @ra4king, I use Avast free edition. I just keep it installed though, never did any scan..
24  Java Game APIs & Engines / OpenGL Development / Re: A good Game Loop on: 2015-03-22 02:01:08
That is a function that returns the current time in seconds. Here is the complete class for you.

https://github.com/sriharshachilakapati/SilenceEngine/blob/master/src/main/java/com/shc/silenceengine/utils/TimeUtils.java
25  Java Game APIs & Engines / OpenGL Development / Re: A good Game Loop on: 2015-03-21 10:46:21
I use a fixed time-step game loop with interpolation. The update function takes the time of a single frame (
second/targetUPS
) and the render function takes the interpolation as the argument. The overall loop looks like this.



The above looks a lot simplified, but it isn't. The complexity here is in how to limit the UPS aka the logic rate, but keep on rendering as many frames as you can. This is how the code looks like.

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  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
public void start()
{
    // Initialize the Game
    init();

    // GameLoop constants
    final double second = TimeUtils.convert(1, TimeUtils.Unit.SECONDS, TimeUtils.getDefaultTimeUnit());
    final double frameTime = second / targetUPS;
    final double maxFrameSkips = 10;

    double currentTime;
    double previousTime;
    double elapsed;

    double lag = 0;

    double lastUPSUpdate = 0;
    double lastFPSUpdate = 0;

    int updatesProcessed = 0;
    int framesProcessed = 0;
    int skippedFrames = 0;

    previousTime = TimeUtils.currentTime();

    running = true;

    // The Game Loop
    while (true)
    {
        if (Display.isCloseRequested() || !isRunning())
        {
            Game.end();
            break;
        }

        currentTime = TimeUtils.currentTime();
        elapsed = currentTime - previousTime;

        lag += elapsed;

        // The update loop, update constantly to meet the target UPS while skipping frames
        while (lag > frameTime && skippedFrames < maxFrameSkips)
        {
            update((float) frameTime);
            gameState.update((float) frameTime);

            lag -= frameTime;
            skippedFrames++;

            // Calculate the UPS counters
            updatesProcessed++;

            if (currentTime - lastUPSUpdate >= second)
            {
                ups = updatesProcessed;
                updatesProcessed = 0;
                lastUPSUpdate = currentTime;
            }
        }

        // The simplest way to calculate the interpolation
        float lagOffset = (float) (lag / frameTime);

        render(lagOffset, batcher);
        gameState.render(lagOffset, batcher);

        // Calculate the FPS counters
        framesProcessed++;

        if (currentTime - lastFPSUpdate >= second)
        {
            fps = framesProcessed;
            framesProcessed = 0;
            lastFPSUpdate = currentTime;
        }

        // Swap the buffers and update the game
        Display.update();

        skippedFrames = 0;
        previousTime = currentTime;
    }

    Game.end();
}

This is how I do in my engine. The actual game loop looks a lot complicated when added null checks for the game states and when I run the InputEngine at a more faster rate, but is more or less the same. If I disable the VSync and lock the logic rate at 60, this loop does me 60-61 UPS and 1700-2300 FPS.

Hope this helps.
26  Discussions / Miscellaneous Topics / Re: Crash - Corrupt File, Months of Work Lost on: 2015-03-20 05:15:53
Aren't you using a Version Control? If so you could pull from your repository again. If you are using Visual Studio, it has Git integration built in, and BitBucket/CodePlex offers you free private repositories. You should be using them to prevent these kinds of losses.
27  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-19 12:26:07
I'll definitely buy it in future, but right now, I'm not able to buy additional software. I have spent most of my savings to purchase my new PC (I spent $950 for it). So for now this is the only option for me.
28  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-19 09:47:39
Finally learning to draw vector graphics, this is what I drew in 30 minutes in GIMP, and started my journey to get away from blocky pixel art as much as I can.



Still has to improve, and next up learn animating them using Blender. Yes you read it right, Blender can also be used to create 2D animations.
29  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-19 03:00:39
Achieved 100 days streak count on GitHub.



 Kiss  Roll Eyes  Shocked
30  Discussions / Miscellaneous Topics / Re: Lambda - Java 7 Alternatives on: 2015-03-14 13:49:12
There is this project called as RetroLambda, it works by taking the compiled Java 8 bytecode and generating Java 7 bytecode as the output. It supports the lambdas and method references but doesn't support other features like streams API.

I have never used this before, but there is a tutorial for this project using Android (said it also works on the desktop) here at http://zserge.com/blog/android-lambda.html
Pages: [1] 2 3 ... 48
 
Riven (27 views)
2015-04-16 10:48:47

Duke0200 (42 views)
2015-04-16 01:59:01

Fairy Tailz (32 views)
2015-04-14 20:13:12

Riven (33 views)
2015-04-12 21:36:37

bus hotdog (49 views)
2015-04-10 02:39:32

CopyableCougar4 (51 views)
2015-04-10 00:51:04

BurntPizza (51 views)
2015-04-06 22:06:58

ags1 (53 views)
2015-04-02 10:58:48

Riven (52 views)
2015-04-01 18:27:05

ags1 (69 views)
2015-03-31 10:55:12
How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

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