Java is both a popular object-oriented programming language and runtime environment which allows Java programs to run unchanged on most hardware and software platforms.

learn more… | top users | synonyms

3
votes
1answer
127 views

Creation of a tiled map editor polyline in box2d is not working correctly

I'm currently trying to create a box2d polyline object in my libgdx game, but it's not working as expected. To get a better picture of my subject, have a look at how it should look like, and how it ...
1
vote
2answers
75 views

How do I calculate the tangent to a point on a circle?

I have a line that is from the center of a circle to a point on it's edge that is changing constantly (radius is drawn to a point orbiting a circle) I want to make a line tangential to the circle ...
1
vote
1answer
60 views

Java game LWJGL input doesnt work properly

Im making a game in LWJGL 2 and Slick2d. Im trying to add an item to my inventory by releasing a key (the inventory system works properly, the part where I have to see if the button was RELEASED is ...
0
votes
1answer
35 views

LibGDX--constant high score in top corner

I'm currently programming a game using LibGDX and box2D. I have a sprite (player) that moves up the screen, kind of like doodle jump. I'd like to have my camera to be centered around the player at ...
1
vote
2answers
215 views

Game lags when my player collides with a specific object (solution known, unsure how to implement)

I'm developing a game in Android using LibGDX (although this is more of a JAVA problem than an engine problem). My aim is to have my player bounce off one spring onto another that will eventually take ...
0
votes
0answers
37 views

Storage and Lookup of Voxel Chunks

How can one store chunks in such a way that they can be looked up using their XYZ location without wasting memory? The problem with a HashMap<Vector3i, Chunk> is that you have to keep creating ...
5
votes
1answer
101 views

On a 2D generated terrain what is the easiest way to pick tiles for the shoreline?

If I have a two-dimensional array with ones and zeros for water and land respectively how do I choose what shoreline tile to use according to the water and land tiles surrounding it? The shoreline can ...
3
votes
1answer
292 views

Best way to deal with Collision in JavaFX

This question I'ts no exactly a fix for the current game I'm working on, but I am showing it as an example to explain my problem. I just want to know the best way to handle collision in JavaFX. My ...
1
vote
1answer
92 views

how to get rid of blurred and overlaping 3d shapes in javafx

I actually wanted to build a 2x2 rubiks cube. As the Box class in javafx doesn't provide the feature of building a cube with different colours on different faces, I chose to build the cubes using ...
-2
votes
1answer
24 views

What is the purpose of the second parameter to Array.removeValue in libgdx?

I have been wondering what the second parameter of the method in Array removeValue does. removeValue(T value, boolean identity) What does indentify mean and should I pass true or false?
0
votes
0answers
41 views

How can I make an Actor repeat the action on collision in LibGdx?

I want my EnemyActor to do this SequenceAction when it collides with my bullets. I have already done the collision. Now the problem is that it only does the SequenceAction once when it gets collided ...
0
votes
1answer
33 views

What is the code for panning a camera from touch input? (libGDX + scene2d)

I would like the user to pan around a game world by dragging their finger on a touch screen - just like Google Maps. I tried a few things but I'm not having much success thus far. Here is where I'm ...
0
votes
0answers
14 views

DragAndDrop release with pointer on payload

When I am moving my payload all the way to the corner it remains on the stage and my mouse goes over it when I then release (on a valid target) it returns null as a target and thus does not drop ...
0
votes
2answers
52 views

how to add an onclick event to a button?

If I will draw a button with canvas with any programming language (java,javascript....) I want to know how to add the events to what I've drawn for example If I will draw a button piture then what I ...
0
votes
1answer
46 views

How can I apply effects to a character based on the tiles it occupies?

A mechanic of my game is that when a Character (Actor) steps on some specific tiles, they should be affected by status effects like slow, poison, burn, etc. These effects lasts only while the ...
2
votes
2answers
50 views

Java: problem with 2D corner collision

:) It took me many days to create a working collision detection for a 2D java platformer... I am finally calculating the corners of my player but the system is still buggy and I hope that we can ...
-1
votes
2answers
62 views

