Java is both a popular 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
2answers
237 views

How to stack units in a tile based game?

I'm trying to make it so that no more than 5 units can be stacked on a tile. I have a Tile class that creates each tile's preferences. Should I store the units in an array or arraylist in this class?
0
votes
1answer
697 views

How do I spawn enemies with a delay using threads?

Right now I have this: Thread enemySpawner = new Thread(new Runnable() { public void run() { if(world.getCurrentState() == gameState.GAME) { world.spawnEnemy(x, y); ...
1
vote
1answer
268 views

Alternative to JSF for browser-based 4X game [closed]

I intend to make browser based MMO game. Something from Master of Orion genre but with more accent on command ship operations. I've done some tests and research and turns out that indeed, for ...
5
votes
2answers
815 views

One Dimensional Perlin noise vs Multi-Dimensional

I am reading through a book called "The Nature of Coding" and I am working on porting the examples from Processing.js to Regular old Java. The example I am on uses the following method call in ...
4
votes
1answer
1k views

Need info on creating a tile grid data structure in Java

I'm trying to create a game with a fixed size map (2D Tile array). I suppose I can inherit other tiles from this base Tile, e.g.: a BankTile. Placing and removing tiles is all too easy, but forming ...
1
vote
0answers
124 views

2D Java Networked Game Coordinate Updating [closed]

I'm currently developing a networked 2D MMO-style game in which several thin clients (ran in an applet) are able to connect to a server and well, do MMO-style "things"! Some more background on the ...
1
vote
1answer
126 views

Deciding when to switch focus between UI elements

I've been coding a simple logic game recently and there is a UI decision that has been bothering me. Since certain blocks of logic are going to be used across many levels (e.g. logic to reverse the ...
2
votes
2answers
2k views

How do I get the touch event on a body in Box2d(Java)

I have various bodies rotated at some angle with the help of Box2d in libGDX. What I want is to destroy the body when I click on it, but the problem is that I am not able to get the area definition of ...
0
votes
1answer
671 views

Texture will not rotate with gluSphere

I have a gluSphere generated in my display that is rotating, but having a problem with the texture rotating with the sphere as well. So in a nutshell, no matter how the sphere rotates, the texture ...
1
vote
1answer
193 views

Drawing Projected Vertices/Faces In Order

I recently created a 3d engine, and have gotten to what is (as I've found) the hardest part so far. I need to sort the objects and then draw them. I've looked at sorting algorithms, but my case is ...
1
vote
1answer
272 views

Mapped texture to a gluSphere not wrapping correctly

I have a 3D sphere rendered using JOGL by means of GLUquadric. I'm trying to add a texture but it is not rendering as correctly. Does anyone understand why the texture (upper-right of sphere) isnt ...
7
votes
4answers
469 views

Implementing AI to hide behind obstacles

I am developing an AI simulation of predator and prey. I would like to simulate the AI hiding behind obstacles, if it is being chased. But I am still trying to figure out the best way to implement ...
0
votes
2answers
1k views

Cant import Sun openGL

I've been working with JOGL and I've ran into a problem. The problem is when I try to import import com.sun.opengl.*; on Eclipse, Eclipse doesn't recognize it. Does anyone know where this library is? ...
1
vote
3answers
2k views

How can I remove enemies from my ArrayList after they have died? [duplicate]

Possible Duplicate: How do I best remove an entity from my game loop when it is dead? Right now, I have an ArrayList like this: List<Enemy> enemies = new ArrayList<Enemy>(); ...
1
vote
1answer
812 views

TextureRegions and TextureAtlases in AndEngine

This is my first android game, sorry if my code is bad, any advice will help. I am trying to find ways to improve performance on a game of mine, I'm using AndEngine GLES2. I have a basic question ...
5
votes
4answers
2k views

Should each Entity have its own update and render methods?

First, the questions: Should each Entity (which are classes like Character, Tree, Enemy) have its own update() and render() methods? If that's the case, then should I use Interfaces like ...
4
votes
1answer
516 views

Splitting logic into threads in Java tower defence game

I'm making a tower defence game in Java! It's my first game development. I want to know how many threads Do I need to create in a game, to split logic.. I've made this one: Main App thread (adds ...
15
votes
2answers
973 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 ...
2
votes
2answers
781 views

How to get enemy to follow character using angles? (atan2)

I have an enemy and a character to control. I want to get the enemy to follow the character in a straight line. I already found the angle in which the enemy needs to travel. double angle = ...
0
votes
2answers
94 views

Pathfinding with Less Desirable Squares that are still passable

I have been looking at different path-finding algorithms for my game. I have almost settled upon D* Lite, but have a question. (perhaps I missed it in the documentation) - Are there any algorithms, ...
1
vote
2answers
2k views

Applying Forces to Box2D Bodies

In full disclosure, I am VERY new to box2D let alone the Java version of it. I have a box (here of type Hero) that I am trying to move. I did this by trying to apply a force as follows... private ...
0
votes
1answer
412 views

OpenGL first person camera orientation issues [closed]

I have a "camera" in my opengl program that I recently finished. However, I've noticed that whenever I rotate and then move again, the x, y, and z angles change. For example, when I press the "w" key, ...
1
vote
1answer
461 views

Keeping Track of Position OpenGL

I have a sphere in my 3D world located at the origin. I have models orbiting it and I need to keep track of each models' position (x, y, x coordinates) as well as update their bounding boxes for ...
-4
votes
1answer
265 views

Viability of Java as a game language [duplicate]

Possible Duplicate: Is Java viable for serious game development? I have been learning Java for a few months now, and there were a few things I was thinking about based on what I know about ...
-1
votes
1answer
243 views

OpenGL glMatrixMode rotation

I'm stuck on trying to figure out how to rotate the viewport(or camera). So far I've figured out I need to use the function glRotatef and glMatrixMode(GL_MODELVIEW). But I have no idea how to apply ...
0
votes
1answer
774 views

Does using LWJGL and Slick2D yield promise for the future of my project? [closed]

I've been looking around the net for months now in an attempt to find the most appropriate tool for my needs. I haven't had a lot of time to devote to the creation of systems that could possibly ...
2
votes
1answer
185 views

Is this an appropriate use of abstraction in my game engine?

I have been stuck in the design phase on my new game for a few weeks now because I keep finding new parts of the game engine that I could make more modular and neat. I did, however, run into a ...
2
votes
1answer
505 views

Is jButton in Java suitable for a Game GUI?

Recently I have encountered the issue of trying to add a GUI into my game using Swing. The game will randomly & infrequently flash the jButton or Swing component when I add it to my jFrame. I'm ...
-2
votes
1answer
146 views

Java Translate Key Input [closed]

I decided to randomly start a small OpenGL 2D game, and the problem is, my keyboard input isn't working. There are no errors or anything, however, the little square I've created refuses to move. ...
-2
votes
1answer
395 views

Non Updated Paint Graphics in Java

I want the tank to move in the screen but it doesn't update at all. If I am going to draw a ball...an oval...it does move in the screen, but since I want a picture to do so, I used the image method, ...
-1
votes
1answer
153 views

Java creating new Sprites coding problem

So I'm trying to load various different types of grass Sprites from the same spritesheet. However, the code looks really ugly. The thing is I have public static Sprite grassi = new ...
2
votes
1answer
438 views

onSceneTouchEvent Triggering more than once on one click in Andengine

I am making a simple american football game, and I'm having an issue with the onSceneTouchEvent function, I have this code: public boolean onSceneTouchEvent(final Scene pScene, final TouchEvent ...
7
votes
2answers
3k views

Server side game loop

Many java games use thread.sleep() to controll fps. Since the server does not display graphics, should the server game loop keep running just calculating delta time? Like this example: long ...
87
votes
12answers
8k 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 int, or something else? In my use-case, most transactions will use ...
3
votes
2answers
583 views

Syncing game states in a multiplayer RTS game

I'm working in a group with 2 friends on our Gr. 12 final project for programming. We're making a multiplayer RTS game. I've been assigned to the networking section of the game, and none of us have ...
1
vote
2answers
251 views

Tween Animation Cannot Start

Do you have any reasons why my tween code didn't run or work? I already add the tween engine onto the library folder under LibGDX project folder and "Order and Export" it under Java Build Path at the ...
4
votes
2answers
2k views

Bitmap Font Displays in Center Always Without Coding it Manually (Fix Coordinate Problem onText)

Is there a way on how to stay the texts in center without manually coding it or something, especially when making an update? I'm making a display for the highest score. Let's say that the score is 9. ...
1
vote
2answers
516 views

Quaternion Camera

Can someone help me figure out how to use a Quaternion with the PerspectiveCamera in libGDX or in general? I am trying to rotate my camera around a sphere that is being drawn at (0,0,0). I am not sure ...
2
votes
1answer
716 views

libGDX using Stage and Actor produces different camera angles on desktop and Android Phone

libGDX using Stage and Actor produces different camera angles on desktop and Android Phone. Here are pictures demonstrating the problem: http://brandonyuh.minus.com/mFpdTSgN17VUq On the desktop ...
2
votes
1answer
547 views

Abstract skill/talent system implementation

I've been making small 2D games for about 3 years now (XNA and more recently LWJGL/Slick2D). My latest idea would involve some form of "talent tree" system in a real time game. I've been wracking my ...
1
vote
1answer
736 views

Using Quaternion in libGDX

Can someone give me an explanation about how to use the Quaternion class in libGDX to move my camera around a sphere or just set it up, manipulate it, and apply it general? I am trying to acheive ...
1
vote
1answer
1k views

setPosition of Sprite onUpdate in AndEngine

I am trying to get a "highlighter" circle to follow around a sprite, but I am having trouble, I thought I could use the onUpdate method that's available to me in SequenceEntityModifier but it's not ...
1
vote
1answer
1k views

Moving sprites on a graph in libGDX

In my game I'd like to move sprites on a fixed path. Until this point I was trying to stick with the tools already provided by libGDX, like the Tiled map renderer classes so I'm looking for a solution ...
2
votes
2answers
3k views

Move Camera Freely Around Object While Looking at It

I've got a 3D model loaded (a planet) and I have a camera that I want to allow the user to move freely around it. I have no problem getting the camera to orbit the planet around either the x or y ...
5
votes
1answer
821 views

Isometric - precise screen coordinates to isometric

I'm trying to translate mouse coords to precise isometric coords (I can already find the tile the mouse is over, but I want it to be more precise). I've tried several different methods but I seem to ...
9
votes
1answer
337 views

Estimating costs in a GOAP system

I'm currently developing a GOAP system in Java. An explanation of GOAP can be found at http://web.media.mit.edu/~jorkin/goap.html. Essentially, it's using A* to plot between Actions that mutate the ...
1
vote
1answer
251 views

OutOfBounds Exception when creating a PolygonShape using jbox2d

So here's the deal, i'm parsing a file that contains the vertices for a polygon, that i want to create in box2d. I create a new PolygonShape() and then call .set() giving it a defined array of Vec, ...
1
vote
2answers
2k views

Reversi/Othello early-game evaluation function

I've written my own Reversi player, based on the MiniMax algorithm, with Alpha-Beta pruning, but in the first 10 moves my evaluation function is too slow. I need a good early-game evaluation function. ...
0
votes
1answer
212 views

SFX Played Once per Collision or Hit

I have a question about using Box2D (engine for LibGDX used to make realistic physics). I observed on the code that I've made for the physics here below: @Override public boolean touchUp(int screenX, ...
-1
votes
1answer
91 views

Why are only some of my objects being rendered?

Every time I create a new asteroid the previous one is no longer rendered? I did some debugging and printed out the size of Array-List 'Small' and when a new asteroid is created it doesn't go down, ...