Tag Info

Hot answers tagged

32

It will cause one CPU core to always run on 100%. This usually doesn't cause any harm to the system. CPUs are designed to run on 100% for hours. But on a mobile device it will drain the battery quickly and heat up the device, which will likely cost you about a stars in your store ratings. On a desktop computer this is less of a problem, but it will consume ...


18

Demo GameDev Meta: Henshin Main!! :D The code uses a canvas clip region and requestAnimationFrame for maximum quality and efficiency. (It's better live.) I assumed you meant HTML canvas! Even if you didn't, other rendering engines (such as Android's 2D rendering pipeline, which you might have meant) also support hardware-accelerated clip regions. The ...


18

Storing the completion information in a local file is a simple and perfectly acceptable method of doing so. Fundamentally, this is what every game will do to track progress (in some fashion, although the specific formats used for the data and the storage mechanism will differ). Protecting the file from tampering is more difficult. If there's no compelling ...


15

Think of the problem like this: How does a snake move in the original game? The snake moves towards its current direction. The behavior looks like the head appears out of nothing, and the last tail part disappears. You can have a list of snakeparts. What you want to do is remove the last item in the list which represents the last tail part. Then you want ...


10

The PNG files are small because they are compressed. When the images are loaded into memory they are uncompressed and therefore take up more space.


9

What I would do is make the factions be simple symbols which represent their information regardless of members (name, description etc), and keep some sort of dictionary for each match, which keeps track of which players are in which faction. Dictionary<Faction, List<Player>> This also allows you to do more exotic stuff like players betraying ...


9

You can create a replay file as proof of work while the player is playing. Start the game, save the starting conditions including the name of the level and the pseudorandom seed, record the exact timestamped input states (mouse movements, key or button presses, etc.) that your game's input layer passes to its logic layer, and stop recording once the ...


8

Conceptually, you can do that by animating the rotation of the cube (or as in Bloxorz, a cuboid) 90 degrees around one of its edges. You don't need move() at all! Side-on view of one rotation: Here's a seriously good JMonkeyEngine tutorial showing you how to rotate Boxes around pivot Nodes. It explains everything step-by-step. These are the important ...


8

Talking about the "best choice" is always difficult, as long as you did not specify the task that you intend to perform in all detail. But here are several aspects to consider. First of all: Java is not C. The memory management is completely different, so one has to be very careful when trying to apply insights from one programming environment to another. ...


7

In order to get a server list, you will need a central matchmaking server to which all game-servers connect and announce that they are online and to which all game-clients connect to obtain the list of currently online servers. How many servers are you going to have? For comparison, I remember that during the high-times of the original Counter Strike, the ...


6

The formula returns a scalar (the height of the water surface at coordinates x,y), not a vector. It is hard to tell what the authors had in mind, because the paper is very confused, but my guess is that it should have looked like this: Y(x,y,t) = A * cos(w * f(x,y) + wt * t + FI) Where f is a function that controls the shape of the wave. This function ...


6

Well, technically speaking you can generate textures using any language. Even if you don't have any output on screen, as far as your language can represent integer/float (could get away with integers) and arrays, you are good to go. The problem though is that not every texture could be generated procedurally. You usually need a formula as a stating point to ...


6

It's definitely possible, you would just need to create a thin layer wrapping the Steam SDK (or part of it) to java via the Java Native Interface I'm not aware of any efforts to have an opensource library for this.


6

Sphere-Sphere Intersection Let's start with the more obvious one - sphere-sphere. It's almost identical to the circle-circle case in 2D. We can project down on any plane containing the line between the sphere's centers to get an identical 2D picture: Here the first sphere has center c_1 and radius r_1, the second c_2 and r_2, and their intersection has ...


6

The simple solution would be to just discard and recalculate the power distribution in the whole grid whenever you make a change. Considering that your grid is only 18x18, it shouldn't be too computationally intensive to do so. Inverters might be problematic, though. What do you want to happen when the player connects the output of an inverter to its input? ...


6

I have good news and bad news for you: The Bad News: I don't know or remember any Java library that does what you want The Good News: It's really easy to implement this type of algorithm yourself! Here's a couple, you can mix them to optimize your collision detection depending on the type of shape. BB Collision Detection You can imagine a box around ...


6

How are you passing your normals to the vertex shader? It looks like those are the normals for each of the six faces of a cube, but the vertex shader operates on vertices, not faces. Unless you're doing something unusual, you need to specify a normal for each vertex. In addition, if you want a cube to look right, you will need 24 vertices rather than 8, so ...


5

You have incorrectly implemented the formula as a function. The function is missing + 1 after the call to Math.sin(), which moves the wave to the range [0, 2]. Regarding your second problem, I don't see anything wrong. In fact the screenshot looks exactly like it should and seems to match the plotted curve. Try with k=10 and you should see the difference ...


5

Disclaimer: I have not used libgdx or Java before, this answer borrows syntax from the question and official documentation, and the code is untested To make the bodies 'fall' under the influence of gravity in box2d, you must first pass a non-zero gravity vector to the b2World when constructing the world World world = new World(new Vector2(0, -10), true); ...


5

I assume you really want to know two things: Will Steam accept my Java game? What do I need to do to make it work on Steam? The answer to #1 is "yes." Steam hosts other Java games (like Spiral Knights). For #2, I suggest you package your game using launch4j. This will provide you with native (Windows, Linux) wrappers around your application. Other ...


5

You seem to want to keep the same textsize/screensize ratio. Basically what you do is develop at one resolution and let that be scale 1.0. Then you divide the new screen width by the old width and that is your scale factor. For example. Developing on 2560x1440 with font size 16 and running on 1920x1080. Font size will be: 1920 * 16 / 2560 = 12 I do the ...


5

The problem is you need to close the loop, to make sure the lasso is complete (based on the behavior of the video). You do that by testing if one of the segments intersect with another segment, thus closing the loop. It might look something like this (note I don't use libgdx, so this is untested): Array<Vector2> path = p.getPath(); // Look for an ...


5

As others have said, the first step is separating logic that's shared from logic that's not. While it's great to draw that line wherever it's clear, your addendum illustrates that sometimes you don't have a clean line to split the code down. So, how do we solve cases where the client and server want to do semantically the same thing (play a sound), but take ...


5

Sarting with the clouds, a simple method is to draw them as three layers: Layer 1 is the bottom layer, and is drawn first. It just contains the cyan background. Layer 2 is the middle layer, drawn between the other two, and it represents the 3D highlights. The background in this layer would again be transparent (represented by a purple colour in the ...


4

I'm guessing you have 64 bit java installed. The ParticleEditor.jnlp fails to run on a 64 bit JRE. What you would want to do is: Download a 32 bit version of JRE. Here is the Oracle link for that: http://www.oracle.com/technetwork/java/javase/downloads/java-se-jre-7-download-432155.html Just make sure you select a "x86" version of the JRE from the list, ...


4

You do not divide a screen into tiles, you create a field that renders tiles in a grid sequence. Those are usually some sort of bitmaps that are stored in memory and are placed one after another to form a bigger picture - the tile grid. For a 2 dimensional grid, you'd use two for..loops (one inside another) to render rows and columns. for(int i=0; ...


4

You need to create a new instance for each item in the array. String[][] blankM = new String[arraySize][]; for (int i = 0; i < arraySize; i++) { blankM[i] = new String[]{"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1"}; }


4

You should create a priority queue binary heap to keep track of burning tiles. The priority here is determined by the amount of time left until the event of interest occurs, in this case from what you asked I presume that is the time when the neighbouring tiles will be set ablaze. You shouldn't loop and decrease the delta from each of them. You should ...


4

What you are looking for can be found in this very good explanation: http://www.songho.ca/opengl/gl_transform.html But since I found it sort of confusing without hand holding I will try to explain it here. At this point you need to consider 5 coordinate systems and how they relate to each other. These are the window coordinates, the normalized device ...


4

Java defaults to using GDI (AWT, Swing). JavaFX supposedly will be able to make use of OpenGL in future. Java + LWJGL (an OpenGL wrapper that accesses native opengl32.dll via JNI) provides more direct hardware-accelerated support for Java. Flash Player 11 onward made use of OpenGL via Stage3D. Without using Stage3D, it is using a software renderer built to ...



Only top voted, non community-wiki answers of a minimum length are eligible