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.
3,436
questions
96
votes
12
answers
16k
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 ...
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 ...
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?
38
votes
6
answers
24k
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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, ...
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 ...
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 ...
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. ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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?
15
votes
3
answers
13k
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.
...
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 ...
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 ...
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, ...
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?
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?
14
votes
4
answers
28k
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 ...
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 ...
14
votes
2
answers
620
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 ...
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 ...
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?
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 [...
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, ...
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 ...
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,...
13
votes
1
answer
918
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 ...
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 ...
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". ...
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 ...
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 ...
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. ...
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 ...
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 ...
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:
...