Tag Info

Hot answers tagged

4

One way to go is to split the whole world into chunks, and load just the chunk the player character is currently in (or any number of chunks that are closest). This way you only have to listen for events in this chunk. This does not mean you have to split everything into "levels". Minecraft is a fairly good example of splitting a giant world into chunks that ...


2

Typical approaches to reduce processing are: Spatial subdivision / coherence - Don't process everything in the whole world, instead only do so in pertinent regions - usually only those in close proximity to the player(s). - Group units close together as a single unit to reduce overall count (Rome: Total War). Common in real-time rendering fields. ...


2

As far as I know, modern high performance rendering engines gather render operations into a so called "render queue". Each such operation is basically a single drawcall: it has buffers, shaders, shader uniform data, textures, whatever other state needed... These are then sorted, most expensive to switch property first. Shaders are expensive to switch, so ...


1

I can't quite spot the error in your code, but this looks odd. cocos2d::Size gridPixelSize = cocos2d::Size(mGridSize.width * mOffset, (mGridSize.height-1) * mOffset); Why the - 1 on height? Also, in general to do something like this, you should abstract away the screen coordinates entirely. Make a hierarchical system so that when handling clicks, you ...


1

The fast and simple solution is just to increment all returned Y values by 2. I'm not seeing an obvious error although I can't see the whole situation. I suspect when you subtract 74 pixels to offset the grid you either did or didn't also subtract 74 pixels from every pixel input to methods. It may also have something to do with your offsets or your ...


1

There isn't any libGDX function for this particular problem, but it should be something like: Vector2 closestToFinger(Vector2[] vectorsArray, Vector2 touchPosition) { float shortestDist = 0; Vector2 closestVector = null; for(point in vectorsArray){ float dst2 = touchPosition.dst2(point); if(closesVector == null || dst2 ...



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