How to lock the mouse cursor in the middle in a first person camera?

I want to get a first person camera (like Call of Duty or Minecraft etc.) but I don't know which is the best way to do it. I have some camera increase rotation methods (camera.increase ...
0
votes
1answer
49 views

Frustum culling only working at certain angles

So how I'm doing this is a little sketchy but I plan on changing it to either AABBs or spheres once I get it working. So the problem I'm having right now is that the frustum culling I've implemented ...
1
vote
1answer
37 views

How to get the position in an actor inside a table with LIBGDX?

Well the title says it all, I want to get the position of an actor inside a table Button button = new Button(bs); table.add(button).width(50).height(50); table.top().center(); By using ...
0
votes
0answers
17 views

JBullet & LWJGL Rendering objects with jbullet transform

I tried to render objects with jbullet matrix transform. Its something like that: get float array where is stored matrix then put it to floatbuffer and load to Matrix4f using load() function. Use ...
0
votes
1answer
45 views

Game Server Mechanic [closed]

Hey guys :) Im currently developing a little rpg duengon crawler. I really want to implement a local and an online multiplayer function, i know how servers are working and how to make them using ...
-1
votes
1answer
310 views

How to draw a curved line in Box2d?

I need to draw a curved line, I have searched the Internet but found nothing that would suit my needs. I used b2ChainShape but it's not completely what I need. How can I draw a curved line with ...
0
votes
1answer
69 views

How can I make an actor fire a bullet on touch?

I created a Jet and a Bullet, and when Jet is touched, the Bullet is fired. Now I want to know how can I make the Jet fire again when touched after it has fired the first shot? public class ...
0
votes
0answers
25 views

Collision logic with Animations Java

Im trying to code a tile based platformer game with slick2d. While handling the collisions, Im facing with this problem. I could fix it for only that situation but I guess there must be a better way. ...
1
vote
2answers
113 views

Interpolation over a network - receiving and drawing an opponent in 1v1 game

I'm a newbie Java coder and I'm creating a 1v1 game with an authoritative server and two clients. My whole network is based on UDP packets: sending positions from clients sending confirmations ...
1
vote
1answer
95 views

Save a mouse coorinates after a specific number of seconds

I have a specific method that saves my mouse x and y coordinates. I want that mouse coordinates be saved by specific time (for example after 1000ms). How I need to do that in Java? Please add a simple ...
0
votes
2answers
43 views

Detecting position within a circle

I need to detect the position of a knob on a touchpad. I need to detect if it is in particular areas and if so, which one. The sections, of course, being the colored parts. I know that the black ...
0
votes
0answers
40 views

LibGDX - Player Movement Flickers

So, I was programming a very simple LibGDX game, so I decided to include a player class into the program. Once I did that, the players image started to flicker/stutter while I moved it. Here's the ...
0
votes
2answers
97 views

How can I move an object around a canvas in a random direction at random times?

I am currently trying to move an object (circle ball) around the canvas in a random direction. I have already written the code for the wall collisions so the ball bounces back into canvas when the ...
0
votes
1answer
63 views

dual contouring concept and term translations

I am working on a 3D sandbox mmo with destructible terrain, using Java and LWJGL. I looked at most options to achieve this and found that dual contouring would probably be the best option for me. I've ...
0
votes
0answers
57 views

Implementing BaseGameUtils with LibGDX for Google Game Services

I'm developing a game for Android in Java using Android Studio and LibGDX. I'm trying to implement the Google Game Services inside my game but I'm having trouble using the BaseGameUtils. Every time I ...
-2
votes
1answer
40 views

How to get system date? [closed]

How do I get system date like: month, day in libGDX? I want to add to my game events that happen on specific date but I don't know how to receive it.
0
votes
1answer
43 views

LibGdx: search through text file without lots of String garbage

I'm reading a text file from Gdx.files.internal in LibGdx. This is essentially streaming a file from a compressed Jar file so random access is not possible. I want to search through the text file ...
1
vote
1answer
45 views

