Tag Info

New answers tagged

0

All you have to to is translate then scale your scene, so Create a matrix s= 1/tilecount; for(int x=0; x!=tilecount; x++) for(int y=0; y!=tilecount; y++) [s 0 0 x*s] [0 s 0 y*s] [0 0 1 0] [0 0 0 1] And multiply it * your modelviewprojection


0

You only truly need a separate class if you're multithreading, so you can have separate constructors, one ran in the render thread. Even then its up to you whether or not you want to do that. The big reason is just organization. More important than anything is to make sure your textures and render programs are static. You also want to render all of a single ...


0

Changes when it was structs were not propagating because things were passed by value rather than reference. This meant that the face culling wasn't applying, and all blocks had all faces culled unless they were freshly-placed. I opted to stick with classes for now, but that was the issue.


0

Try change default Facing value from none to something else. If this value is established for all the blocks you get it just does not change where it should. Perhaps you pass a block as a parameter and change its value Facing inside the method.


0

I think you have inverted the alpha in the interpolation. It should be curr*alpha + prev*(1-alpha). From Fix Your Timestep!: State state = currentState * alpha + previousState * ( 1.0 - alpha ); In fact you are rendering an interpolated status that has 1 time-step of latency, so Actual time elapsed |----------|---_______| Time simulated ...


0

It looks like you're drawing on a SurfaceView surface. Bear in mind that the surface is a completely separate layer that, by default, sits behind everything else. The View part of the SurfaceView is a transparent "hole" that the layout code uses to adjust everything else around it. The most common way to get a black screen is to define an opaque ...


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


0

For this kind of thing, it depends on what your goals is. If you're looking to ensure that lines are 1 pixel wide, then you could draw the grid using lines instead of textured triangles: However with ensuring that lines are 1 pixel wide, when they're so far away that the individual grid spaces are less than 1px, it will look like a solid: With your ...


0

You can't avoid this problem, you can try super sampling to make it less jarring ... but high frequency + high contrast works very bad in quantisize space. I go around this with a very small bit of blurring on the texture, it's counter intuitive but then you have more chance than a pixel pick a blur value and make the line looks antialiased on the texture, ...


0

The way you draw them, you have big cells that contain 10x10 small cells. Would it be acceptable to draw only the big cells when they're at a certain distance from the camera? That would be one possibility. Another would be to actually draw lines, like in a wireframe mesh. They are always exactly one pixel wide. That's all the ideas i have right now.


4

There are two obstacles you need to deal with in order to achieve similar quality like the one in the image, the first is artistic and the second is technical (memory, processing). First I assume that you already solved your artistic problem, you can make the models, the art and the shaders etc. (Partially because I can't answer art problems) The major ...


12

This is achieved by interpolating ramps between cubes of different height. When you have a scenery like this (seen from the side) # #### ## ############ you would add polygons to make it look like this: /#\ /####\ /##\ ############ An algorithm to calculate these ramps is the marching cubes algorithm. When you want it to be even more beautiful, ...


1

If you use a point sampler for your mask texture, then you can store as many IDs as bits in your texture: for a 32-bit RGBA texture you'd be able to store 128 different IDs. In such a case though, as you have a single bit per ID, there's virtually no blending as you have only 0 or 1. The more bits you devote per ID, the greater the blending granularity, ...


1

Lets call everything that happens inside a game an event for the duration of this answer. The events that occur in a game are not "observing" the game model. They happen every x frames. Rendering for instance happens every frame and the view doesn't need to care if the model changed or not since the previous frame. It normally will render every frame. This ...


4

It's not necessary, in the sense that you can make it work. But your approach is somewhat... awkward. In your approach, the pre-render and post-render work (such as clearing the appropriate render targets, and then presenting the final frame the screen) has to be done before and after getUserInput(): while (game_is_running){ prepareForRender(); ...


1

Big engines using 'premutation' that make many shaders for every specifited set of material features. But thats not solution for 'deffered' rendering, for deffered rendering you should implement material 'indexes' Indexes will select proper render path, and all material caps. Usualy indexes created in matrial pipeline, when level builds. Small parts of ...


1

You can use a tiny neutral texture to "disable" shader features you're not using which incurs a texture switch penalty but no shader switch penalty. You can generate multiple shaders with all feature combinations and switch to the proper shader, this incurs a shader switch penalty but the simpler shaders execute faster. Which ever is best depends on which ...


0

Only render when you've done at least 1 logic update. If you have not done any logic update (too fast) sleep for about 1ms and check again. I found that on some OSes calculating the sleep time caused the timing to always be off by a good margin. It's not an issue on Android or iOS but I got into the habit of using 1ms sleep for action games and calculating ...



Top 50 recent answers are included