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

learn more… | top users | synonyms

4
votes
1answer
97 views

Large 2D Arrays Causing Garbage Collection

I've been working on a game in Java that, for this post's sake, looks like Terraria and has random world generation. I've been using Vectors to contain my tile/block objects, but recently due to the ...
1
vote
1answer
102 views

How to resize my 2d game to fit the screen?

I am currently making a 2D game using Java (Java 2D). I want to make my game resizable. If you play any game on an emulator (e.g. legend of Zelda in fceux emulator) in full screen mode, you'll see ...
3
votes
4answers
289 views

Inventory implementation in Java RPG

In my game (simple RPG with Java) there will be an abstract class Creature. Critter, Beast, Vampire... will inherit from Creature. But not ALL classes that inherit from Creature will have an ...
-3
votes
1answer
72 views

What's wrong with my step-toward-target implementation? [duplicate]

I want to move a game object from its current position toward the mouse position. I wrote this Vector2D class to help me: public class Vector2D { private double xVect; private ...
2
votes
1answer
61 views

Edit spawn location according to vector direction

I'm trying to make a turret in Bukkit (Java). This will shoot an arrow to the players that are in the shooting radius. But now I've a little problem, the arrow gets stuck inside the block where its ...
1
vote
3answers
112 views

How to handle network game [closed]

I'm currently building my own game using LIBGdx in JAVA but i'm facing some trouble. My game is base like this : A player have a position and some other parameters that are float, int types. He also ...
0
votes
4answers
155 views

Is there any way to load pieces of a tile-map as and when needed, and not the entire map at once?

I created a tile-based rpg game in java, but it runs really really slow, the reason is the big tile-map that is stored in the buffer. Is there any way to programmatically load pieces of the map when ...
-2
votes
1answer
88 views

libGDX How to make camera follow the player? [closed]

I'm having some trouble getting the camera to even work at times. Thankfully, its some-what working now. I'm trying to get the camera to follow the players movement but nothing happens. (cut out the ...
1
vote
0answers
28 views

LibgGDX drawing two seperate Textures in FrameBuffer

So I am trying to combine multiple TextureRegions in to one by using a FrameBuffer. This works extremely well when the TextureRegions originate from the same Texture object/file but as soon as I try ...
-1
votes
4answers
180 views

How/where to generate RPG world?

I'm programming an RPG in java. It's text based, so movement is more or less from "room" to "room." In the case of cities, they will generally be one room, with some sub rooms for important shops and ...
0
votes
4answers
145 views

How can I optimize performance when updating tiles?

So I'm making a side-scrolling adventure type game in Java. The worlds are procedurally generated, so I can't manually place tiles. Therefore, I every 20 ticks (1/3 second) I update every block's tile ...
0
votes
1answer
53 views

Collision bug with gravity in slick2D

I have fixed some of the previous problem. The collision when running into a corner(a wall on two sides) however is still not working. When the player runs into a corner he just falls down and out of ...
0
votes
1answer
141 views

How do I rotate and flip 2D sprites stored in a 1D array of pixels?

I am using a 1D array of pixels for rendering in 2D in java. I am interested in rotation (in radians) and mirroring across the x and y axes. The desired result looks something like this: Public void ...
0
votes
2answers
124 views

Recommended approach for event system in Java

What are the recommended approaches for an event system of a turn-based RPG's battle engine? The system I'm currently working on has a runEvent method that sorts the actions queue based on their ...
0
votes
1answer
67 views

Cant center screen between black bars

As I was trying to adapt my game to different device resolutions I ran into a problem when adjusting the game screen between the "black bars." In my case I am using the FitViewport class from the ...
1
vote
1answer
53 views

Scale around a point

I am trying to create an image editing application for the purpose of generating UV maps in my own format. I am currently working on scaling the image for the purpose of zooming. I can get the image ...
0
votes
1answer
43 views

Mouse coordinate conversion Libgdx

I have a camera: //Map is a my object that wrapper of TiledMap class In the create method: this.renderer=new OrthogonalTiledMapRenderer(this.map.getMap(); this.camera=new OrthographicCamera(); ...
0
votes
0answers
67 views

Libgdx/Box2D PolygonShape has no position… well, what now?

As my prototype works perfectly fine I want to advance to more fun areas of the project and add a more complex player-character body. So for Box2D I figured I'd need multiple fixtures, like one for ...
0
votes
0answers
27 views

LibGDX ShapeRenderer graphical glitches

So drawing something static on the screen with the ShapeRenderer is fine but whenever I try to move something it starts glitching out. Here's a vine to show what I mean: https://vine.co/v/OBxFi1P2IO9 ...
1
vote
1answer
82 views

Using xinput vibration with java

I need to use vibration for my java game, which is only available through xinput since I use xbox controllers. How can I achieve this with jna? I've never worked with dlls before so any help is ...
0
votes
1answer
36 views

Jumping distance due to X velocity

I would just like to know if there is a way to work out the distance of a jump depending on how fast the player is going. For example if the player has a velocity X of 10 and he presses the jump ...
0
votes
0answers
84 views

Java Libgdx - Fire bullets

This is my project structure! I am using Java Libgdx I want to make my Man class shoot the bullets from my bullet class. To make it more clear for example the spaceship game that you shoot ...
0
votes
0answers
29 views

Camera rotation issue Libgdx

I have a OrthographicCamera and I want to rotate 90° it, but when I rotate it seems to be shifted more to the right. Before rotation: http://postimg.org/image/tc9jpq9zr/ After ...
0
votes
1answer
61 views

Fade into splash screen on game load

I'm using Slick2D and LWJGL for my StateBasedGame and I was wondering if there was a way to enter into my splashscreen on application load using a transition? I tried using: this.enterState(SPLASH, ...
0
votes
0answers
44 views

2D Game with a big block-based Map - Create for each block one block-object? [duplicate]

I'm working on a 2D game in Java which will be similar to Terraria (Mincecraft 2D). I want to generae the world-map random. The world (the ground) consists of 32x32 blocks. How I should handle all ...
0
votes
1answer
73 views

Enemy spawning problem [closed]

I've been trying to get my characters to spawn at random points through out the map. I have a camera which is following my main character (2D RPG Style) around the screen, but I want these "enemies" ...
0
votes
1answer
60 views

Coordinates issue vertical scroll Libgdx

I'm going crazy with this problem. I'll explain: I have a camera that falls down (flowing along the y-axis) which displays a TiledMap and declare the whole in this way: In the create method: ...
0
votes
1answer
26 views

Timed player collision

I'm trying to make the player loose one heart then cool down for a second after being hit. For an example if(a.overlaps(b)) { p.health--; } would lower the health while being touched. In my old ...
1
vote
0answers
43 views

LibGDX: Why look BitmapFont pixelated on a scene2d.ui.Dialog?

When I use BitmapFonts directly on the stage table, the fonts looks normal (not pixelated). But when I use the same BitmapFont with the same size on a scene2d.ui.Dialog, the font looks pixelated. ...
0
votes
0answers
48 views

Client side latency when using prediction

I've implemented Client-Side prediction into my game, where when input is received by the client, it first sends it to the server and then acts upon it just as the server will, to reduce the ...
0
votes
2answers
57 views

Libgdx, find Vector3 direction

I am using Libgdx along with Bullet physics. I have a vehicle moving. I would like to use a ray from the vehicles origin and in the vehicles forward direction. How can I create the forward Vector3 ...
1
vote
2answers
60 views

LibGDX . draw multiline text

I am trying to write a big text using BitmapFont in libGDX . But it shows on one line and the user can see only the first part of the text . How can I make that bitmapFont made new line automatically ...
0
votes
1answer
90 views

Too much delay while sending object over UDP to server

I'm getting 4 sec delay when sending objects over UDP. Working on small game and trying to implement multiplayer. For now just trying to synchronize movements of 2 balls on the screen. ...
0
votes
1answer
84 views

Transparent JPanel, Canvas background in JFrame

I wanna make canvas background and add some elements on top of it. For this goal I made JPanel as transparent container with setOpaque(false) and added it as first of JFrame container, then I added ...
1
vote
1answer
96 views

Dynamic object creation with HashMap

I want to use a HashMap to dynamically create objects based on the key. I have a Random Map Generator that stores the maps in 3D Arrays of Type Integer[][][]. Upon creation of the actual map I ...
1
vote
1answer
122 views

Pokemon Yellow wrap transitions

So I've been trying to make a pretty accurate clone of the good old Pokemon Yellow for quite some time now and one puzzling but nonetheless subtle mechanic has puzzled me. As you can see in the ...
-3
votes
1answer
35 views

How can I perfectly center an image in a window using Slick2d?

Dividing the window's width by two to position it in the middle of the x-axis did not work. What else can I do?
1
vote
2answers
139 views

Why does my code dividing a 2D array into chunks fail?

I have a 2D-Array representing my world. I want to divide this huge thing into smaller chunks to make collision detection easier. I have a Chunk class that consists only of another 2D Array with a ...
0
votes
1answer
72 views

How could I implement 3D player collision with rotation in LWJGL?

I have a problem with my current collision implementation. Currently for player collision, I just use an AABB where I check if another AABB is in the way of the player, as shown in this code. (The ...
1
vote
3answers
192 views

What datastructure would you use for a collision-detection in a tilemap?

Currently I save those blocks in my map that could be colliding with the player in a HashMap (Vector2, Block). So the Vector2 represents the coordinates of the blog. Whenever the player moves I then ...
-2
votes
1answer
90 views

Calculate velocity of a bullet ricocheting on a circle

I made a picture to demostrate what I need,basecaly I have a bullet with velocity and I want it to bounce with the correct angle after it hits a circle Solved(look the accepted answer for explain): ...
0
votes
1answer
60 views

TileEntitySpecialRenderer only renders from certain angle

I'm developing a Minecraft mod with Forge. I've added a tileentity and a custom renderer for it. The problem is: The block is only visible from sertain angles. I've compaed my code to other peoples ...
-1
votes
1answer
60 views

LibGDX Json not parsing full file

I'm trying to load a World with different Objects (World Objects and Entities). For that, I want to use Json. For less than two elements this works like a charm. But as I add more elements, some ...
1
vote
1answer
93 views

making a monster encounter method

I'm currently making my own little 2d text based game and I've got a 11 / 11 grid where a monster spawns in the middle and when i stand on it's position and it brings me to another 11/11 grid where i ...
0
votes
0answers
50 views

LibGDX - How to move Actor with fingers Code?

I am completely new to Game Development. I See all these Questions and Answers and Codes and I have no clue what to do with them. I need some Guidance. My Plan: I want my Actor to move up and down, ...
0
votes
1answer
81 views

NiftyGUI - Text isn't rendering

I am trying to create a gui with nifty on top of lwjgl. I've already had some problems during the Nifty setup, however now Nifty is set up and running correctly but for text rendering. Here is my xml ...
0
votes
4answers
112 views

Accurate sprite rotation with mouse movement

I am using the current mouse position to aim the player sprite, but I am not getting the best results. It will often by off by a noticeable amount, or even a complete ~180 off if I go from one side, ...
3
votes
1answer
107 views

How do I get the number of online players in a Minecraft server from outside the client?

I know that the Minecraft client can query the server for number of players and maximum players, even when the server properties has enable-query set to false, but how do I do this outside of the ...
2
votes
4answers
185 views

Designing a scriptable questing system

I'm currently working on a scriptable questing system. As for scripting, I will probably use JavaScript, but I'd appreciate some help with the design of the system. My first attempt essentially ...
16
votes
3answers
3k views

Is there any harm in having the main game loop run uncontrolled?

I was wondering if there is any possible harm when my game loop runs as fast as the system allows? I currently have a loop, that, by measuring passed time in nanoseconds, runs the game logic and ...