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
96 votes
12 answers
15k views

What data-type should I use for in-game currency?

In a simple business simulation game (built in Java + Slick2D), should a player's current amount of money be stored as a float or an ...
Lucas Tulio's user avatar
  • 1,317
65 votes
8 answers
84k views

Is Java viable for serious game development? [closed]

I have scoured the internet, but there are not very many resources for Java game development, not nearly as many as C++. In fact, most engines are written in C++. I tried to play a game made with ...
tehtros's user avatar
  • 1,093
41 votes
5 answers
10k views

How can I give the illusion of height to a ball in 2D?

In 2D top down soccer games, sometimes a ball is given the illusion of being in the air, like below: How can I achieve this?
Donald's user avatar
  • 524
38 votes
6 answers
23k views

What is a good file format for saving game data? [closed]

I need to save some custom game data. Map, player, etc. All of them will have "sub objects". For example, a map and map will have an "array" of tiles. ie, hierarchical data. Hopefully nothing ...
user697111's user avatar
35 votes
7 answers
20k views

How can I improve rendering speeds of a Voxel/Minecraft type game?

I'm writing my own clone of Minecraft (also written in Java). It works great right now. With a viewing distance of 40 meters I can easily hit 60 FPS on my MacBook Pro 8,1. (Intel i5 + Intel HD ...
Martijn Courteaux's user avatar
23 votes
3 answers
9k 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 ...
Darin Beaudreau's user avatar
23 votes
4 answers
1k views

How to implement a never-rebooting test world?

Am looking for ideas on how to do the following: I want to write a simple "world" in Java. One which I could start and then add new objects later at a later date to simulate/observe different ...
d33j's user avatar
  • 486
21 votes
3 answers
14k views

Polling vs event driven input

I'm developing a game using polling for the input method. However, now that I'm delving deeper into the game menus and other UI components, I'm finding that I'd probably like to have event driven ...
House's user avatar
  • 73.2k
21 votes
2 answers
9k views

How can I define items in my RPG like Java game?

I am casually working on an RPG type game in Java but I am having trouble figuring out how I can have items that can do many different things without creating a different class for every item. As an ...
MESLewis's user avatar
  • 499
20 votes
8 answers
13k views

Imperfect pong AI

So I'm starting to learn Java and some OpenGL while using the LWJGL. To start off easy, I'm writing a clone of the Atari Pong. I got set up correctly the game screen, collision detection, and all the ...
Setzer22's user avatar
  • 480
20 votes
4 answers
8k 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 ...
dot_Sp0T's user avatar
  • 2,032
18 votes
2 answers
11k views

LibGDX - Check if currently on Android/Desktop

I'm using LibGDX and flixel-android to build a Desktop/Android game. It feels like there should be a way of checking to see if you're currently being run on an Android device, the Desktop, and so on, ...
mtrc's user avatar
  • 301
17 votes
3 answers
5k views

How do I efficiently code both the client and server at the same time?

I'm coding my game using a client-server model. When playing on singleplayer, the game starts a local server, and interacts with it just like a remote server (multiplayer). I have done this to avoid ...
liamzebedee's user avatar
  • 1,256
17 votes
14 answers
2k views

Advice for a first year CS major [closed]

I'm coming to the end of my first year of CS which has been primarily a Java based course. I'd like to get my feet wet with some game development but I'm not sure where to start. Some people have ...
kontrarian's user avatar
16 votes
10 answers
5k views

Random noise based on seed

I am currently working on a program that should generate random noise on a screen based on the 'coordinates' of a pixel. The coordinates should have the same color every time you restart the program. ...
dragonfly's user avatar
  • 365
16 votes
3 answers
27k views

How can I make OpenGL textures scale without becoming blurry?

I'm using OpenGL through LWJGL. I have a 16x16 textured quad rendering at 16x16. When I change it's scale amount, the quad grows, then becomes blurrier as it gets larger. How can I make it scale ...
adorablepuppy's user avatar
16 votes
6 answers
7k views

Can I develop games for mobile platforms in C++?

I have a good grasp in C++ and C and have also experience developing AAA game using C++. Now, I'm shamelessly thinking to dive into mobile game development either in iOS or Android. Unfortunately, I ...
James Bern's user avatar
16 votes
1 answer
22k views

OpenGL: Resizing Display and glOrtho/glViewport

