Questions tagged [java]

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.

Filter by
Sorted by
Tagged with
0
votes
0answers
4 views

Android libgdx java

Question1:Bird collaide with Coin that time coin is dissapear working but shudenlly apeared.What do to?.android java libgdx for(int i = 0; i< coins.size; i++){ Coin coin = coins....
3
votes
1answer
101 views

Mob generation design - is creating a class for each mob efficient?

I'm working on an RPG game for my coursework project. Everything is going fine but I've reached a stage where I do think that my project's code is not the most efficient. Here I have a constructor of ...
0
votes
0answers
52 views

Creating split-screen with Game class extending Canvas

Making my first attempt at a 2D two-player game in Java, but without using any external libraries. The issue I am running into is I am trying to split the window in half so two people can play the ...
0
votes
0answers
16 views

can't achieve a smooth movement with ShapeRender

I am using ShapeRender to render Circles and in the update function on every loop I update the coordinates that represent my ...
0
votes
0answers
77 views

Map generation for a 2.5D RTS Game

I've been looking on the net since some time for generating a map for my isometric RTS game. The map should have biomes, humidity, wind directions and etc. But I couldn't find a correct algorithm or ...
2
votes
2answers
89 views

Catan Optimal Placement

Is it possible to calculate the best possible placements for settlements in Catan without using an ML algorithm? While it is trivial to simply add up the numbers surrounding the settlement (highest ...
0
votes
0answers
85 views

How can I get a straight path using A*?

How to change A* work so that the path is more like a straight Euclidean distance? I read that you need to break some nodes, but how to implement this? I need heuristic like this: Is such a ...
1
vote
0answers
47 views

How to structure tic tac toe game loop (or equivalent simple turn based game)?

I'm developing the simple Tic Tac Toe game in Java and got stuck on the game loop architecture. The game must support local, remote and automatic players. The graphical interface is based on JavaFX. ...
1
vote
1answer
39 views

How do I order sprites by depth in Java, when their objects are of different classes?

I'm developing a game to learn more about Java, and I've run into a problem: My character (the guy) moves, but I can not figure out how to automatically change the order of how the sprites are drawn. ...
0
votes
1answer
28 views

Flat shaded triangles using the ModelBuilder?

I decided to give the ModelBuilder a try but I cannot get rid of the smoothing of my terrain. So what I tried: Create each triangle individually with there own ...
0
votes
0answers
9 views

Lighting not working in a 2D JavaFX game when using subtracting shapes?

So im trying to add lighting into my game. I'm using shape subtracting and unions to subtract circles (the lights) from a dark rectangle that covers the whole world. I think that its a problem with ...
0
votes
1answer
33 views

Can Mobile Games use Fragments instead of SurfaceViews?

All the tutorials of mobile games for android (such as this one), use the to display game objects. Most other applications tend to use an ...
0
votes
0answers
13 views

How to add lighting to a 2D Tile-based game in JavaFX?

I'm making a 2D roguelike tile-based game with Java and JavaFX. I'm currently working on adding lighting and darkness to the dungeon, but whenever I try running it, it takes a very long time to load, ...
0
votes
0answers
55 views

Why Java wont use GPU?

I have a java code (game) which runs at 3200 frames per second on my PC. On my laptop, it runs with 100 frames per second, despite the fact they have very similar hardware. I think the issue might be ...
0
votes
0answers
38 views

Depth Test Problems with LWJGL3 (GLFW)

I know: similar questions have been asked - but I didn't find a solution. So at first the basic problem: It seems that convex Models (currently I load them from .obj files) render fine, but concave ...
0
votes
0answers
36 views

Java create a Polygon for each island in tile game

I am making a 2d top-down tile based game, which is randomly generated each new world. What I want to do is create a Polygon (or other more appropriate shape I don't know of) for each landmass not ...
0
votes
0answers
15 views

how to create button to change screen

i have a problem with my code. When I add a button to change the screen, a crash occurs or takes a long time to convert to the other screen, and this is my code ...
0
votes
0answers
18 views

Creating method to jump over another pawn

Currently, I am working on my very first bigger project in Java. It is a simple checkers game, which is based on GridPane. For now, everything is more than fine, ...
0
votes
2answers
47 views

Calculate size of hexagonal map libgdx

I have a staggered hexagonal map created with "tiled" map editor and I want to calculate the height of this map in pixels, the example map below should be ...
0
votes
1answer
45 views

How to render 3d object as 2d with different angles

I wanted to make a ship as a 3d object and import it with an atlas file to my 2d libgdx project with different angles like I saw it by another game. And I was wondering if there is a specific ...
1
vote
2answers
93 views

How To Resolve Collision Before it Occurs

I have 2 objects, A and B, in a 2 dimensional space. If I know A is trying to move by vector M (that is to add vector M to the positional vector of A), and that A will collide with B after A moves, ...
0
votes
0answers
31 views

Why does a part of the background turn white when the image disappears? Photo attached

I have an image of a fish that I've drawn to the screen, which has a transparent background: When the ninja touches the fish, I want the fish only to disappear, without affecting the background. ...
3
votes
0answers
42 views

Strange normal mapping artifacts - OpenGL / GLSL

I have been following a few tutorials to learn some graphics programming with OpenGL, and recently implemented Normal Mapping. It works well for the most part, especially for objects with normal-...
1
vote
1answer
67 views

Using logic gates for Sprite Collision Detection - humor an old fart please

Im an old coder who came back so to speak, learning Java I know what I want but I cannot find anyone asking it anywhere so here goes... Im writing a basic tank game to code for practice but as is ...
2
votes
1answer
59 views

How to draw a string into a polygon? (Libgdx, Java)

I am working on a 2D grand strategy game (like Hearts of Iron from Paradox but as I said only 2D game) and I would like to render the area names on the map. I made the Polygons for each area. How can ...
1
vote
0answers
29 views

Moving with rotating in 3D world in Libgdx

I'm trying to create a first person system in my game which consist of a big cube with grass texture , so the problem happens when I move and try to rotate the camera the world rotate and I'm not on ...
0
votes
1answer
41 views

OpenGL ES model loader is slow?

I'm trying to load a 3D model in OpenGL ES, and I managed to find a project on "sourceForge" that can do this job. When I downloaded it and played the app, it took 50 second to load a small object (...
0
votes
1answer
94 views

How to make a world map from image like in paradox games? (Java, LibGDX)

I'm working on a grand strategy game similar to those made by Paradox Game Studios with their Clausewitz engine. I'm trying to create the world map from an image. On that you can see the areas, and ...
0
votes
1answer
32 views

How can I make my animation switch frames automatically without pressing any keys?

So I have been trying to figure out for so long how I can loop the frames on my animation automatically without entering user input to prompt movement of my object. I have four different frames for a ...
0
votes
0answers
17 views

TurnBased Server Design

I want to create turn based card game. Im currently writing server part in Java and I designed one little mechanism how it could work. On one server I want to be able to have lots of desks. So the ...
0
votes
0answers
52 views

Spritesheet Usage

I am working on an RPG game and I am storing most of my textures in separate .png files, but for my sprites I would like to use a sprite sheet. How do you cut and store the sheet into individual ...
20
votes
3answers
6k views

Efficiently pathfinding many flocking enemies around obstacles

I'm working on trying to improve the pathfinding for my game's enemies. Right now, they basically just constantly move towards the player's exact position by calculating the angle between themselves ...
0
votes
2answers
43 views

How can I calculate all the tiles visible to a camera in 2D?

I am creating a basic tile-based 2D game ~mostly from scratch in Java, however all I need is pseudo-code for how this could be achieved.  My problem lies in the fact that my world (stored in ...
0
votes
1answer
82 views

Infinite Loop in AStar (A*) Algorithm

Alright, so I've run into a problem where when trying to find a path that you cannot reach because it is blocked, it will continually loop and loop and loop (the 'open' list is ALWAYS filled). I ...
0
votes
1answer
34 views

JNI Error when Wrapping Jar with JOGL using Launch4j

I have been trying to wrap my fat JAR file into an EXE using Launch4j, but I have been running into problems when I try to execute the EXE. Here is the error log I get from Launch4j: ...
0
votes
0answers
35 views

LWJGL 3 - problem with flickering when rendering terrain with colors

For while now I m trying to built a terrain generator for my game engine and again I'm stuck with problem. I'm trying to generate a terrain using colors, so no textures. In short my problem is ...
1
vote
0answers
65 views

How would I go about serializing my LibGDX game?

I am currently using Kryo for serialization. I have a Player class, but it extends Sprite. Sprite isn't serializable. This means I can't serialize Player as a whole. Is there another way to do this? ...
0
votes
1answer
156 views

How can I change the hardness and blast resistance of Minecraft blocks?

I want to make the strength of the iron block and obsidian switch places, along with other changes to block strength and blast resistance. I am not allowed to swap the textures or anything like that. ...
2
votes
1answer
57 views

Flat Shading does not work correctly (openGL)

So currently I'm trying to implement flat shading into my engine using glsl's flat qualifier, and I have encounterd a really weird bug. Somehow the lightning on terrain isn't spread correctly, I want ...
0
votes
1answer
34 views

How to launch Libgdx cross-platform (Android, HTML, Desktop) multiplayer client with socket?

So i'm struggling with making my cross-platform client side to work, specifically on HTML part. I have java server that is responsible for all the controls and events, and I control it via netty-...
0
votes
1answer
97 views

How can I get the player coordinates in Minecraft

I am currently working on a client for Minecraft Java edition and I'm having an issue finding out how I can get my Minecraft character's current coordinates, client side coordinates. I would just ...
1
vote
1answer
24 views

Extending the camera vs CameraHelper class vs camera field

I am following an eBook called "Learning Libgdx Game Development" In it, the author implements a CameraHelper class that implements ...
0
votes
0answers
24 views

Optimal way for adding text inside a LibGDX ProgressBar?

I have a working healthbar set up for my game. But I also want the health to be displayed inside the healthbar as text. So for example something like "365 / 900", meaning the player has 365 hp out of ...
2
votes
2answers
98 views

Make a bullet move towards the mouse position

Before you give me a link to another post look first, just in case. So I'm making a top down game where the person can shoot around, I want the bullets to move towards the mouse, I have tried this: <...
-5
votes
1answer
55 views

When making a game using libgdx the program immediately closes when being run

The problem is similar to my last question, but some of the errors are fixed. The file: ...
-3
votes
1answer
34 views

Making a game using libgdx and when running the program immediately closes [closed]

When I run the program the window immediately closes and gives some errors. GameMapImpl.java : ...
0
votes
0answers
62 views

Is there a way to reference Unity UI object inside native code?

Let's say we have a scene in Unity with canvas and InputField on it. Is there a way i can reference my InputField inside native plugin? Maybe i can pass it from Unity?
1
vote
1answer
250 views

Show/hide soft-keyboard on demand

I'm writing simple chat-app using Unity. The problem with Unity's default implementation of soft-keyboard visibility is that it hides itself when i'm clicking outside of keyboard panel. What i want is ...
0
votes
1answer
34 views

How can I add a delay to my enemy spawning in Greenfoot?

How can I add a delay between spawning my enemies in Greenfoot? I'm doing it from a class that is neither a world nor an actor, its made totally by me. I need to it spawn 3 enemies, 3 times, with a 1-...
0
votes
1answer
46 views

Rendering multiple textures on same image for terrain with index buffers (LWJGL 3)

I have started with LWJGL3 and trying to built game engine. I'm stuck on generating terrains and this is my second big problem and I'm exhausted so I need some advice on how to solve my problem. What ...