Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
27 views

Is it always necessary to synchronize rendering in a game loop?

When writing a game loop from scratch in java for an android game applications, it is very common in many tutorials I have read that the keyword synchronized is used to synchronize update and ...
0
votes
0answers
20 views

Small CCG Project Review [on hold]

Hello I'm making a small CCG Application similar to this Yugioh project linked below. I've made up my own rules for the game in a text I can link if neccessary. Video: Wonderful Project right? A ...
0
votes
0answers
17 views

Timers, how to manipulate booleans for Firing Animation

I'm new to programming games. I'm currently having difficulty understanding Timers. I currently have two methods that monitors VK_space_bar that triggers my player class's Boolean to true and false. ...
0
votes
1answer
76 views

Fast Serialization for Multiplayer Gaming

I wish to make a Java based multiplayer game. I am learning all about sockets and so forth. I have built a very basic UDP system that serializes an object with all the information about the game state ...
1
vote
1answer
95 views

Keep world changes in sync in client/server architecture

Imagine having a big room (4000w x 4000h) which contains players and items (world objects). The room is spatially partitioned in a 10 x 10 grid for collision detection and changes in the viewport of ...
1
vote
1answer
30 views

LWJGL3 shader code doesn't work

So I made a program to draw a simple cube with colors at each vertex. The program worked fine until I added shaders. It was using vbos and indicies and it did draw a colored cube like it should. So ...
0
votes
1answer
40 views

Should I generate 2 array map or use tilemap?

So, I'm trying to build a 2d multiplayer bobmerman game. Right now I have whole map as 2d integer array. I'm thinking if I should change it to tilemap. In the future, I will want to be able to ...
0
votes
0answers
38 views

OpenGL Context creation takes over a second

I'm looking through some old code and noticed the following line takes over a second to run while the program is initializing: ...
0
votes
0answers
8 views

Debugging a server with JUnit - showing the stacktrace after crash

I implemented a server that needs some testing and just experienced that when the server crashes, no stacktrace is shown. A simplification of a basic test looks like this: ...
0
votes
1answer
47 views

Pause updating but keep rendering

I am creating an implementation of Snakes and ladders and I run into some issues.The game is updating too fast and I want to limit the framerate kinda,or make a pause so that the move is actually ...
1
vote
0answers
28 views

MousePicking in LWJGL - How to do it?

I have been working on a mouse picker for a scene in 3d for a client, and been having issues implementing a proper mouse pick. His application does not use a camera, and I am trying to get the ray ...
2
votes
1answer
75 views

Need instructions for my AI racing car game

I'm having a school project to create an 2D AI racing car game, but nobody know where is the destination, and the map is randomly generated. But to avoid the dead end, we must teach the car not to ...
0
votes
0answers
34 views

Weapon Reloading Bug

I'm developing a top-down shooter in Java with Slick2D, and I've been ignoring this bug for a while because I'm not sure what causes it. I have numerous weapons that you can buy from the shop and ...
0
votes
1answer
20 views

Face culling all faces that cannot be seen [duplicate]

I'm working on a simple 3d game using the Processing Java environment. I want to optimise my code so I can draw many many 'objects' (the world is made up of many different shaped objects that live ...
0
votes
0answers
30 views

Java game how to fix offset move with mouse drag and reset back to start position

I'm try to make offset x and offset y move correspond with mouse drag movement I tested it. Its work but after I released the mouse and do it again the offset will reset to 0, 0 I tried to fix it by ...
0
votes
0answers
12 views

Libgdx Box2d TiledMap Scaling

I think I'm doing something completely wrong but I just can't seem to wrap my head around the box2d pixels per meter conversion. Currently I have a Tiled map with an object layer I want to use as my ...
1
vote
2answers
52 views

Displaying pixels on a canvas at 60 hertz [closed]

I'm (new to SO and) attempting to code an "emulator" for an 8-bit CPU I am making with a friend. I have only ever used Java to make simple GUIs with Swing, and from reading similar questions it seems ...
0
votes
1answer
32 views

How to create post-processing effects in Slick2D?

As I get closer and closer to the end of the feature development for my game and the beginning of the graphical overhaul, I keep thinking of ideas for graphical effects that would make my game even ...
0
votes
1answer
46 views

What is more efficient: Excessive Multithreading or Event-Handling through one Class?

I am recently working on a server for a game (1 vs 1 with observers) that shall support parallel games and I wonder whether it is more efficient to create 1 extra thread per game/lobby or to let one ...
0
votes
0answers
21 views

Implement an “xprevious” in LibGDX

I have used Gamemaker Studio 2 before, briefly, and found that the xprevious and yprevious variables are extremely useful. ...
0
votes
0answers
11 views

How to stop timer in an android game application when the count flag increments to 4

I am writing a simple game application using android, in which a box has to collect balls which are shot towards it from the right side of the screen. Collecting Orange and pink balls would fetch ...
0
votes
2answers
53 views

How to store the progress of multiple users

When I start my game, it displays a level menu, and When I select a level, it's gonna create a game corresponding to the level and I can play. Now I'd like to store the progress of each user, ...
0
votes
0answers
27 views

Changing OpenGL Window Icon with JOGL

I am currently trying to change the window icon for my JOGL application. I have built my window off of the GLWindow framework and I have read that I need to link in with a framework like AWT, but I am ...
0
votes
1answer
28 views

glOrthof not being applied

I have had a problem with OpenGL where glOrthof is not being applied, leading to my frame having the default 1:1:1 ratio. Here is the code initializing it: ...
1
vote
0answers
59 views

algorithm to change the center of the image

