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

2
votes
1answer
16 views

How can I repeat a Texture Region in libGDX

I have a texture that is part of a sprite sheet. I want draw the texture to cover a certain length, but I want it to repeat not stretch. However,when I use the following code batch.draw(hillBottom, ...
4
votes
1answer
132 views

LibGDX input y-axis flipped

I'm writing a game in Java for Android using LibGDX, and I connected my phone so I can test it on it. I know that LibGDX's render system works different than regular Java systems since the 0,0 ...
0
votes
0answers
10 views

Filling the viewport area of a orthographic camera with an image (libgdx)

So im trying to get the whole area of the viewport and then use the coordinates to draw images in the camera's viewport. So if the camera moves I can fill it with one image the length and the width of ...
0
votes
1answer
67 views

What is the correct approach to implement multiplayer in a game? [duplicate]

I'm developing a game and it is intended to be a multiplayer game. I have experience in writing servers and clients in Java, but the game is written in C++. The server will be written in Java for ...
0
votes
0answers
23 views

Issue with texture mapping on a spehre using opgengl es 2.0

I have a problem to calculate the right UV coordinates. I'm calculating the sphere by subdivate a ocathdron. What did I do wrong? Calculate UV Points for the texture: private ...
0
votes
1answer
21 views

Move a box2d body towards mouse [on hold]

I'm using LibGdx's Box2D in Java. I'm trying to apply a force to the body that would send it towards the mouse. The problem is, I'm having trouble figuring out a way to send it directly to the mouse ...
1
vote
1answer
44 views

Using world coordinates instead of pixels

I've been told that having a set pixels-per-world unit number is bad practice because it will not look the same at different resolutions. Because of this, I am trying to learn about using abstract ...
1
vote
1answer
31 views

LWJGL: loading textures of various types

I googled around a bit and nobody seems to have asked this question. I have images in multiple color formats (all of them are PNGs). Most of them are ARGB but my bitmap fonts are gray scale, and I ...
3
votes
1answer
123 views

How can I make a self-updating game launcher? [on hold]

I have been creating a game with java, and before I release it I wanted to make a launcher that is connected to the game's website. Basically I need to make a launcher that updates itself when I have ...
0
votes
1answer
86 views

How to only render whats on screen (Tilemap, Java2D)

I have some problems with my rendering of a 2Dimensional Map. for (int col = 0; col <= view.getWidth () / Tile.TILE_SIZE; col ++) { for (int row = 0; row <= view.getHeight () / ...
0
votes
1answer
14 views

How can I use OpenType Font in libGDX

Is there a way I can use an OTF file with libGDX. The following throws an exception: gameFont = new BitmapFont(Gdx.files.internal("data/font.otf")); Caused by: ...
0
votes
1answer
36 views

Libgdx - How to rotate a single ShapeRenderer object

So, looked at a couple of questions similar to this, led me straight into dead ends. I have an object drawn out in ShapeRenderer, and I wish to rotate only that one object. I have tried ...
1
vote
0answers
26 views

Certain random content rendering differently

On the main menu of my game there is (obviously) several buttons. 2 of which, in different positions on different screens, render a different colour to the rest. As you can see below, "New game" ...
2
votes
1answer
52 views

(Minecraft) MoveHelper for custom entity not updating

I'm trying to create a shark mob for minecraft 1.8 (using Forge 1.8). Since it's a water mob, the movement functions need to be edited to allow it to path correctly in water. However, after ...
0
votes
1answer
23 views

LibGDX - how to detect touchUp with GestureListener?

I'm making a game and I have implemented GestureListener as my inputprocessor. It came with a bunch of methods such as fling, pan, tap etc etc including touchDown. However, there is no touchUp method! ...
1
vote
1answer
27 views

Java - Trouble with recursion and rectangle placement

I am using Android API's and using the RectF class for rectangles. I have a list of blocks that are on the screen at one time. Each block is given a random position, and then I go through all of the ...
0
votes
1answer
41 views

How to fetch unit coordinates for AI?

I have been designing a simple turn based Civ-like game over the last two days with libGDX to test myself. I have a units class that can be extended to make unit types and I have my game board set ...
0
votes
1answer
78 views

Using Java on mobile, should I avoid object construction to reduce GC overhead?

I new to both Java and game development and working on my first LibGDX game targeting mobile systems. How problematic is the garbage collector in a mobile environment? Should I try to reuse as many ...
1
vote
2answers
119 views

Efficient removal and adding of Components in ECS

i'm working with the Ashley Entity-Component-System (related to libGDX) to program a server-side simulation for an online game and i stumbled upon a serious performance drawback, that is probably ...
1
vote
1answer
41 views

How can I rotate a quad around it's center?

My code is: GL11.glPushMatrix(); // rotate around center GL11.glTranslatef(-200/2, -200/2, 0); GL11.glRotatef(30, 0.0f, 0.0f, 1); GL11.glTranslatef(200/2, 200/2, 0); // draw quad ...
0
votes
1answer
66 views

How can I blend up to 3 textures on a polygon without blend maps?

For my voxel game I need to blend up to 3 textures in the same polygon. It would be preferable if I could specify a texture id for each vertex, but other solutions are accepted as well. Here's an ...
0
votes
1answer
32 views

Camera.unproject(Vector3) method is not working in libGdx

I know the touch postioning in libGdx uses OpenGL, making 0,0 the bottom left corner while the camera uses the top left corner as 0,0. I did some searching and found this SO question that specifies ...
0
votes
2answers
52 views

How to create a Update function in Java

I have recently started using Java, but have been programming in javascript, and actionscript 3 for a while. I am used to the language giving me the ability to simply do something like: private ...
0
votes
0answers
38 views

how to move an object to the mouse in Java

I have just recently started using Java, literally 2 days ago, and I have run into an issue. While I have been easily able to figure out most of the syntax and methods, because I have used multiple ...
0
votes
0answers
20 views

How to draw my android Hexagons in a grid?

I am trying to create a hexagon grid using the Android ’Canvas’ package. I have a working ’Hexagon’ class that when used in a view will draw a single hexagon on screen. The problem is that I need many ...
0
votes
0answers
26 views

Kryonet with multiple clients overhead server, how to deal with this? [on hold]

I'm developing a server-client multiplayer game using Kryonet and libGDX. My server contains 100 entities and sends updates at 20 packets per second to clients using udp. Each packet contains the 100 ...
1
vote
2answers
65 views

LibGDX - Rendering things in different classes

thanks for your time! I'm really new to LibGDX (and Java itself). Which approach should I use to render my different game parts? I want to show a background, the main character, a bunch of enemies ...
1
vote
0answers
71 views

2D Parallax Scrolling

I'm trying to implement parallax scrolling and have a partially working equation (from a book I've read) but it doesn't fully align to the screen. I also want to stick purely to integer maths. I've ...
0
votes
0answers
45 views

KryoNet/Multiplayer Basic Design Questions

I am building a simple turn-based multiplayer Android game that resembles chess a bit. I'm using KryoNet for the multiplayer. The only thing I got working so far is the login server and game ...
0
votes
0answers
37 views

Java XML file data mangment. sorting by multiple tags [on hold]

So lets say I have this xml file. <Building> <firstfloor> <biome_urban id="1001"> <dosomthing></dosomthing> </biome_urban> ...
0
votes
0answers
30 views

Vertex Skinning OpenGex Incorrect Transformations

I'm following the formula here, I'm using LJWGL, OpenGl, OpenGex, and Blender: I implemented the code and it works but there is a few things. First, there is a gap between the two bones, or on each ...
0
votes
1answer
29 views

Java: Exported JAR file doesn't load images

I am using Netbeans to create my game. The images do seem to load when I run it in Netbeans. However, the built jar file only leaves me with a blank screen. This is how I call the images in my game. ...
-2
votes
2answers
67 views

Multithreaded or Thread pooled server for real time multiplayer games? [closed]

So if the Thread pool handles 10 players out of 100 per second, this could make a delay that will be no good for real-time games, so as I see it that MultiThreaded will be better, thus it will handle ...
-1
votes
1answer
48 views

What is the best way to send/receive data about user coordinates and other properties?

For example If I have 2 users, and each of them have an object, and that object has: x coordinates, y coordinates, angle, state, and other properties... I use java let'say the game changes at 30 ...
2
votes
2answers
155 views

Unknown length of primitive array

For my Voxel like game I need to generate terrain meshes from an array of ids. Because of that I have no idea how big the final vertex array will be. Currently I'm doing like this: generate mesh and ...
2
votes
1answer
53 views

Java: Problems with Tile Collisions

I have created a tiled map using a BufferedImage (img) from a PNG. From that, I would like to detect the player's (peter) collisions with individual tiles on the map. However, my code will not run and ...
1
vote
1answer
43 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 ...
-2
votes
1answer
43 views

Libgdx Statebased game not working

I'm using Libgdx and I wanted to change the default application to a Game with multiple screens. I get an odd nullpointer that has to do with the engine. I'll show you my little setup code. Here I ...
0
votes
1answer
50 views

Sending an object from one point to another

I am working on a simple game in Java and am stuck for now with getting an object to be directed from its current position to a certain point, all at a fixed speed. My problem is that whenever I ...
0
votes
0answers
38 views

Android client-server logic for a multi-player game

I'm creating an android "quiz" app. The game can be played by two user in real-time. I'm creating game on server with this design: //node js server //new game request api @game/request/new var ...
2
votes
1answer
76 views

Creating a Melee Weapon in Box2D (libGDX)

I am struggling with how to implement a melee weapon that can swing when a key is pressed. I am imagining two different attacks (stab and swing) I have tried creating two fixtures (character + ...
0
votes
0answers
26 views

How can I render several rectangles efficiently? (LWJGL)

I'm working with OpenGL3+ rendering and I am coming from OpenGL1.5. In GL1.5 I had rendered things like this: public class GraphicsDead { int vboVertexHandle; int vboColorHandle; public ...
0
votes
0answers
63 views

Problems with starting a new game in Tic-tac-toe

I have problems with a new-game method in the game Tic-tac-toe, because after I play a game against the computer, and want to replay the game, the buttons freeze and I can't press them. For playing ...
0
votes
0answers
11 views

Problems with computermove in tctactoe android java

I have problems with the computerMove in tictactoe. I am trying to do a method with matrix, but I do not know how to do it in a good way. I have done an array with button which the game board will be, ...
1
vote
1answer
62 views

Server networking - Thread per player

As my game is purely multiplayer, online performance is important. Should I run two threads for each player/connection? (One for input and one for output) or should I run one thread for all player ...
0
votes
1answer
59 views

Libgdx understanding screen size

I'm trying to create my own jumper type game where the player moves up through an infinite y value. The problem I am having is getting the screen size to match up with the android screen. viewport ...
1
vote
0answers
45 views

Game state: getting it to work help! [closed]

I've started using enum in java but I ran into issues getting it to work, how would i be able to make it start of with a Intro going into a main menu (with mainmenu backround and buttons) and you can ...
1
vote
2answers
172 views

What makes Minecraft so CPU intensive, and what could be done to improve it? [closed]

Recently I've been searching for VPSes that allow Minecraft servers to be hosted, and surprisingly very few do. Most allow for games - but Minecraft in specific is disallowed by many. Now it's fairly ...
1
vote
1answer
42 views

Drawing text with Slick

I've been trying to draw a text to the display using Slick. However, when ever I draw the TrueTypeFont to the screen, it draws it reversed upside down and also, it makes the whole display turn black. ...
0
votes
0answers
47 views

opengl camera scrolling too fast

Im using the code from this tutorial but in java and lwjgl http://lazyfoo.net/tutorials/OpenGL/04_scrolling_and_the_matrix_stack/index.php . The problem is i want the player to click and drag around ...