Java - Adjusting the speed of an object during movement

I am trying to get an object to move (on java canvas) in the same angle but at different speed within the X and Y axis. Below you can see how i have implemented the movement of the object. xPosition ...
1
vote
1answer
64 views

How could I implement destruction of bases in Space Invaders type game?

What approaches could you use to implement the the gradual destructions of bases/shields in a top down shooter type game similar to Space Invaders? The simplest approach could be to use a series of ...
5
votes
2answers
942 views

AI multithreading [closed]

MMO game. ~5000 (fake) players should be controlled by the server. Many of them have different classes -> different behavior. They should make some random pauses while doing some actions (~500-1500 ...
0
votes
0answers
37 views

Box2D top down car weird spasm

im currently programming a 2d top down racing game with box2d and libgdx. i have a car body to which there are 4 wheels attached. these 4 wheels are attached with RevoluteJoints ( for the front ...
2
votes
2answers
61 views

Cut rest of image behind object (like POV)

There are two objects - blue circle and black square. When you normally render them, you will see situation in "A". But how do I render only specific part of blue circle, which can be "seen" (is in ...
0
votes
1answer
45 views

Ball can double jump in Jumper Game

I wrote a game that has a ball which can only jump (like in most jumper games) to avoid incoming obstacles (only, I haven't integrated the obstacles part yet). Right now, it's just a ball that can ...
-3
votes
1answer
24 views

OpenGL ES 2 inheriting issues [closed]

I am Having an issue where one of my classes will not inherit the other ones variable value. In the class which is inherited. It shows the value of the float just fine. But when I go to the Class ...
1
vote
2answers
111 views

Swap buttons in layout

Say I have 4 buttons. I want to have button 2 always swap out with another button, randomly. So, when the user taps button 2, it should swap with another button (randomly). Now, button 2 is at the ...
1
vote
1answer
45 views

Player moving back and forth when moving with camera LIBGDX

I have a problem. When in libGDX my player moves across the screen and the camera is moving after him the player jumps back and forth a bit. Player still moves forward but it looks goofy I'm moving ...
0
votes
2answers
47 views

Hide building roof & Hide faces/vertices depending on world location

I'm currently developing a small game for my own enjoyment and I've ran into a problem. As you probably know many third person games (such as Runescape and XCOM, for example) hide the roofs when you ...
0
votes
2answers
139 views

Optimising Voxel World Rendering

There are a couple of questions like this already. This one is different because it is specifically about rendering, as opposed to navigation and generation. I've implemented suggestions from here ...
0
votes
1answer
34 views

GlViewport-code doesn't work in one specific screen?

I am currently working on a small game using LibGDX and Java. However, I have found one oddly specific problem. I want the game to resize so that it never has to be cropped and so it never has to cut ...
0
votes
1answer
37 views

Frame Rate Independence for Non-Linear Increases

So while working on my game, I decided that I would have a speed variable increase in the fashion speed += 1/speed; with the goal being that in the beginning it increases fast and then it increases ...
0
votes
1answer
170 views

deformable terrain

I'm currently working on a 3d sandbox mmo and would like to know what would be the best way to store the terrain of the world. I was thinking about making some kind of mesh, like the kind you would ...
0
votes
0answers
38 views

Multithread OpenGL to Upload Meshes

My game is rendered in dynamically generated chunks, each of which has its own mesh. Every time I generate a chunk and upload its mesh, there is a huge lag spike. Is there a good way of eliminating ...
2
votes
3answers
370 views

Should FPS exceed ticks/second?

I was once told that you should never re-draw a frame if the game logic has not changed since the last draw. Assuming game logic is updated once every tick, and assuming a game runs at 40 FPS @ 20 ...
0
votes
0answers
33 views

Doing collisions on both axis with java overlap

I'm making a top down game from scratch and just found out about the java rectangle overlap method that would work great for collisions. However, after the overlap happens, I need to check for which ...