I have researched this question from several sources and have yet to find a firm answer saying that "yes that is correct thinking" or "no, here is how it's done." I am trying to ensure resolution ...
user avatar
16 votes
1 answer
8k views

A* navigational mesh path finding

So I've been making this top down 2D java game in this framework called Greenfoot and I've been working on the AI for the guys you are gonna fight. I want them to be able to move around the world ...
angrydust's user avatar
  • 261
16 votes
1 answer
18k views

Making a HUD/GUI with OpenGL (LWJGL)

I'm at the stage in my game development where I need to make a HUD or GUI. I've never gotten to this part, so I don't know how its done. I tried rendering a simple quad at a fixed position on the ...
smoth190's user avatar
  • 916
16 votes
8 answers
8k views

How do I create tileable solid noise for map generation?

Hey guys, I'm trying to figure out how to generate tileable fractals in code (for game maps, but that's irrelevant) I've been trying to modify the Solid Noise plug-in shipped with GIMP (with my ...
Nick Badal's user avatar
15 votes
4 answers
3k views

Procedurally generating a building of specific area

Myself and a team are working on a factory builder game that gives the player a random factory at the start of the game. To try to make sure there is a sense of "fairness," ideally the randomly ...
user2129189's user avatar
15 votes
3 answers
23k views

Is there an algorithm for a pool game?

I am looking for algorithm to calculate direction and speed of balls in a pool game. I am sure there has to be some type of open source code for this since pool games are some of the oldest computer ...
user avatar
15 votes
4 answers
2k views

How can I implement a global high score ladder? [closed]

Are there any existing frameworks I can build on? Should I build my own? How can I prevent fake scores from being posted to it?
Bryan Denny's user avatar
  • 5,103
15 votes
3 answers
12k views

LibGDX Game vs ApplicationAdapter

When I create a new LibGDX project the main class of Core project extends ApplicationAdapter. Here is how it looks like. ...
Vahe Muradyan's user avatar
14 votes
6 answers
2k views

Am I hurting myself by not knowing C++ for game design? [closed]

Right now, I feel I am strong in both Java a C#. (Not much of a leap from one to the other really). While I don't expect a game designer/programmer is an attainable goal early on in my career, This ...
Nayrb's user avatar
  • 745
14 votes
3 answers
25k views

How do I make an entity move in a direction?

I have an Entity instance which is updated every game tick. Let's just assume that entity moves forward constantly. I'd like to be able to give the entity's angle ...
Shaun Wild's user avatar
14 votes
2 answers
2k views

How do I create a World Healing Wave effect?

I want to change my dark and depressing background to a happy grassy background, in real-time, such that the happy background is shown in a radius around a game character. A forcefield of happiness, ...
Green_qaue's user avatar
  • 1,903
14 votes
2 answers
4k views

Why is C/C++ preferred for game developers?

Some people say it offers more control to developers, but what is it precisely that can be controlled through C++ which can't be controlled using, for example, Java?
Paul's user avatar
  • 149
14 votes
8 answers
10k views

C# (Mono)/Java 3D Game Engine recommendation [closed]

Can you recommend a good C# game engine for cross platform (Win/Mac/Linux, I don't care about consoles) development? I've got some experience with raw OpenGL and I played around with Java bindings ...
14 votes
2 answers
16k views

How to: Java Game on Eclipse to Steam Direct

I want to create a game using Java and later put the finished product to Steam Direct. How does the whole process work after the game is finished and running on Eclipse?
Sierox's user avatar
  • 265
14 votes
4 answers
27k views

How to load 3D models into Java?

Using LWJGL what is the easiest way to load a 3D model to be drawn on screen? I know LWJGL doesn't have built in loading support so I am looking for a small library that would help to load ...
MESLewis's user avatar
  • 499
14 votes
2 answers
13k views

How would I implement procedurally generated tiles in libgdx?

I'm creating a simple top down Zelda-esque game in libgdx, and I want to implement tile-based dungeons that are procedurally generated, similar to this. Libgdx does have a class called TiledMap which ...
camden's user avatar
  • 261
14 votes
2 answers
616 views

Territory patrol planning

I am developing a game/simulation where agents are fighting for land. I have the situation shown in the picture below: These creatures are walking around and occupying pieces of land they step on if ...
Tohmas's user avatar
  • 379
14 votes
2 answers
1k views

Graphics not being displayed on OUYA

