-1
votes
0answers
24 views

Double buffering a rectangle

It always works with images but rectangles and ovals never buffer right. I have a basic game loop in my gamepanel class that draws the player repeatedly. It doesn't remove the rectangle, just leaves a ...
0
votes
0answers
30 views

How can I add graphical objects to my gameloop [on hold]

I have a basic game loop and I will edit the thread art in the loop later. I don't use the keyevents yet but how would I add images to it from another class. Let's say I have a player class. In the ...
0
votes
0answers
32 views

How to render graphics in java [closed]

I'm using thechernoproject's code from youtube and for some reason I cant get a black rectangle to fill the screen in my render method. : package com.thecherno.rain; import java.awt.Canvas; ...
0
votes
0answers
37 views

Good site to begin learning Game Dev. in Java [closed]

I have a basic understanding in java which I should review, and am confused on the different ways people program in youtube videos. can someone point me where to start properly, yet a bit advanced. ...
1
vote
1answer
93 views

Game Update in Libgdx

In libgdx, the game loop is the render() method. But why is that, and is there a way where I can make an update() method that is called 60 times a second? As in the update() method, I would add the ...
-1
votes
1answer
95 views

why are there draw rate and update rate in fixed time step game loop?

http://www.gameprogblog.com/generic-game-loop/ Java boolean onLoop( Game game, GameState state, GameInput input, Graphics2D gr ) { long nanosElapsed = state.tick(); updateTime += nanosElapsed; ...
2
votes
2answers
572 views

Why do my update and draw loops throw a concurrent access exception?

I've taken up the challenge of creating a basic 2D side-scrolling monster truck game for my little brother. It seems easy enough in theory, but jumping into Java out of XNA feels strange. My game ...
1
vote
0answers
436 views

How to implement the server-side game loop?

The server needs to handle the physics, because all the movement will be handled by it. So for that I need a game loop. The thing is that the server doesn't have the render part, it's just a console. ...
1
vote
0answers
83 views

Accessing variables from non-neighbouring classes specifically in game development (Android) [closed]

Edit Using direct access while breaking the law of demeter looks like this: res.sprite.drawQuad(res.sprite.xScreen,res.sprite.yScreen, mMVPMatrix); Using proxy methods / getters / setter looks ...
-1
votes
1answer
163 views

Get distance between the edge of screen and a moving sprite

How to get the distance between the edge of the screen and a vector moving sprite? I want to get the distance between my moving sprite and the edge of the screen so that when my sprite touches the ...
0
votes
6answers
855 views

Avoiding constant IF checks for loops

As an example, I have 3 different loops that are executed in certain conditions. I want to know if there's any way short of something like this: if(day) x++; else if(night) y++; else z++; ...
2
votes
1answer
181 views

How to implement a multi-platform Java 2D game engine's graphics?

I'm not sure whether this question should be posted here. I'm trying to make a basic generic game engine in Java. Here's what I have so far. public abstract class Device { public abstract void ...
2
votes
2answers
537 views

Why are my game ticks longer than expected?

I was working on my game, adding stuff to it, when I noticed my ticks were in the low 50's when I had set it to do a constant 60. This is my run method. public void run() { init(); long ...
7
votes
2answers
1k views

Java 2D game programming: Different approaches to make a game loop

I am new to Java game programming, but the more I read the more I'm confused, because I've seen several different approaches to make a game loop: 1. The standard approach, that uses the Timer class ...
4
votes
1answer
2k views

The most efficient and accurate game loop?

Obviously for a game to work you need a game loop... Normally, my game loop would consist of something like this: while(running){ update(); render(); Thread.sleep(10); } This seemed to ...
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 ...
1
vote
1answer
155 views

Problem with Scanner class in Java [closed]

I'm pretty new here (as though to a game development). So here's my question. I'm trying to organize a really simple game cycle in my public static main() as follows: Scanner sc = new ...
0
votes
1answer
365 views

How to make this game loop deterministic

I am using the following game loop for my pacman clone: long prevTime = System.currentTimeMillis(); while (running) { long curTime = System.currentTimeMillis(); float ...
2
votes
2answers
972 views

Why does my game loop speed vary on different platforms with the same hardware?

I've got a serious issue with my game loop. This loop varies in time with the platform and with the same hardware. This is a list of FPS achieved: - Windows ======= 140 to 150 - Linux ...
0
votes
2answers
349 views

Negative timeout value in Variable Timestep loop

I was working on my game loop and I came across an odd problem. The loop was working fine, my states could render, received updates, etc. I then proceeded to create my Input system, which, also works. ...
0
votes
1answer
597 views

Java2D Game Flickering

I'm in the process of trying to get familiar with making games in Java, using the Swing library. Coding my Snake game however, I've got to a point where the game is flickering/ghosting and I haven't ...
0
votes
1answer
377 views

Rendering Loop Problem (Java)

I'm not new to programming, but I am relatively new to game programming. I am trying to create a version of Breakout, as a good basic game to get myself introduced to 2d game programming. I currently ...
-2
votes
1answer
171 views

Issues with networking in my Java game, Client crashes when I try and read from the server input

A buddy and I have been programming a code game over the last 2 weeks, it is intended to be a multiplayer game with the ability to have 2 players play against each other. I am running into an issue ...
11
votes
2answers
5k views

how should i develop my android game efficiently?

I have attached a image of a flow chart that i made in paint. The image shows how i want to develop my game. I want a game that runs great with smart coding that is easy to update and ad features ...
3
votes
1answer
234 views

How can I organize code for views efficiently?

I'm making a video game for the Android platform and I need advice on the overall set up of the activities and views in the code. I don't need actual code, psuedocode will do, but actual code always ...
-3
votes
1answer
1k views

What can be the cause of sudden lag spikes in my Android game?

My Android game has sudden lag spikes sometimes. I know this is due to something going wrong. My phone has a 1GHz processor so there shouldn't be a problem. Basically I use the Canvas class to render ...
7
votes
2answers
2k views

Multi threaded game - updating, rendering, and how to split them

From the StackOverflow post (it was recommended I move this): So, I'm working on a game engine, and I've made pretty good progress. However, my engine is single-threaded, and the advantages of ...
4
votes
4answers
17k views

Android game scrolling background

I'm just trying to figure out the best approach for running a scolling background on an android device. The method I have so far.... its pretty laggy. I use threads, which I believe is not the best ...
5
votes
2answers
457 views

Physics in my game confused after restructuring the Game loop

I'm on my way with making a game in Java. Now I have some trouble with an interpolation based game loop in my calculations. Before I used that system the calculation of a falling object was like ...
3
votes
1answer
2k views

Handling game states for Android

Currently developing a game for Android. I went through a tutorial to get sprites, loop, etc. up and running, and it all works fine. The way it is currently set up is that Main creates a canvas, the ...