I need and algorithm in Java if possible to change the center of the image when scaling.What is happening to me is represented in the first image: when I scale the image the image scale according to ...
0
votes
2answers
79 views

Project organization for a multiplayer client-server game

I'm programming a game 100% in Java but I'm having some issues concerning the final games architecture. I plan on having two separate projects: one that will hold the client side of communication ...
1
vote
1answer
44 views

JOGL KeyListener not functioning properly

I have been having a problem with the JOGL KeyListener where if I hold down a key, it would register the key as pressed for around 1 second, then it would start quickly switching back and forth ...
0
votes
1answer
120 views

How do I wait till an animation is finished?

I am currently working on a Warfare 1917 like game. Right now I am trying to get the combat system working. I have made animations for a running and shooting soldier. It takes exactly 0.5 seconds till ...
0
votes
0answers
5 views

Slick2D - Update method interrupted while dragging window

I am currently making a project using Java and Slick2D (yes I know there is no support for it anymore, but it is an old project I wish to complete, and it serves me fine so far). There is only one ...
0
votes
0answers
30 views

How could the DOS Quake 1's pixelated look be achived with openGL, for example: Limiting the Colors to 256? [duplicate]

I want to achive the DOS Quake 1's pixelated look and limit the displayed colors to 256 in my engine, but I don't know how to do that. And also, I'm using java. Here is the code of my Fragment shader:...
1
vote
1answer
29 views

How to decelerate Ship using Vector Objects in Java

I am developing an Asteroids type game in Java, using a custom Vector2D class for the Ship. I have a vector object for its position, direction and velocity. I am having an issue with the ship ...
6
votes
3answers
147 views

MUD programming: socket handling

I'd like to build a multi user dungeon in Java/C# (also open to other suggestions). Below I have listed two ways of handling connections, and would like to know which would be the recommended way? I ...
0
votes
1answer
39 views

Trying to understand why libgdx wipes existing models when creating new ones

I'm coding a simulated brain and I'd like to make an arrow appear when one cell connects to another cell. My output without generating an arrow looks like this: Where each block rendered represents ...
0
votes
0answers
120 views

Error: Program type already present: android.support.v4.app.NavUtils

Every time I try to build an APK file, it gives me an error. I fix one and then I get another and another. This was my last try: My gradle file: ...
0
votes
1answer
53 views

Orbital rotation equation

I am developing a space sandbox (3D). Now I am working on an asteroid belt around a planet. I have an Asteroid class and an ...
1
vote
0answers
35 views

No-duplicate collection without iterator allocation [closed]

Problem I need a collection with non-duplicate values minimising memory allocation during access operations. I am prepared to compromise with a slight decrease of performance to make up for the ...
0
votes
1answer
79 views

LibGDX: How to make an object falls with random speed

I'm trying to make an object (ball) fall into position Y and when the ball collides with the base. The sprite changes and along with the change I want the speed of the fall to change according to the ...
0
votes
2answers
120 views

Why can't I read this JSON file?

I get an error every time I try to parse this .json file. Here is the error: ...
0
votes
0answers
50 views

How can I send a Base64 Image?

I'm looking to make a post request with a base64 image. When I make the request, I get an error called "ERROR_IMAGE_SIZE_0" ...
0
votes
0answers
37 views

Friction makes entity move slightly backwards

I'm having some trouble getting my friction to act properly in my game. My current goal is to add a dash move - which is working fine except that a bug with the friction is messing with me. The Dash ...
0
votes
2answers
291 views

JavaFX - How do I create a health bar?

I tried searching online on how to implement health bar with Java FX in a 2D side-view Java fighting game but I can only find those that goes with 'awt' and 'Swing'. The health bar I'm picturing are ...
1
vote
1answer
63 views

Composing Game Metrics

So I'm running into a bit of a roadblock with the way I'm currently keeping track of game metrics. By "metrics", I mean little bits of information that I can compose together to get useful information ...
0
votes
0answers
31 views

Detect how many blocks can be moved given a grid of blocks

Let G be a grid of booleans where true means a block is there and false means there isn't a block there. Let P be the player, ...
0
votes
0answers
35 views

Specular/Diffuse light on an icosahedron opengl

I'm having a problem with my model here. I draw an icosahedron using GLUT, and the edge length is set to 0.8. The info of the coordinates are listed below: (X and Z are calculated since our edge ...
0
votes
1answer
74 views

How do I implement 3D A* Pathfinding in libgdx?

I am using BDX (Blender with libgdx engine) to create my game. I am not sure on how to implement 3D path finding using A* search. I looked into gdx-ai, but that is for 2D.
2
votes
2answers
50 views

Parabolic Jump Libgdx Without Box2D and With Vectors

I have tried to write a jump method that sketches out a parabolic jump but it results in either no movement, or a jerky upward movement when I try to scale up dt. I have the following things defined: ...
0
votes
1answer
48 views

Split tile based map file into multiple files

I have a gigantic map file (1440x1080) that I wish to split into smaller files (45x45) for faster client reading. I plan to split offline (when running DEV server) so I am not too worried about speed....
0
votes
0answers
26 views

Fail to Start android service in android studio Unity

I have written a service file in android studio like: Manifest file: ...
0
votes
2answers
245 views

Algorithm to detect impossible scenarios

I'm making a simple game where a surface is split up into 4 parts, rows, obstacles spawn in them, and a player tries to dodge them. Up to 3 obstacles are generated in each row, and this can lead to ...
0
votes
0answers
34 views

Item collision detection doesn't work

My GameWorld constructor has the following code inside it. ...