Tag Info

Hot answers tagged

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 ...


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 ...


5

Here's a vector-based solution. I haven't tried it, but it seems fine conceptually. Theory I gather you've stored the shape as line segments. Here's the letter A represented with three line segments. I've assumed that paths in the user's drawing are stored as lists of points. We can "inflate" those line segments to allow an error margin when checking ...


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 ...


3

You could achieve this effect using parallax scrolling by making the earth and each shade of green a separate layer. With a parallax effect, no 3D calculations are required, and you get to stay with the pixelated, simple color style you're using. Note that parallax doesn't have to be limited to just horizontal motion. Vertical movement (when the camera ...


3

If you want to do this totally in the client side and you don't consider the private storage provided by your platform to be secure enough (e.g. if there's actual money involved in completing levels), what you need is a proof of work. Your save file must contain an information that is designed such that creating the information is difficult to calculate ...


2

I use Interpolation.bounceIn.apply(current_position, target_position, smoothness) to achieve this effect. Take a look at this. Edit I found the answer on their site MoveToAction action = Actions.action(MoveToAction.class); action.setPosition(x, y); action.setDuration(duration); action.setInterpolation(Interpolation.bounceOut); actor.addAction(action); (I ...


2

That spacing is called font kerning. And that is exactly why there is padding in front. The purpose of kerning is so that letters fit nicely next to each other, and that they aren't too close or too far away from each other.


2

This issue happens with some MSAA or CSAA implementations. Try disabling anti-aliasing and see if it goes away. If that is the case you might need to force multi-sampling resolve before rendering your transparency. The other solution would be to force some overlap of your tiles.


2

This problem is usually a sound design problem, not a coding problem. These problems occur mostly because of insufficient use of random variations in sound samples. You should first make sure you are using a pool of different recordings of the same sound and play a random one each time you fire a bullet, or make small random variations of the pitch on the ...


1

Check out the principles behind stencil buffers and/or masking. Essentially what you want to do is generate a mask/stencil to mark out your drawing area and use this mask to decide if the user can draw or not. For example, take your shapes you want the user to draw on and render them as pure white into a full-screen buffer, with a default colour of black. ...


1

In this line ball.applyLinearImpulse(new Vector2(0f, 5000f), ball.getPosition(), true); I think the point where you put force it relative to object position, so you put impule in ball.getPosition() + ball.getPosition() Try to use public void applyForceToCenter(Vector2 force, boolean wake) or ball.applyLinearImpulse(new Vector2(0f, 5000f), new ...


1

How the author specifically got that value was via experimentation. From the comments: Q: Hi James, you set acceleration.y to 460. How did you find this number? Is it static? A: Acceleration was experimentally determined. Its value does not change. And this is often the case when determining values for your game. You pick a value and play-test ...


1

I suggest moving the target slowly rather than the angle. Try this: Vector2 Target; // Interp is a value between 0 and 1. When 0, the target never moves. // When 1, the target moves instantaneously. Intermediate values cause the target // to move at different rates. void UpdateTarget(float interp) { Target = interp * Mouse.Position + (1 - interp) * ...


1

I think any linear function would be fine for this. You can keep two variables one for your spaceship's current angle spaceshipAngle = Math.PI*k, and one for the current angle that the user inputs with his cursor cursorAngle = Math.PI*p. And what you do is if (Math.Abs(Math.PI*k, Math.PI*p) < Math.PI) { if (Math.PI*k < Math.PI*p) k += ...


1

The conversion from a unit to another is a matter of a simple multiplication. You can implement a ConvertUnits static class with functions like ConvertToGameUnits(), and ConvertToBox2DUnits() to make it easier. I haven't used libgdx or Box2D, but i have used Farseer Physics engine which is basically identical with box2D but made for C#. With that being ...


1

What makes you think this is the shader code that is slow ? In most machines nowadays, and especially mobile devices, the bottlenecks are not these purely calculation-fed (ALU loaded) shaders, but memory bandwidth. Memory bandwidth is used by framebuffers being fed to shaders as textures, or by the ROPs writing to the render target. Especially bad when ...


1

If you prefer using an external file to hold save information and it is in a place that would be tamper-able by users you may want to read up on how encryption works and use that to prevent anyone from being able to make meaningful changes to the file. Something like a Feistel Cipher should be a good starting point and would be sufficient to stop someone ...


1

To get rid of the lines, you need to set Pixmap.setBlending(Blending.NONE); before you draw the circle.


1

You should not do it like that. Use scene2d for your buttons and menus and use InputMultiplexer to set up multiple input processor.


1

If you let your library scale down the textures and drop the originals from memory then you will not have any problems with memory consumption. Your load times will however increase drastically, along with the download size and storage space needed for your game. If you are going to ship on phones then you should definitely scale your textures lower than ...


1

I've never used libGDX but textures Cost a lot of memory in general. Which isn't a big deal on PC but you have to watch out with mobile devices which have limited resources. Let's say you have a device with 256MB of memory, you have 10 textures in your scene and each texture is about 8MB (assuming we're using 2048x2048 32-bit png). Thats using about 30% of ...


1

With a camera you separate your game measurements from the screen size and ratio. It is not always better. If you make a board game for example, you can just fit it to the width of the screen, the view will never move anyway. When using pixels to measure, you have no floating point positions. By the way i made a full pong like game without a camera. I ...


1

When browser the libgdx documentation (for example at http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/maps/MapLayer.html), I don't see any mention of the image layer, so most likely this relatively new (and still quite limited) layer type is not supported by libgdx yet. If you would like to see this supported in libgdx, I suggest opening ...


1

Gdx.gl.glClear : as .glClear suggests, this function clears the screen before drawing the next frame. It depends where do you instantiate your font object (as you're using libgdx I guess you use BitmapFont to create your font object). An approach could be to instantiate it in the main class (the one that extends Game), and whenever you want to draw it on ...



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