I hope its not too early to be asking OUYA dev questions, but I just got my dev kit and I want to get my game running ASAP! I am using LibGDX as my framework for my game and launching the Android ...
Amplify91's user avatar
  • 1,217
13 votes
6 answers
21k views

How do I shuffle cards for a card game?

I am trying to develop an card game for Android Can anyone suggest me how to write code for effectively shuffling the playing cards?
kishore's user avatar
  • 131
13 votes
2 answers
4k views

How do you handle uneven tiles while rendering a tile map?

Here is what I want to do with my tile map that I am unsure of. As you can see the top walls are way larger then the bottom and side ones (this is also an issue with my corners which are odd shapes [...
Latency's user avatar
  • 350
13 votes
4 answers
6k views

Is it possible to implement Steamworks functionality in a Java game? How?

I have a basic game that I want to eventually turn into something better. The game is all Java as of right now, but I want to implement the Steamworks SDK into my game (so it can have achievements, ...
1Poseidon3's user avatar
13 votes
2 answers
26k views

How can I move a sprite in the direction it is facing?

I'm using Java/Slick 2D. I'm trying to use the mouse to rotate the sprite and the arrow keys to move the sprite. I can get the sprite to rotate no problem, but I cannot get it to move in the direction ...
rphello101's user avatar
13 votes
3 answers
2k views

Object of arrays or array of objects?

I'm making a management sim game, something along the lines of Roller Coaster Tycoon. I want to know what the best way to structure my world objects is so to maximise performance. Let's say I have 5,...
ali_goes_oosh's user avatar
13 votes
1 answer
917 views

When and why is a Pool class needed to hold objects?

I've been studying opengl es and an example I saw was using a "Pool" class to keep track of touch and keyboard events. Could someone please explain how and why a pool class is needed. From what I was ...
jaysonpowers's user avatar
13 votes
2 answers
22k views

How different is Java for JRE vs Java for Android?

I'm new to all this game developing, and I'm starting to learn java because I was told it was a great way to start. I want to later on create games for the android market, and want to get a good view ...
Wingless's user avatar
  • 157
13 votes
2 answers
15k views

How do I make a pop-up window with Scene2D?

I have a main-menu screen with a logo and a bunch of buttons. When the Login-button is pressed, I pop up a dialogue asking for a username and password. This works fine, other than the "popping up". ...
Gibbo's user avatar
  • 276
13 votes
3 answers
9k views

Composition heavy OOP vs pure entity component systems? [closed]

I admit, I have made the sin of overusing, and even abusing inheritance. The first (text) game project that I made when I was taking my OOP course went as far as "Locked door" and "unlocked door" from ...
Midori Ryuu's user avatar
13 votes
2 answers
5k views

How do I tackle top down RPG movement?

I have a game that I am writing in Java. It is a top down RPG and I am trying to handle movement in the world. The world is largely procedural and I am having a difficult time tackling how to handle ...
WarmWaffles's user avatar
12 votes
2 answers
16k views

How do I render terrain in a 2.5D perspective, like in the game Don't Starve?

I have experience in making 2D side scroller games such as Terraria, but now I want to challenge myself and make a game that has a 2.5D perspective. The game I am trying to mimic is Don't Starve. ...
Hamdan's user avatar
  • 123
12 votes
8 answers
10k views

Converting a 2D curve into points for data storage

I’ve created an algorithm which converts any curve i.e. path into minimum number of points so that I can save it into a file or database. The method is simple: it moves three points in equal steps ...
Lumis's user avatar
  • 964
12 votes
2 answers
8k views

Am I allowed to make my Minecraft clone open source?

I'm developing in my spare time a game like Minecraft. In fact, it isn't "like Minecraft", because I'm trying to make it a close as possible copy of it (meant as exercise for myself at the age of 16 ...
Martijn Courteaux's user avatar
12 votes
5 answers
3k views

2D Game dev and Java. Other possibilities than OpenGL? [closed]

I recently started to program some basic OpenGL stuff in Java, but OpenGL and DirectX is too much to handle and to understand for me and I'm getting bored really fast. Now I am wondering if there are ...
12 votes
2 answers
18k views

Breakout Collision: Detecting the side of collision

I am writing a breakout clone (my first game) and am totally stuck as to how I figure out which side of the brick was hit. I have a collision detection method that looks like this: ...
user590903's user avatar

1
2 3 4 5
69